Magento 2 Documentation  2.3
Documentation for Magento 2 CMS v2.3 (December 2018)
DevTestsRunCommandTest.php
Go to the documentation of this file.
1 <?php
7 // @codingStandardsIgnoreStart
8 
10  use Symfony\Component\Console\Tester\CommandTester;
11 
13 
22  function passthru($command, &$return_var = null)
23  {
26  }
27 
34  class DevTestsRunCommandTest extends \PHPUnit\Framework\TestCase
35  {
36 
40  private $command;
41 
42  protected function setUp()
43  {
44  $this->command = new DevTestsRunCommand();
45  }
46 
47  public function testExecuteBadType()
48  {
49  $commandTester = new CommandTester($this->command);
50  $commandTester->execute([DevTestsRunCommand::INPUT_ARG_TYPE => 'bad']);
51  $this->assertContains('Invalid type: "bad"', $commandTester->getDisplay());
52  }
53 
54  public function testPassArgumentsToPHPUnit()
55  {
57 
59 
60  $commandTester = new CommandTester($this->command);
61  $commandTester->execute(
62  [
65  ]
66  );
67  $this->assertContains(
68  'phpunit --list-suites',
69  $commandTester->getDisplay(),
70  'Parameters should be passed to PHPUnit'
71  );
72  $this->assertContains(
73  'PASSED (',
74  $commandTester->getDisplay(),
75  'PHPUnit runs should have passed'
76  );
77  }
78 
80  {
82 
84 
85  $commandTester = new CommandTester($this->command);
86  $commandTester->execute(
87  [
90  ]
91  );
92  $this->assertContains(
93  'phpunit --list-suites',
94  $commandTester->getDisplay(),
95  'Parameters should be passed to PHPUnit'
96  );
97  $this->assertContains(
98  'FAILED - ',
99  $commandTester->getDisplay(),
100  'PHPUnit runs should have passed'
101  );
102  }
103  }
104 }
passthru($command, &$return_var=null)