1414use GuzzleHttp \Psr7 \Response ;
1515use Hrphp \Cli \Command \PingCommand ;
1616use Symfony \Component \Console \Application ;
17+ use Symfony \Component \Console \Output \OutputInterface ;
1718use Symfony \Component \Console \Tester \CommandTester ;
1819
1920class PingCommandTest extends \PHPUnit_Framework_TestCase
@@ -34,6 +35,26 @@ public function testPing()
3435 self ::assertContains (sprintf ('%s is up! ' , HRPHP_URL ), $ output );
3536 }
3637
38+ public function testVerbosePing ()
39+ {
40+ $ commandTester = $ this ->getCommandTester (
41+ 'ping ' ,
42+ [ 'verbosity ' => OutputInterface::VERBOSITY_VERBOSE ]
43+ );
44+ $ output = $ commandTester ->getDisplay ();
45+ self ::assertContains ('Attempting to hit ' , $ output );
46+ }
47+
48+ public function testVeryVerbosePing ()
49+ {
50+ $ commandTester = $ this ->getCommandTester (
51+ 'ping ' ,
52+ [ 'verbosity ' => OutputInterface::VERBOSITY_VERY_VERBOSE ]
53+ );
54+ $ output = $ commandTester ->getDisplay ();
55+ self ::assertContains ('Ping being sent from ' , $ output );
56+ }
57+
3758 protected function setUp ()
3859 {
3960 $ command = new PingCommand ($ this ->getClient ());
@@ -58,13 +79,14 @@ protected function getClient()
5879
5980 /**
6081 * @param string $commandName
82+ * @param array $options
6183 * @return CommandTester
6284 */
63- protected function getCommandTester ($ commandName )
85+ protected function getCommandTester ($ commandName, array $ options = [] )
6486 {
6587 $ command = $ this ->getApplication ()->find ($ commandName );
6688 $ commandTester = new CommandTester ($ command );
67- $ commandTester ->execute (array_merge ( array ( 'command ' => $ commandName)) );
89+ $ commandTester ->execute ([ 'command ' => $ commandName], $ options );
6890 return $ commandTester ;
6991 }
7092
0 commit comments