Magento 2 Documentation  2.3
Documentation for Magento 2 CMS v2.3 (December 2018)
AbstractCacheManageCommandTest.php
Go to the documentation of this file.
1 <?php
8 
9 use Symfony\Component\Console\Tester\CommandTester;
10 
12 {
14  protected $cacheEventName;
15 
17  protected $eventManagerMock;
18 
19  protected function setUp()
20  {
21  $this->eventManagerMock = $this->getMockBuilder(\Magento\Framework\Event\ManagerInterface::class)
22  ->disableOriginalConstructor()
23  ->getMock();
24  parent::setUp();
25  }
26 
30  public function executeDataProvider()
31  {
32  return [
33  'implicit all' => [
34  [],
35  ['A', 'B', 'C'],
36  $this->getExpectedExecutionOutput(['A', 'B', 'C']),
37  ],
38  'specified types' => [
39  ['types' => ['A', 'B']],
40  ['A', 'B'],
41  $this->getExpectedExecutionOutput(['A', 'B']),
42  ],
43  ];
44  }
45 
50  public function testExecuteInvalidCacheType()
51  {
52  $this->cacheManagerMock->expects($this->once())->method('getAvailableTypes')->willReturn(['A', 'B', 'C']);
53  $param = ['types' => ['A', 'D']];
54  $commandTester = new CommandTester($this->command);
55  $commandTester->execute($param);
56  }
57 }