Skip to content

Commit 4912aa7

Browse files
authored
Merge branch '2.4-develop' into platform-health
2 parents d7918c6 + 9d69186 commit 4912aa7

File tree

15 files changed

+109
-48
lines changed

15 files changed

+109
-48
lines changed

app/code/Magento/Catalog/Test/Mftf/Section/StorefrontCategoryFilterSection.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
<sections xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
1010
xsi:noNamespaceSchemaLocation="urn:magento:mftf:Page/etc/SectionObject.xsd">
1111
<section name="StorefrontCategoryFilterSection">
12-
<element name="CategoryFilter" type="button" selector="//main//div[@class='filter-options']//div[contains(text(), 'Category')]"/>
12+
<element name="CategoryFilter" type="button" selector="//main//div[contains(@class,'filter-options')]//div[contains(text(), 'Category')]"/>
1313
<element name="CategoryByName" type="button" selector="//main//div[@class='filter-options']//li[@class='item']//a[contains(text(), '{{var1}}')]" parameterized="true"/>
1414
</section>
1515
</sections>

app/code/Magento/RemoteStorage/etc/di.xml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@
2626
<argument name="writeFactory" xsi:type="object">
2727
Magento\RemoteStorage\Model\Filesystem\Directory\WriteFactory
2828
</argument>
29+
<argument name="readFactory" xsi:type="object">remoteReadFactory</argument>
2930
</arguments>
3031
</type>
3132
<virtualType name="customRemoteFilesystem" type="Magento\RemoteStorage\Filesystem">

app/code/Magento/Sales/Test/Mftf/Section/AdminOrderCommentsTabSection.xml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,8 @@
99
<sections xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
1010
xsi:noNamespaceSchemaLocation="urn:magento:mftf:Page/etc/SectionObject.xsd">
1111
<section name="AdminOrderCommentsTabSection">
12-
<element name="orderNotesList" type="text" selector="#Order_History .edit-order-comments .note-list"/>
13-
<element name="orderComments" type="text" selector="#Order_History .edit-order-comments-block"/>
14-
<element name="orderComment" type="text" selector="#Order_History .comments-block-item-comment"/>
12+
<element name="orderNotesList" type="text" selector="div[aria-labelledby='sales_order_view_tabs_order_history'] .edit-order-comments .note-list"/>
13+
<element name="orderComments" type="text" selector="div[aria-labelledby='sales_order_view_tabs_order_history'] .edit-order-comments-block"/>
14+
<element name="orderComment" type="text" selector="div[aria-labelledby='sales_order_view_tabs_order_history'] .comments-block-item-comment"/>
1515
</section>
1616
</sections>

dev/tests/integration/framework/Magento/TestFramework/Helper/Amqp.php

Lines changed: 14 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@ class Amqp
1818
const CONFIG_PATH_PASSWORD = 'queue/amqp/password';
1919
const DEFAULT_MANAGEMENT_PROTOCOL = 'http';
2020
const DEFAULT_MANAGEMENT_PORT = '15672';
21+
const DEFAULT_VIRTUALHOST = '/';
2122

2223
/**
2324
* @var Curl
@@ -30,12 +31,15 @@ class Amqp
3031
private $deploymentConfig;
3132

3233
/**
33-
* RabbitMQ API host
34-
*
3534
* @var string
3635
*/
3736
private $host;
3837

