27
27
* - general behaviour is tested
28
28
*
29
29
* @SuppressWarnings(PHPMD.CouplingBetweenObjects)
30
+ * @see \Magento\Catalog\Model\CategoryTreeTest
31
+ * @magentoDataFixture Magento/Catalog/_files/categories.php
32
+ * @magentoDbIsolation enabled
33
+ * @magentoAppIsolation enabled
30
34
*/
31
35
class CategoryTest extends TestCase
32
36
{
@@ -64,12 +68,14 @@ protected function setUp()
64
68
$ this ->categoryResource = $ this ->objectManager ->get (CategoryResource::class);
65
69
$ this ->categoryRepository = $ this ->objectManager ->get (CategoryRepositoryInterface::class);
66
70
}
71
+
67
72
public function testGetUrlInstance (): void
68
73
{
69
74
$ instance = $ this ->_model ->getUrlInstance ();
70
75
$ this ->assertInstanceOf (Url::class, $ instance );
71
76
$ this ->assertSame ($ instance , $ this ->_model ->getUrlInstance ());
72
77
}
78
+
73
79
public function testGetTreeModel (): void
74
80
{
75
81
$ model = $ this ->_model ->getTreeModel ();
@@ -108,9 +114,6 @@ public function testGetAttributes(): void
108
114
$ this ->assertArrayNotHasKey ('custom_design ' , $ attributes );
109
115
}
110
116
111
- /**
112
- * @magentoDataFixture Magento/Catalog/_files/categories.php
113
- */
114
117
public function testGetProductsPosition (): void
115
118
{
116
119
$ this ->assertEquals ([], $ this ->_model ->getProductsPosition ());
@@ -123,9 +126,6 @@ public function testGetProductsPosition(): void
123
126
$ this ->assertNotEmpty ($ this ->_model ->getProductsPosition ());
124
127
}
125
128
126
- /**
127
- * @magentoDataFixture Magento/Catalog/_files/categories.php
128
- */
129
129
public function testGetStoreIds (): void
130
130
{
131
131
$ this ->_model = $ this ->getCategoryByName ('Category 1.1 ' );
@@ -218,9 +218,6 @@ public function testGetDesignAttributes(): void
218
218
$ this ->assertContains ('custom_design_to ' , array_keys ($ attributes ));
219
219
}
220
220
221
- /**
222
- * @magentoDataFixture Magento/Catalog/_files/categories.php
223
- */
224
221
public function testCheckId (): void
225
222
{
226
223
$ this ->_model = $ this ->getCategoryByName ('Category 1.1.1 ' );
@@ -235,9 +232,6 @@ public function testVerifyIds(): void
235
232
$ this ->assertNotContains (100 , $ ids );
236
233
}
237
234
238
- /**
239
- * @magentoDataFixture Magento/Catalog/_files/categories.php
240
- */
241
235
public function testHasChildren (): void
242
236
{
243
237
$ this ->_model ->load (3 );
@@ -260,9 +254,6 @@ public function testGetName(): void
260
254
$ this ->assertEquals ('test ' , $ this ->_model ->getName ());
261
255
}
262
256
263
- /**
264
- * @magentoDataFixture Magento/Catalog/_files/categories.php
265
- */
266
257
public function testGetProductCount (): void
267
258
{
268
259
$ this ->_model ->load (6 );
@@ -335,7 +326,6 @@ public function testSaveCategoryWithoutImage(): void
335
326
}
336
327
337
328
/**
338
- * @magentoDataFixture Magento/Catalog/_files/categories.php
339
329
* @magentoAppArea adminhtml
340
330
*/
341
331
public function testDeleteChildren (): void
@@ -390,9 +380,6 @@ public function testMissingRequiredAttribute(): void
390
380
$ this ->expectExceptionMessage (
391
381
(string )__ ('The "Name" attribute value is empty. Set the attribute and try again. ' )
392
382
);
393
-
394
- $ categoryResource = $ this ->objectManager ->create (CategoryResource::class);
395
- $ this ->_model = $ this ->objectManager ->create (Category::class, ['resource ' => $ categoryResource ]);
396
383
$ this ->_model ->setData ($ data );
397
384
$ this ->_model ->validate ();
398
385
}
@@ -472,9 +459,6 @@ public function testCreateSubcategoryWithMultipleStores(): void
472
459
$ this ->assertEquals ($ parentSecondStoreKey . '/test-category-100 ' , $ childCategorySecondStore ->getUrlPath ());
473
460
}
474
461
475
- /*
476
- * @magentoDataFixture Magento/Catalog/_files/categories.php
477
- */
478
462
protected function getCategoryByName ($ categoryName )
479
463
{
480
464
/* @var Collection $collection */
0 commit comments