@@ -41,16 +41,26 @@ class IndexerShowDimensionsModeCommandTest extends AbstractIndexerCommandCommonS
41
41
*/
42
42
private $ indexerMock ;
43
43
44
+ /**
45
+ * @var string[]
46
+ */
47
+ private $ optionalIndexers ;
48
+
49
+ /**
50
+ * @var ObjectManagerHelper
51
+ */
52
+ private $ objectManagerHelper ;
53
+
44
54
/**
45
55
* @inheritdoc
46
56
*/
47
57
protected function setUp (): void
48
58
{
49
59
parent ::setUp ();
50
- $ objectManagerHelper = new ObjectManagerHelper ($ this );
60
+ $ this -> objectManagerHelper = new ObjectManagerHelper ($ this );
51
61
$ this ->configReaderMock = $ this ->getMockForAbstractClass (ScopeConfigInterface::class);
52
62
$ this ->indexers = ['indexer_1 ' => 'indexer_1 ' , 'indexer_2 ' => 'indexer_2 ' ];
53
- $ this ->command = $ objectManagerHelper ->getObject (
63
+ $ this ->command = $ this -> objectManagerHelper ->getObject (
54
64
IndexerShowDimensionsModeCommand::class,
55
65
[
56
66
'objectManagerFactory ' => $ this ->objectManagerFactory ,
@@ -98,6 +108,29 @@ public function testExecuteWithAttributes($command, $consoleOutput)
98
108
);
99
109
}
100
110
111
+ public function testExecuteWithOptionalIndexers ()
112
+ {
113
+ $ this ->optionalIndexers = ['indexer_3 ' ];
114
+ $ this ->indexers = ['indexer_3 ' => 'indexer_3 ' ];
115
+ $ this ->command = $ this ->objectManagerHelper ->getObject (
116
+ IndexerShowDimensionsModeCommand::class,
117
+ [
118
+ 'objectManagerFactory ' => $ this ->objectManagerFactory ,
119
+ 'configReader ' => $ this ->configReaderMock ,
120
+ 'indexers ' => $ this ->indexers ,
121
+ 'optionalIndexers ' => $ this ->optionalIndexers
122
+ ]
123
+ );
124
+ $ command = ['indexer ' => ['indexer_3 ' ]];
125
+ $ this ->configureAdminArea ();
126
+ /** @var CommandTester $commandTester */
127
+ $ commandTester = new CommandTester ($ this ->command );
128
+ $ this ->indexerMock ->method ('load ' )->willThrowException (new \InvalidArgumentException ());
129
+ $ commandTester ->execute ($ command );
130
+ $ actualValue = $ commandTester ->getDisplay ();
131
+ $ this ->assertEquals ('' , $ actualValue );
132
+ }
133
+
101
134
/**
102
135
* @return array
103
136
*/
0 commit comments