Magento 2 Documentation  2.3
Documentation for Magento 2 CMS v2.3 (December 2018)
ProfilerDisableCommandTest.php
Go to the documentation of this file.
1 <?php
8 
11 use PHPUnit\Framework\TestCase;
12 use Symfony\Component\Console\Tester\CommandTester;
13 
19 class ProfilerDisableCommandTest extends TestCase
20 {
24  private $filesystemMock;
25 
33  public function testCommand(bool $fileExists, string $expectedOutput)
34  {
35  $this->filesystemMock
36  ->expects($this->once())
37  ->method('rm')
39  $this->filesystemMock
40  ->expects($this->once())
41  ->method('fileExists')
43  ->willReturn($fileExists);
45  $command = new ProfilerDisableCommand($this->filesystemMock);
46  $commandTester = new CommandTester($command);
47  $commandTester->execute([]);
48 
49  self::assertEquals(
50  $expectedOutput,
51  trim(str_replace(PHP_EOL, ' ', $commandTester->getDisplay()))
52  );
53  }
54 
60  public function commandDataProvider()
61  {
62  return [
63  [true, 'Something went wrong while disabling the profiler.'],
64  [false, 'Profiler disabled.'],
65  ];
66  }
67 
71  protected function setUp()
72  {
73  $this->filesystemMock = $this->getMockBuilder(File::class)
74  ->disableOriginalConstructor()
75  ->getMock();
76  }
77 }
const BP
Definition: autoload.php:14