38+
/**
39+
* @var string
40+
*/
41+
private $virtualHost;
42+
3943
/**
4044
* Initialize dependencies.
4145
* @param \Magento\Framework\App\DeploymentConfig $deploymentConfig
@@ -59,6 +63,7 @@ public function __construct(
5963
$this->deploymentConfig->get(self::CONFIG_PATH_HOST),
6064
defined('RABBITMQ_MANAGEMENT_PORT') ? RABBITMQ_MANAGEMENT_PORT : self::DEFAULT_MANAGEMENT_PORT
6165
);
66+
$this->virtualHost = defined('RABBITMQ_VIRTUALHOST') ? RABBITMQ_VIRTUALHOST : self::DEFAULT_VIRTUALHOST;
6267
}
6368

6469
/**
@@ -82,7 +87,7 @@ public function isAvailable(): bool
8287
*/
8388
public function getExchanges()
8489
{
85-
$this->curl->get($this->host . 'exchanges');
90+
$this->curl->get($this->host . 'exchanges/' . urlencode($this->virtualHost));
8691
$data = $this->curl->getBody();
8792
$data = json_decode($data, true);
8893
$output = [];
@@ -100,7 +105,7 @@ public function getExchanges()
100105
*/
101106
public function getExchangeBindings($name)
102107
{
103-
$this->curl->get($this->host . 'exchanges/%2f/' . $name . '/bindings/source');
108+
$this->curl->get($this->host . 'exchanges/' . urlencode($this->virtualHost) . '/' . $name . '/bindings/source');
104109
$data = $this->curl->getBody();
105110
return json_decode($data, true);
106111
}
@@ -112,7 +117,7 @@ public function getExchangeBindings($name)
112117
*/
113118
public function getConnections()
114119
{
115-
$this->curl->get($this->host . 'connections');
120+
$this->curl->get($this->host . 'vhosts/' . urlencode($this->virtualHost) . '/connections');
116121
$data = $this->curl->getBody();
117122
$data = json_decode($data, true);
118123
$output = [];
@@ -137,7 +142,10 @@ public function clearQueue(string $name, int $numMessages = 50)
137142
"encoding" => "auto",
138143
"truncate" => 50000
139144
];
140-
$this->curl->post($this->host . 'queue/%2f/' . $name . '/get', json_encode($body));
145+
$this->curl->post(
146+
$this->host . 'queue/' . urlencode($this->virtualHost) . '/' . $name . '/get',
147+
json_encode($body)
148+
);
141149
return $this->curl->getBody();
142150
}
143151

dev/tests/integration/phpunit.xml.dist

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -82,6 +82,7 @@
8282
<!-- Connection parameters for RabbitMQ tests -->
8383
<!--<const name="RABBITMQ_MANAGEMENT_PROTOCOL" value="https"/>-->
8484
<!--<const name="RABBITMQ_MANAGEMENT_PORT" value="15672"/>-->
85+
<!--<const name="RABBITMQ_VIRTUALHOST" value="/"/>-->
8586
<!--<const name="TESTS_PARALLEL_RUN" value="1"/>-->
8687
<const name="USE_OVERRIDE_CONFIG" value="enabled"/>
8788
</php>

dev/tests/integration/testsuite/Magento/Customer/Model/Metadata/Form/ImageTest.php

Lines changed: 16 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -76,7 +76,7 @@ public function testProcessCustomerAddressValue()
7676
$this->mediaDirectory->delete('customer_address');
7777
$this->mediaDirectory->create($this->mediaDirectory->getRelativePath('customer_address/tmp/'));
7878
$tmpFilePath = $this->mediaDirectory->getAbsolutePath('customer_address/tmp/' . $this->fileName);
79-
copy($this->imageFixtureDir . DIRECTORY_SEPARATOR . $this->fileName, $tmpFilePath);
79+
$this->copyFile($this->imageFixtureDir . DIRECTORY_SEPARATOR . $this->fileName, $tmpFilePath);
8080

8181
$imageFile = [
8282
'name' => $this->fileName,
@@ -106,7 +106,7 @@ public function testProcessCustomerAddressValue()
106106
$processCustomerAddressValueMethod->setAccessible(true);
107107
$actual = $processCustomerAddressValueMethod->invoke($image, $imageFile);
108108
$this->assertEquals($this->expectedFileName, $actual);
109-
$this->assertFileExists($expectedPath);
109+
$this->assertTrue($this->mediaDirectory->isExist($expectedPath));
110110
$this->assertFileDoesNotExist($tmpFilePath);
111111
}
112112

@@ -122,7 +122,7 @@ public function testProcessCustomerValue()
122122
$this->mediaDirectory->delete('customer');
123123
$this->mediaDirectory->create($this->mediaDirectory->getRelativePath('customer/tmp/'));
124124
$tmpFilePath = $this->mediaDirectory->getAbsolutePath('customer/tmp/' . $this->fileName);
125-
copy($this->imageFixtureDir . DIRECTORY_SEPARATOR . $this->fileName, $tmpFilePath);
125+
$this->copyFile($this->imageFixtureDir . DIRECTORY_SEPARATOR . $this->fileName, $tmpFilePath);
126126

