Clean up ApplicationTest

main
Jordi Boggiano 8 years ago
parent 827d52cccf
commit cc793eff6f

@ -25,15 +25,21 @@ class ApplicationTest extends TestCase
$inputMock = $this->getMock('Symfony\Component\Console\Input\InputInterface'); $inputMock = $this->getMock('Symfony\Component\Console\Input\InputInterface');
$outputMock = $this->getMock('Symfony\Component\Console\Output\OutputInterface'); $outputMock = $this->getMock('Symfony\Component\Console\Output\OutputInterface');
$inputMock->expects($this->any()) $index = 0;
->method('hasParameterOption') $inputMock->expects($this->at($index++))
->with($this->equalTo('--no-plugins')) ->method('getParameterOption')
->will($this->returnValue(true)); ->with($this->equalTo(array('--working-dir', '-d')))
->will($this->returnValue(false));
$inputMock->expects($this->any()) $inputMock->expects($this->at($index++))
->method('getFirstArgument') ->method('getFirstArgument')
->will($this->returnValue('list')); ->will($this->returnValue('list'));
$inputMock->expects($this->at($index++))
->method('hasParameterOption')
->with($this->equalTo('--no-plugins'))
->will($this->returnValue(true));
$index = 0; $index = 0;
$outputMock->expects($this->at($index++)) $outputMock->expects($this->at($index++))
->method("writeError"); ->method("writeError");
@ -60,7 +66,6 @@ class ApplicationTest extends TestCase
define('COMPOSER_DEV_WARNING_TIME', time() - 1); define('COMPOSER_DEV_WARNING_TIME', time() - 1);
} }
$this->setExpectedException('RuntimeException');
$application->doRun($inputMock, $outputMock); $application->doRun($inputMock, $outputMock);
} }
@ -73,9 +78,20 @@ class ApplicationTest extends TestCase
$inputMock = $this->getMock('Symfony\Component\Console\Input\InputInterface'); $inputMock = $this->getMock('Symfony\Component\Console\Input\InputInterface');
$outputMock = $this->getMock('Symfony\Component\Console\Output\OutputInterface'); $outputMock = $this->getMock('Symfony\Component\Console\Output\OutputInterface');
$inputMock->expects($this->any()) $index = 0;
$inputMock->expects($this->at($index++))
->method('getParameterOption')
->with($this->equalTo(array('--working-dir', '-d')))
->will($this->returnValue(false));
$inputMock->expects($this->at($index++))
->method('getFirstArgument') ->method('getFirstArgument')
->will($this->returnValue($command)); ->will($this->returnValue('list'));
$inputMock->expects($this->at($index++))
->method('hasParameterOption')
->with($this->equalTo('--no-plugins'))
->will($this->returnValue(true));
$outputMock->expects($this->never()) $outputMock->expects($this->never())
->method("writeln"); ->method("writeln");
@ -84,7 +100,6 @@ class ApplicationTest extends TestCase
define('COMPOSER_DEV_WARNING_TIME', time() - 1); define('COMPOSER_DEV_WARNING_TIME', time() - 1);
} }
$this->setExpectedException('RuntimeException');
$application->doRun($inputMock, $outputMock); $application->doRun($inputMock, $outputMock);
} }

Loading…
Cancel
Save