Magento 2 Documentation  2.3
Documentation for Magento 2 CMS v2.3 (December 2018)
CacheStatusCommandTest.php
Go to the documentation of this file.
1 <?php
8 
10 use Symfony\Component\Console\Tester\CommandTester;
11 
13 {
14  protected function setUp()
15  {
16  parent::setUp();
17  $this->command = new CacheStatusCommand($this->cacheManagerMock);
18  }
19 
20  public function testExecute()
21  {
22  $cacheTypes = ['A' => 0, 'B' => 1, 'C' => 1];
23  $this->cacheManagerMock->expects($this->once())->method('getStatus')->willReturn($cacheTypes);
24  $commandTester = new CommandTester($this->command);
25  $commandTester->execute([]);
26 
27  $this->assertEquals($this->getExpectedExecutionOutput($cacheTypes), $commandTester->getDisplay());
28  }
29 
33  public function getExpectedExecutionOutput(array $types)
34  {
35  $output = 'Current status:' . PHP_EOL;
36  foreach ($types as $type => $status) {
37  $output .= sprintf('%30s: %d', $type, $status) . PHP_EOL;
38  }
39  return $output;
40  }
41 }
$type
Definition: item.phtml:13
$status
Definition: order_status.php:8