3
3
* Copyright © Magento, Inc. All rights reserved.
4
4
* See COPYING.txt for license details.
5
5
*/
6
+
6
7
namespace Magento \Catalog \Model ;
7
8
9
+ use Magento \TestFramework \Helper \Bootstrap ;
10
+
8
11
/**
9
12
* Test class for \Magento\Catalog\Model\Category.
10
13
* - tree knowledge is tested
@@ -23,9 +26,7 @@ class CategoryTreeTest extends \PHPUnit_Framework_TestCase
23
26
24
27
protected function setUp ()
25
28
{
26
- $ this ->_model = \Magento \TestFramework \Helper \Bootstrap::getObjectManager ()->create (
27
- 'Magento\Catalog\Model\Category '
28
- );
29
+ $ this ->_model = Bootstrap::getObjectManager ()->create (Category::class);
29
30
}
30
31
31
32
/**
@@ -125,7 +126,7 @@ public function testGetParentIds()
125
126
public function testGetChildren ()
126
127
{
127
128
$ this ->_model ->load (3 );
128
- $ this ->assertEquals (' 4,13 ' , $ this ->_model ->getChildren ());
129
+ $ this ->assertEquals ([], array_diff ([ 4 , 13 ], explode ( ' , ' , $ this ->_model ->getChildren ()) ));
129
130
}
130
131
131
132
public function testGetPathInStore ()
@@ -172,28 +173,28 @@ public function testGetParentCategories()
172
173
{
173
174
$ this ->_model ->load (5 );
174
175
$ parents = $ this ->_model ->getParentCategories ();
175
- $ this ->assertEquals (3 , count ( $ parents) );
176
+ $ this ->assertCount (3 , $ parents );
176
177
}
177
178
178
179
public function testGetParentCategoriesEmpty ()
179
180
{
180
181
$ this ->_model ->load (1 );
181
182
$ parents = $ this ->_model ->getParentCategories ();
182
- $ this ->assertEquals (0 , count ( $ parents) );
183
+ $ this ->assertCount (0 , $ parents );
183
184
}
184
185
185
186
public function testGetChildrenCategories ()
186
187
{
187
188
$ this ->_model ->load (3 );
188
189
$ children = $ this ->_model ->getChildrenCategories ();
189
- $ this ->assertEquals (2 , count ( $ children) );
190
+ $ this ->assertCount (2 , $ children );
190
191
}
191
192
192
193
public function testGetChildrenCategoriesEmpty ()
193
194
{
194
195
$ this ->_model ->load (5 );
195
196
$ children = $ this ->_model ->getChildrenCategories ();
196
- $ this ->assertEquals (0 , count ( $ children) );
197
+ $ this ->assertCount (0 , $ children );
197
198
}
198
199
199
200
public function testGetParentDesignCategory ()
0 commit comments