10
10
use Magento \Framework \Indexer \IndexerInterface ;
11
11
use PHPUnit \Framework \TestCase ;
12
12
use Magento \Framework \Indexer \IndexerRegistry ;
13
- use Magento \PageCache \Model \Config ;
14
- use Magento \Framework \App \Cache \TypeListInterface ;
15
13
16
14
class FullTest extends TestCase
17
15
{
@@ -25,16 +23,6 @@ class FullTest extends TestCase
25
23
*/
26
24
private $ indexerRegistryMock ;
27
25
28
- /**
29
- * @var Config|\PHPUnit_Framework_MockObject_MockObject
30
- */
31
- private $ configMock ;
32
-
33
- /**
34
- * @var TypeListInterface|\PHPUnit_Framework_MockObject_MockObject
35
- */
36
- private $ typeListMock ;
37
-
38
26
/**
39
27
* @var Full
40
28
*/
@@ -44,15 +32,11 @@ public function setUp()
44
32
{
45
33
$ this ->objectManager = new \Magento \Framework \TestFramework \Unit \Helper \ObjectManager ($ this );
46
34
$ this ->indexerRegistryMock = $ this ->createMock (IndexerRegistry::class);
47
- $ this ->configMock = $ this ->createMock (Config::class);
48
- $ this ->typeListMock = $ this ->getMockForAbstractClass (TypeListInterface::class, [], "" , false );
49
35
50
36
$ this ->full = $ this ->objectManager ->getObject (
51
37
Full::class,
52
38
[
53
39
'indexerRegistry ' => $ this ->indexerRegistryMock ,
54
- 'pageCacheConfig ' => $ this ->configMock ,
55
- 'cacheTypeList ' => $ this ->typeListMock ,
56
40
'indexerList ' => ['catalog_indexer ' , 'product_indexer ' , 'stock_indexer ' , 'search_indexer ' ]
57
41
]
58
42
);
@@ -64,20 +48,6 @@ public function testExecuteFull()
64
48
$ indexerMock ->expects ($ this ->exactly (4 ))->method ('isScheduled ' )->willReturn (false );
65
49
$ indexerMock ->expects ($ this ->exactly (4 ))->method ('reindexAll ' );
66
50
$ this ->indexerRegistryMock ->expects ($ this ->exactly (4 ))->method ('get ' )->willReturn ($ indexerMock );
67
- $ this ->configMock ->expects ($ this ->once ())->method ('isEnabled ' )->willReturn (true );
68
- $ this ->typeListMock ->expects ($ this ->once ())->method ('invalidate ' )->with ('full_page ' );
69
-
70
- $ this ->full ->executeFull ();
71
- }
72
-
73
- public function testExecuteFullPageCacheDisabled ()
74
- {
75
- $ indexerMock = $ this ->getMockForAbstractClass (IndexerInterface::class, [], "" , false );
76
- $ indexerMock ->expects ($ this ->exactly (4 ))->method ('isScheduled ' )->willReturn (false );
77
- $ indexerMock ->expects ($ this ->exactly (4 ))->method ('reindexAll ' );
78
- $ this ->indexerRegistryMock ->expects ($ this ->exactly (4 ))->method ('get ' )->willReturn ($ indexerMock );
79
- $ this ->configMock ->expects ($ this ->once ())->method ('isEnabled ' )->willReturn (false );
80
- $ this ->typeListMock ->expects ($ this ->never ())->method ('invalidate ' );
81
51
82
52
$ this ->full ->executeFull ();
83
53
}
@@ -88,20 +58,6 @@ public function testExecuteList()
88
58
$ indexerMock ->expects ($ this ->exactly (4 ))->method ('isScheduled ' )->willReturn (false );
89
59
$ indexerMock ->expects ($ this ->exactly (4 ))->method ('reindexList ' )->with ([1 , 2 ]);
90
60
$ this ->indexerRegistryMock ->expects ($ this ->exactly (4 ))->method ('get ' )->willReturn ($ indexerMock );
91
- $ this ->configMock ->expects ($ this ->once ())->method ('isEnabled ' )->willReturn (true );
92
- $ this ->typeListMock ->expects ($ this ->once ())->method ('invalidate ' )->with ('full_page ' );
93
-
94
- $ this ->full ->executeList ([1 , 2 ]);
95
- }
96
-
97
- public function testExecuteListPageCacheDisabled ()
98
- {
99
- $ indexerMock = $ this ->getMockForAbstractClass (IndexerInterface::class, [], "" , false );
100
- $ indexerMock ->expects ($ this ->exactly (4 ))->method ('isScheduled ' )->willReturn (false );
101
- $ indexerMock ->expects ($ this ->exactly (4 ))->method ('reindexList ' )->with ([1 , 2 ]);
102
- $ this ->indexerRegistryMock ->expects ($ this ->exactly (4 ))->method ('get ' )->willReturn ($ indexerMock );
103
- $ this ->configMock ->expects ($ this ->once ())->method ('isEnabled ' )->willReturn (false );
104
- $ this ->typeListMock ->expects ($ this ->never ())->method ('invalidate ' );
105
61
106
62
$ this ->full ->executeList ([1 , 2 ]);
107
63
}
@@ -112,20 +68,6 @@ public function testExecuteRow()
112
68
$ indexerMock ->expects ($ this ->exactly (4 ))->method ('isScheduled ' )->willReturn (false );
113
69
$ indexerMock ->expects ($ this ->exactly (4 ))->method ('reindexRow ' )->with (1 );
114
70
$ this ->indexerRegistryMock ->expects ($ this ->exactly (4 ))->method ('get ' )->willReturn ($ indexerMock );
115
- $ this ->configMock ->expects ($ this ->once ())->method ('isEnabled ' )->willReturn (true );
116
- $ this ->typeListMock ->expects ($ this ->once ())->method ('invalidate ' )->with ('full_page ' );
117
-
118
- $ this ->full ->executeRow (1 );
119
- }
120
-
121
- public function testExecuteRowPageCacheDisabled ()
122
- {
123
- $ indexerMock = $ this ->getMockForAbstractClass (IndexerInterface::class, [], "" , false );
124
- $ indexerMock ->expects ($ this ->exactly (4 ))->method ('isScheduled ' )->willReturn (false );
125
- $ indexerMock ->expects ($ this ->exactly (4 ))->method ('reindexRow ' )->with (1 );
126
- $ this ->indexerRegistryMock ->expects ($ this ->exactly (4 ))->method ('get ' )->willReturn ($ indexerMock );
127
- $ this ->configMock ->expects ($ this ->once ())->method ('isEnabled ' )->willReturn (false );
128
- $ this ->typeListMock ->expects ($ this ->never ())->method ('invalidate ' );
129
71
130
72
$ this ->full ->executeRow (1 );
131
73
}
0 commit comments