6
6
7
7
namespace Magento \CatalogWidget \Model \Rule \Condition ;
8
8
9
+ use Magento \Catalog \Api \Data \ProductInterface ;
10
+
9
11
class ProductTest extends \PHPUnit \Framework \TestCase
10
12
{
11
13
/**
@@ -18,6 +20,9 @@ class ProductTest extends \PHPUnit\Framework\TestCase
18
20
*/
19
21
protected $ objectManager ;
20
22
23
+ /**
24
+ * @inheritdoc
25
+ */
21
26
protected function setUp ()
22
27
{
23
28
$ this ->objectManager = \Magento \TestFramework \Helper \Bootstrap::getObjectManager ();
@@ -28,19 +33,26 @@ protected function setUp()
28
33
$ this ->conditionProduct ->setRule ($ rule );
29
34
}
30
35
36
+ /**
37
+ * @return void
38
+ */
31
39
public function testLoadAttributeOptions ()
32
40
{
33
41
$ this ->conditionProduct ->loadAttributeOptions ();
34
42
$ options = $ this ->conditionProduct ->getAttributeOption ();
35
- $ this ->assertArrayHasKey (' sku ' , $ options );
36
- $ this ->assertArrayHasKey (' attribute_set_id ' , $ options );
43
+ $ this ->assertArrayHasKey (ProductInterface:: SKU , $ options );
44
+ $ this ->assertArrayHasKey (ProductInterface:: ATTRIBUTE_SET_ID , $ options );
37
45
$ this ->assertArrayHasKey ('category_ids ' , $ options );
46
+ $ this ->assertArrayNotHasKey (ProductInterface::STATUS , $ options );
38
47
foreach ($ options as $ code => $ label ) {
39
48
$ this ->assertNotEmpty ($ label );
40
49
$ this ->assertNotEmpty ($ code );
41
50
}
42
51
}
43
52
53
+ /**
54
+ * @return void
55
+ */
44
56
public function testAddGlobalAttributeToCollection ()
45
57
{
46
58
$ collection = $ this ->objectManager ->create (\Magento \Catalog \Model \ResourceModel \Product \Collection::class);
@@ -53,6 +65,9 @@ public function testAddGlobalAttributeToCollection()
53
65
$ this ->assertEquals ('at_special_price.value ' , $ this ->conditionProduct ->getMappedSqlField ());
54
66
}
55
67
68
+ /**
69
+ * @return void
70
+ */
56
71
public function testAddNonGlobalAttributeToCollectionNoProducts ()
57
72
{
58
73
$ collection = $ this ->objectManager ->create (\Magento \Catalog \Model \ResourceModel \Product \Collection::class);
0 commit comments