Skip to content

Commit e905dae

Browse files
committed
Merge branch 'MC-43250' into MC-39920
2 parents 4be5b0e + de15fd2 commit e905dae

File tree

12 files changed

+63
-51
lines changed

12 files changed

+63
-51
lines changed

dev/tests/integration/testsuite/Magento/Catalog/Fixture/AddProductAttributeToAttributeSet.php renamed to app/code/Magento/Catalog/Test/Fixture/AddAttributeToAttributeSet.php

Lines changed: 4 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -5,18 +5,18 @@
55
*/
66
declare(strict_types=1);
77

8-
namespace Magento\Catalog\Fixture;
8+
namespace Magento\Catalog\Test\Fixture;
99

1010
use Magento\Catalog\Api\ProductAttributeManagementInterface;
1111
use Magento\Catalog\Model\Product;
1212
use Magento\Eav\Setup\EavSetup;
1313
use Magento\TestFramework\Fixture\Api\ServiceFactory;
14-
use Magento\TestFramework\Fixture\RevertibleDataFixtureInterface;
14+
use Magento\TestFramework\Fixture\DataFixtureInterface;
1515

1616
/**
17-
* Add product attribute to attribute set fixture
17+
* Add product attribute to attribute set
1818
*/
19-
class AddProductAttributeToAttributeSet implements RevertibleDataFixtureInterface
19+
class AddAttributeToAttributeSet implements DataFixtureInterface
2020
{
2121
/**
2222
* @var ServiceFactory
@@ -62,18 +62,4 @@ public function apply(array $data = []): ?array
6262

6363
return $data;
6464
}
65-
66-
/**
67-
* @inheritdoc
68-
*/
69-
public function revert(array $data = []): void
70-
{
71-
$service = $this->serviceFactory->create(ProductAttributeManagementInterface::class, 'unassign');
72-
$service->execute(
73-
[
74-
'attribute_set_id' => $data['attribute_set_id'],
75-
'attribute_code' => $data['attribute_code'],
76-
]
77-
);
78-
}
7965
}

dev/tests/integration/testsuite/Magento/Catalog/Fixture/CreateProductAttribute.php renamed to app/code/Magento/Catalog/Test/Fixture/Attribute.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,17 +5,17 @@
55
*/
66
declare(strict_types=1);
77

8-
namespace Magento\Catalog\Fixture;
8+
namespace Magento\Catalog\Test\Fixture;
99

1010
use Magento\Catalog\Api\ProductAttributeRepositoryInterface;
1111
use Magento\TestFramework\Fixture\Api\ServiceFactory;
1212
use Magento\TestFramework\Fixture\RevertibleDataFixtureInterface;
1313
use Magento\TestFramework\Fixture\Data\ProcessorInterface;
1414