127127
$imageFile = [
128128
'name' => $this->fileName,
@@ -170,7 +170,7 @@ public function testProcessCustomerInvalidValue()
170170
$this->mediaDirectory->delete('customer');
171171
$this->mediaDirectory->create($this->mediaDirectory->getRelativePath('customer/tmp/'));
172172
$tmpFilePath = $this->mediaDirectory->getAbsolutePath('customer/tmp/' . $this->fileName);
173-
copy($this->imageFixtureDir . DIRECTORY_SEPARATOR . $this->fileName, $tmpFilePath);
173+
$this->copyFile($this->imageFixtureDir . DIRECTORY_SEPARATOR . $this->fileName, $tmpFilePath);
174174

175175
$imageFile = [
176176
'name' => $this->fileName,
@@ -214,4 +214,16 @@ public static function tearDownAfterClass(): void
214214
$mediaDirectory->delete('customer');
215215
$mediaDirectory->delete('customer_address');
216216
}
217+
218+
/**
219+
* @param string $source
220+
* @param string $destination
221+
* @throws FileSystemException
222+
*/
223+
private function copyFile(string $source, string $destination)
224+
{
225+
$driver = $this->mediaDirectory->getDriver();
226+
$driver->createDirectory(dirname($destination));
227+
$driver->filePutContents($destination, file_get_contents($source));
228+
}
217229
}

dev/tests/integration/testsuite/Magento/Framework/File/UploaderTest.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
99

1010
use Magento\Customer\Model\FileProcessor;
1111
use Magento\Framework\App\Filesystem\DirectoryList;
12+
use Magento\Framework\Filesystem\DriverPool;
1213

