Magento 2 Documentation  2.3
Documentation for Magento 2 CMS v2.3 (December 2018)
All Data Structures Namespaces Files Functions Variables Pages
QueryLogEnableCommandTest.php
Go to the documentation of this file.
1 <?php
8 
13 use Symfony\Component\Console\Tester\CommandTester;
14 
21 class QueryLogEnableCommandTest extends \PHPUnit\Framework\TestCase
22 {
26  private $configWriter;
27 
31  private $command;
32 
36  public function setUp()
37  {
38  $this->configWriter = $this->getMockBuilder(Writer::class)
39  ->disableOriginalConstructor()
40  ->getMock();
41  $this->command = new QueryLogEnableCommand($this->configWriter);
42  }
43 
47  public function testExecuteWithNoParams()
48  {
53 
54  $this->configWriter = $this->getMockBuilder(Writer::class)
55  ->disableOriginalConstructor()
56  ->getMock();
57  $this->configWriter
58  ->expects($this->any())
59  ->method('saveConfig')
61 
62  $commandTester = new CommandTester($this->command);
63  $commandTester->execute([]);
64  $this->assertSame(
66  $commandTester->getDisplay()
67  );
68  }
69 
73  public function testExecuteWithParams()
74  {
79 
80  $this->configWriter = $this->getMockBuilder(Writer::class)
81  ->disableOriginalConstructor()
82  ->getMock();
83  $this->configWriter
84  ->expects($this->any())
85  ->method('saveConfig')
87 
88  $commandTester = new CommandTester($this->command);
89  $commandTester->execute(
90  [
91  '--include-all-queries' => 'false',
92  '--include-call-stack' => 'false',
93  '--query-time-threshold' => '0.05',
94  ]
95  );
96  $this->assertSame(
98  $commandTester->getDisplay()
99  );
100  }
101 }