5
5
*/
6
6
namespace Magento \CatalogInventory \Model \Indexer \Stock \Action ;
7
7
8
- use Magento \TestFramework \Helper \Bootstrap ;
9
- use Magento \Framework \ObjectManagerInterface ;
10
- use Magento \CatalogInventory \Model \Indexer \Stock \Processor ;
11
- use Magento \Catalog \Model \CategoryFactory ;
12
- use Magento \Catalog \Block \Product \ListProduct ;
13
- use Magento \Catalog \Model \ResourceModel \Product \CollectionFactory ;
14
- use Magento \Catalog \Model \Product ;
15
- use PHPUnit \Framework \TestCase ;
16
-
17
8
/**
18
9
* Full reindex Test
19
10
*/
20
- class FullTest extends TestCase
11
+ class FullTest extends \ PHPUnit \ Framework \ TestCase
21
12
{
22
13
/**
23
- * @var ObjectManagerInterface
24
- */
25
- private $ objectManager ;
26
-
27
- /**
28
- * @var Processor
14
+ * @var \Magento\CatalogInventory\Model\Indexer\Stock\Processor
29
15
*/
30
16
protected $ _processor ;
31
17
32
- /**
33
- * @inheritdoc
34
- */
35
18
protected function setUp ()
36
19
{
37
- $ this ->objectManager = Bootstrap::getObjectManager ();
38
- $ this ->_processor = $ this ->objectManager ->get (Processor::class);
20
+ $ this ->_processor = \Magento \TestFramework \Helper \Bootstrap::getObjectManager ()->get (
21
+ \Magento \CatalogInventory \Model \Indexer \Stock \Processor::class
22
+ );
39
23
}
40
24
41
25
/**
42
- * Reindex all
43
- *
44
26
* @magentoDbIsolation disabled
45
27
* @magentoAppIsolation enabled
46
28
* @magentoDataFixture Magento/Catalog/_files/product_simple.php
@@ -49,9 +31,13 @@ public function testReindexAll()
49
31
{
50
32
$ this ->_processor ->reindexAll ();
51
33
52
- $ categoryFactory = $ this ->objectManager ->get (CategoryFactory::class);
53
- /** @var ListProduct $listProduct */
54
- $ listProduct = $ this ->objectManager ->get (ListProduct::class);
34
+ $ categoryFactory = \Magento \TestFramework \Helper \Bootstrap::getObjectManager ()->get (
35
+ \Magento \Catalog \Model \CategoryFactory::class
36
+ );
37
+ /** @var \Magento\Catalog\Block\Product\ListProduct $listProduct */
38
+ $ listProduct = \Magento \TestFramework \Helper \Bootstrap::getObjectManager ()->get (
39
+ \Magento \Catalog \Block \Product \ListProduct::class
40
+ );
55
41
56
42
$ category = $ categoryFactory ->create ()->load (2 );
57
43
$ layer = $ listProduct ->getLayer ();
@@ -75,37 +61,4 @@ public function testReindexAll()
75
61
$ this ->assertEquals (100 , $ product ->getQty ());
76
62
}
77
63
}
78
-
79
- /**
80
- * Reindex with disabled product
81
- *
82
- * @return void
83
- * @magentoDbIsolation disabled
84
- * @magentoAppIsolation enabled
85
- * @magentoDataFixture Magento/Catalog/_files/products_with_layered_navigation_attribute.php
86
- */
87
- public function testReindexAllWithDisabledProduct ()
88
- {
89
- $ productCollectionFactory = $ this ->objectManager ->get (CollectionFactory::class);
90
- $ productCollection = $ productCollectionFactory
91
- ->create ()
92
- ->addAttributeToSelect ('* ' )
93
- ->addAttributeToFilter ('sku ' , ['eq ' => 'simple3 ' ])
94
- ->addAttributeToSort ('created_at ' , 'DESC ' )
95
- ->joinField (
96
- 'stock_status ' ,
97
- 'cataloginventory_stock_status ' ,
98
- 'stock_status ' ,
99
- 'product_id=entity_id ' ,
100
- '{{table}}.stock_id=1 ' ,
101
- 'left '
102
- )->load ();
103
-
104
- $ this ->assertCount (1 , $ productCollection );
105
-
106
- /** @var Product $product */
107
- foreach ($ productCollection as $ product ) {
108
- $ this ->assertEquals (1 , $ product ->getData ('stock_status ' ));
109
- }
110
- }
111
64
}
0 commit comments