1515
/**
16-
* Create product attribute fixture
16+
* Creates product attribute fixture
1717
*/
18-
class CreateProductAttribute implements RevertibleDataFixtureInterface
18+
class Attribute implements RevertibleDataFixtureInterface
1919
{
2020
private const DEFAULT_DATA = [
2121
'is_wysiwyg_enabled' => false,

dev/tests/integration/testsuite/Magento/Catalog/Fixture/CreateCategory.php renamed to app/code/Magento/Catalog/Test/Fixture/Category.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,17 +5,17 @@
55
*/
66
declare(strict_types=1);
77

8-
namespace Magento\Catalog\Fixture;
8+
namespace Magento\Catalog\Test\Fixture;
99

1010
use Magento\Catalog\Model\CategoryFactory;
1111
use Magento\Catalog\Model\ResourceModel\Category as CategoryResource;
1212
use Magento\TestFramework\Fixture\Data\ProcessorInterface;
1313
use Magento\TestFramework\Fixture\RevertibleDataFixtureInterface;
1414

1515
/**
16-
* Create categpry fixture
16+
* Creates category fixture
1717
*/
18-
class CreateCategory implements RevertibleDataFixtureInterface
18+
class Category implements RevertibleDataFixtureInterface
1919
{
2020
private const DEFAULT_PARENT_ID = 2;
2121

dev/tests/integration/testsuite/Magento/Catalog/Fixture/CreateSimpleProduct.php renamed to app/code/Magento/Catalog/Test/Fixture/Product.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
*/
66
declare(strict_types=1);
77

8-
namespace Magento\Catalog\Fixture;
8+
namespace Magento\Catalog\Test\Fixture;
99

1010
use Magento\Catalog\Api\ProductRepositoryInterface;
1111
use Magento\Catalog\Model\Product\Attribute\Source\Status;
@@ -16,9 +16,9 @@
1616
use Magento\TestFramework\Fixture\Data\ProcessorInterface;
1717

1818
/**
19-
* Create simple product fixture
19+
* Creates simple product fixture
2020
*/
21-
class CreateSimpleProduct implements RevertibleDataFixtureInterface
21+
class Product implements RevertibleDataFixtureInterface
2222
{
2323
private const DEFAULT_DATA = [
2424
'type_id' => Type::TYPE_SIMPLE,

dev/tests/api-functional/phpunit_graphql.xml.dist

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -110,6 +110,9 @@
110110
<element key="Override">
111111
<string>Override</string>
112112
</element>
113+
<element key="magentoDataFixtureDataProvider">
114+
<string>magentoDataFixtureDataProvider</string>
115+
</element>
113116
</array>
114117
</arguments>
115118
</listener>

dev/tests/api-functional/phpunit_rest.xml.dist

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -116,6 +116,9 @@
116116
<element key="Override">
117117
<string>Override</string>
118118
</element>
119+
<element key="magentoDataFixtureDataProvider">
120+
<string>magentoDataFixtureDataProvider</string>
121+
</element>
119122
</array>
120123
</arguments>
121124
</listener>

dev/tests/api-functional/phpunit_soap.xml.dist

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -115,6 +115,9 @@
115115
<element key="Override">
116116
<string>Override</string>
117117
</element>
118+
<element key="magentoDataFixtureDataProvider">
119+
<string>magentoDataFixtureDataProvider</string>
120+
</element>
118121
</array>
119122
</arguments>
120123
</listener>

dev/tests/api-functional/testsuite/Magento/Catalog/Api/CategoryRepositoryTest.php

Lines changed: 16 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,8 @@
1717
use Magento\CatalogUrlRewrite\Model\CategoryUrlRewriteGenerator;
1818
use Magento\Integration\Api\AdminTokenServiceInterface;
1919
use Magento\Store\Model\Store;
20+
use Magento\TestFramework\Fixture\DataFixtureStorage;
21+
use Magento\TestFramework\Fixture\DataFixtureStorageManager;
2022
use Magento\TestFramework\Helper\Bootstrap;
2123
use Magento\TestFramework\TestCase\WebapiAbstract;
2224
use Magento\UrlRewrite\Model\Storage\DbStorage;
@@ -32,6 +34,9 @@ class CategoryRepositoryTest extends WebapiAbstract
3234
const RESOURCE_PATH = '/V1/categories';
3335
const SERVICE_NAME = 'catalogCategoryRepositoryV1';
3436

37+
/**
38+
* @var int
39+
*/
3540
private $modelId = 333;
3641

3742
/**
@@ -54,6 +59,11 @@ class CategoryRepositoryTest extends WebapiAbstract
5459
*/
5560
private $createdCategories;
5661

62+
/**
63+
* @var DataFixtureStorage
64+
*/
65+
private $fixtures;
66+
5767
/**
5868
* @inheritDoc
5969
*/
@@ -64,6 +74,7 @@ protected function setUp(): void
6474
$this->roleFactory = Bootstrap::getObjectManager()->get(RoleFactory::class);
6575
$this->rulesFactory = Bootstrap::getObjectManager()->get(RulesFactory::class);
6676
$this->adminTokens = Bootstrap::getObjectManager()->get(AdminTokenServiceInterface::class);
77+
$this->fixtures = Bootstrap::getObjectManager()->get(DataFixtureStorageManager::class)->getStorage();
6778
}
6879

6980
/**
@@ -230,7 +241,7 @@ private function buildExceptionMessage(int $categoryId): string
230241
}
231242

232243
/**
233-
* @magentoApiDataFixture Magento/Catalog/_files/category.php
244+
* @magentoApiDataFixture Magento\Catalog\Test\Fixture\Category with:{"id":333}
234245
*/
235246
public function testUpdate()
236247
{
@@ -257,11 +268,11 @@ public function testUpdate()
257268
}
258269

259270
/**
260-
* @magentoApiDataFixture Magento/Catalog/_files/category.php
271+
* @magentoApiDataFixture Magento\Catalog\Test\Fixture\Category as:category
261272
*/
262273
public function testUpdateWithDefaultSortByAttribute()
263274
{
264-
$categoryId = 333;
275+
$categoryId = $this->fixtures->get('category')->getCategory()->getId();
265276
$categoryData = [
266277
'name' => 'Update Category Test With default_sort_by Attribute',
267278
'is_active' => true,
@@ -285,7 +296,7 @@ public function testUpdateWithDefaultSortByAttribute()
285296
}
286297

287298
/**
288-
* @magentoApiDataFixture Magento/Catalog/_files/category.php
299+
* @magentoApiDataFixture Magento\Catalog\Test\Fixture\Category with:{"id":333}
289300
*/
290301
public function testUpdateUrlKey()
291302
{
@@ -590,7 +601,7 @@ public function testSaveDesign(): void
590601
/**
591602
* Check if repository does not override default values for attributes out of request
592603
*
593-
* @magentoApiDataFixture Magento/Catalog/_files/category.php
604+
* @magentoApiDataFixture Magento\Catalog\Test\Fixture\Category with:{"id":333}
594605
*/
595606
public function testUpdateScopeAttribute()
596607
{

dev/tests/api-functional/testsuite/Magento/GraphQl/Catalog/CategoryTest.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -275,7 +275,7 @@ public function testCategoriesTreeWithDisabledCategory()
275275
}
276276

277277
/**
278-
* @magentoApiDataFixture Magento/Catalog/_files/categories.php
278+
* @magentoApiDataFixture Magento\Catalog\Test\Fixture\Category with:{"id":13,"name":"Category 1.2"}
279279
*/
280280
public function testGetCategoryById()
281281
{
@@ -294,7 +294,7 @@ public function testGetCategoryById()
294294
}
295295

296296
/**
297-
* @magentoApiDataFixture Magento/Catalog/_files/categories.php
297+
* @magentoApiDataFixture Magento\Catalog\Test\Fixture\Category with:{"id":8,"is_active":false}
298298
*/
299299
public function testGetDisabledCategory()
300300
{

dev/tests/integration/framework/tests/unit/testsuite/Magento/Test/Fixture/Api/ServiceTest.php

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,8 @@
1616

1717
/**
1818
* Test fixture api service
19+
*
20+
* @SuppressWarnings(PHPMD.UnusedFormalParameter)
1921
*/
2022
class ServiceTest extends TestCase
2123
{
@@ -40,7 +42,11 @@ protected function setUp(): void
4042
$serviceInputProcessor = $this->createMock(ServiceInputProcessor::class);
4143
$serviceInputProcessor->expects($this->once())
4244
->method('process')
43-
->willReturnArgument(2);
45+
->willReturnCallback(
46+
function (string $serviceClassName, string $serviceMethodName, array $params) {
47+
return array_values($params);
48+
}
49+
);
4450

4551
$this->fakeClass = $this->getMockBuilder(stdClass::class)
4652
->addMethods(['fakeMethod'])

0 commit comments

Comments
 (0)