1314
/**
1415
* Test for \Magento\Framework\File\Uploader
@@ -102,7 +103,7 @@ public function testUploadFileWithExcessiveFolderName(): void
102103
public function testUploadFileWhenOldMediaGalleryDisabled(string $directoryCode): void
103104
{
104105
$destinationDirectory = $this->filesystem->getDirectoryWrite($directoryCode);
105-
$tmpDirectory = $this->filesystem->getDirectoryWrite(DirectoryList::SYS_TMP);
106+
$tmpDirectory = $this->filesystem->getDirectoryWrite(DirectoryList::SYS_TMP, DriverPool::FILE);
106107

107108
$fileName = 'file.txt';
108109
$destinationDir = 'tmp';

dev/tests/integration/testsuite/Magento/Framework/MessageQueue/TopologyTest.php

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -83,11 +83,12 @@ public function testTopologyInstallation(array $expectedConfig, array $bindingCo
8383
*/
8484
public function exchangeDataProvider(): array
8585
{
86+
$virtualHost = defined('RABBITMQ_VIRTUALHOST') ? RABBITMQ_VIRTUALHOST : Amqp::DEFAULT_VIRTUALHOST;
8687
return [
8788
'magento-topic-based-exchange1' => [
8889
'exchangeConfig' => [
8990
'name' => 'magento-topic-based-exchange1',
90-
'vhost' => '/',
91+
'vhost' => $virtualHost,
9192
'type' => 'topic',
9293
'durable' => true,
9394
'auto_delete' => false,
@@ -99,7 +100,7 @@ public function exchangeDataProvider(): array
99100
'bindingConfig' => [
100101
[
101102
'source' => 'magento-topic-based-exchange1',
102-
'vhost' => '/',
103+
'vhost' => $virtualHost,
103104
'destination' => 'topic-queue1',
104105
'destination_type' => 'queue',
105106
'routing_key' => 'anotherTopic1',
@@ -112,7 +113,7 @@ public function exchangeDataProvider(): array
112113
'magento-topic-based-exchange2' => [
113114
'exchangeConfig' => [
114115
'name' => 'magento-topic-based-exchange2',
115-
'vhost' => '/',
116+
'vhost' => $virtualHost,
116117
'type' => 'topic',
117118
'durable' => true,
118119
'auto_delete' => false,
@@ -125,7 +126,7 @@ public function exchangeDataProvider(): array
125126
'bindingConfig' => [
126127
[
127128
'source' => 'magento-topic-based-exchange2',
128-
'vhost' => '/',
129+
'vhost' => $virtualHost,
129130
'destination' => 'topic-queue2',
130131
'destination_type' => 'queue',
131132
'routing_key' => 'anotherTopic2',
@@ -140,7 +141,7 @@ public function exchangeDataProvider(): array
140141
'magento-topic-based-exchange3' => [
141142
'exchangeConfig' => [
142143
'name' => 'magento-topic-based-exchange3',
143-
'vhost' => '/',
144+
'vhost' => $virtualHost,
144145
'type' => 'topic',
145146
'durable' => false,
146147
'auto_delete' => true,
@@ -152,7 +153,7 @@ public function exchangeDataProvider(): array
152153
'magento-topic-based-exchange4' => [
153154
'exchangeConfig' => [
154155
'name' => 'magento-topic-based-exchange4',
155-
'vhost' => '/',
156+
'vhost' => $virtualHost,
156157
'type' => 'topic',
157158
'durable' => true,
158159
'auto_delete' => false,
@@ -162,7 +163,7 @@ public function exchangeDataProvider(): array
162163
'bindingConfig' => [
163164
[
164165
'source' => 'magento-topic-based-exchange4',
165-
'vhost' => '/',
166+
'vhost' => $virtualHost,
166167
'destination' => 'topic-queue1',
167168
'destination_type' => 'queue',
168169
'routing_key' => '#',
@@ -172,7 +173,7 @@ public function exchangeDataProvider(): array
172173
],
173174
[
174175
'source' => 'magento-topic-based-exchange4',
175-
'vhost' => '/',
176+
'vhost' => $virtualHost,
176177
'destination' => 'topic-queue2',
177178
'destination_type' => 'queue',
178179
'routing_key' => '*.*.*',

dev/tests/integration/testsuite/Magento/ImportExport/Controller/Adminhtml/Export/File/DeleteTest.php

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ protected function setUp(): void
5151
$this->fileSystem = $this->_objectManager->get(Filesystem::class);
5252
$this->sourceFilePath = __DIR__ . '/../../Import/_files' . DIRECTORY_SEPARATOR . $this->fileName;
5353
//Refers to tests 'var' directory
54-
$this->varDirectory = $this->fileSystem->getDirectoryRead(DirectoryList::VAR_IMPORT_EXPORT);
54+
$this->varDirectory = $this->fileSystem->getDirectoryWrite(DirectoryList::VAR_IMPORT_EXPORT);
5555
}
5656

5757
/**
@@ -84,12 +84,15 @@ public function testExecute($file): void
8484
*
8585
* @param $destinationFilePath
8686
* @return void
87+
* @throws \Magento\Framework\Exception\FileSystemException
8788
*/
8889
protected function copyFile($destinationFilePath): void
8990
{
90-
//Refers to application root directory
91-
$rootDirectory = $this->fileSystem->getDirectoryWrite(DirectoryList::ROOT);
92-
$rootDirectory->copyFile($this->sourceFilePath, $this->varDirectory->getAbsolutePath($destinationFilePath));
91+
$driver = $this->varDirectory->getDriver();
92+
$absolutePath = $this->varDirectory->getAbsolutePath($destinationFilePath);
93+
94+
$driver->createDirectory(dirname($absolutePath));
95+
$driver->filePutContents($absolutePath, file_get_contents($this->sourceFilePath));
9396
}
9497

9598
/**
@@ -112,7 +115,7 @@ public static function tearDownAfterClass(): void
112115
{
113116
$filesystem = Bootstrap::getObjectManager()->get(Filesystem::class);
114117
/** @var WriteInterface $directory */
115-
$directory = $filesystem->getDirectoryWrite(DirectoryList::VAR_DIR);
118+
$directory = $filesystem->getDirectoryWrite(DirectoryList::VAR_IMPORT_EXPORT);
116119
if ($directory->isExist('export')) {
117120
$directory->delete('export');
118121
}

dev/tests/integration/testsuite/Magento/ImportExport/Controller/Adminhtml/Export/File/DownloadTest.php

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,7 @@ protected function setUp(): void
6565
$this->backendUrl->turnOnSecretKey();
6666
$this->sourceFilePath = __DIR__ . '/../../Import/_files' . DIRECTORY_SEPARATOR . $this->fileName;
6767
//Refers to tests 'var' directory
68-
$this->varDirectory = $this->fileSystem->getDirectoryRead(DirectoryList::VAR_DIR);
68+
$this->varDirectory = $this->fileSystem->getDirectoryWrite(DirectoryList::VAR_IMPORT_EXPORT);
6969
}
7070

7171
/**
@@ -124,9 +124,11 @@ public function testExecute($file): void
124124
*/
125125
private function copyFile($destinationFilePath): void
126126
{
127-
//Refers to application root directory
128-
$rootDirectory = $this->fileSystem->getDirectoryWrite(DirectoryList::ROOT);
129-
$rootDirectory->copyFile($this->sourceFilePath, $this->varDirectory->getAbsolutePath($destinationFilePath));
127+
$driver = $this->varDirectory->getDriver();
128+
$absolutePath = $this->varDirectory->getAbsolutePath($destinationFilePath);
129+
130+
$driver->createDirectory(dirname($absolutePath));
131+
$driver->filePutContents($absolutePath, file_get_contents($this->sourceFilePath));
130132
}
131133

132134
/**

dev/tests/integration/testsuite/Magento/ImportExport/Model/Export/Adapter/CsvTest.php

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,10 @@ protected function setUp(): void
4848
*/
4949
public function testDestruct(string $destination, bool $shouldBeDeleted): void
5050
{
51-
$csv = $this->objectManager->create(Csv::class, ['destination' => $destination]);
51+
$csv = $this->objectManager->create(Csv::class, [
52+
'destination' => $destination,
53+
'destinationDirectoryCode' => DirectoryList::VAR_DIR
54+
]);
5255
/** @var Filesystem $fileSystem */
5356
$fileSystem = $this->objectManager->get(Filesystem::class);
5457
$directoryHandle = $fileSystem->getDirectoryRead(DirectoryList::VAR_DIR);

dev/tests/integration/testsuite/Magento/ImportExport/Model/Export/ConsumerTest.php

Lines changed: 26 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -9,9 +9,8 @@
99

1010
use Magento\Catalog\Api\Data\ProductInterface;
1111
use Magento\Framework\App\Filesystem\DirectoryList;
12-
use Magento\Framework\File\Csv;
1312
use Magento\Framework\Filesystem;
14-
use Magento\Framework\Filesystem\Directory\Write;
13+
use Magento\Framework\Filesystem\Directory\WriteInterface;
1514
use Magento\Framework\MessageQueue\MessageEncoder;
1615
use Magento\Framework\ObjectManagerInterface;
1716
use Magento\MysqlMq\Model\Driver\Queue;
@@ -40,10 +39,7 @@ class ConsumerTest extends TestCase
4039
/** @var Queue */
4140
private $queue;
4241

43-
/** @var Csv */
44-
private $csvReader;
45-
46-
/** @var Write */
42+
/** @var WriteInterface */
4743
private $directory;
4844

4945
/** @var string */
@@ -60,8 +56,8 @@ protected function setUp(): void
6056
$this->queue = $this->objectManager->create(Queue::class, ['queueName' => 'export']);
6157
$this->messageEncoder = $this->objectManager->get(MessageEncoder::class);
6258
$this->consumer = $this->objectManager->get(Consumer::class);
63-
$this->directory = $this->objectManager->get(Filesystem::class)->getDirectoryWrite(DirectoryList::VAR_DIR);
64-
$this->csvReader = $this->objectManager->get(Csv::class);
59+
$filesystem = $this->objectManager->get(Filesystem::class);
60+
$this->directory = $filesystem->getDirectoryWrite(DirectoryList::VAR_IMPORT_EXPORT);
6561
}
6662

6763
/**
@@ -91,7 +87,7 @@ public function testProcess(): void
9187
$this->consumer->process($decodedMessage);
9288
$this->filePath = 'export/' . $decodedMessage->getFileName();
9389
$this->assertTrue($this->directory->isExist($this->filePath));
94-
$data = $this->csvReader->getData($this->directory->getAbsolutePath($this->filePath));
90+
$data = $this->getCsvData($this->directory->getAbsolutePath($this->filePath));
9591
$this->assertCount(2, $data);
9692
$skuPosition = $this->getSkuPosition($data);
9793
$this->assertNotNull($skuPosition);
@@ -117,4 +113,25 @@ private function getSkuPosition(array $csvFileData): ?int
117113

118114
return null;
119115
}
116+
117+
/**
118+
* Parse csv file and return csv data as array
119+
*
120+
* @param string $filePath
121+
* @return array
122+
* @throws \Magento\Framework\Exception\FileSystemException
123+
*/
124+
private function getCsvData(string $filePath): array
125+
{
126+
$driver = $this->directory->getDriver();
127+
$fileResource = $driver->fileOpen($filePath, 'r');
128+
129+
$data = [];
130+
while ($rowData = $driver->fileGetCsv($fileResource, 100000)) {
131+
$data[] = $rowData;
132+
}
133+
$driver->fileClose($fileResource);
134+
135+
return $data;
136+
}
120137
}

0 commit comments

Comments
 (0)