1
0
Fork 0

Clean up ApplicationTest

pull/5294/head
Jordi Boggiano 2016-05-06 00:28:45 +01:00
parent 827d52cccf
commit cc793eff6f
1 changed files with 24 additions and 9 deletions

View File

@ -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;
$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')
->will($this->returnValue('list'));
$inputMock->expects($this->at($index++))
->method('hasParameterOption') ->method('hasParameterOption')
->with($this->equalTo('--no-plugins')) ->with($this->equalTo('--no-plugins'))
->will($this->returnValue(true)); ->will($this->returnValue(true));
$inputMock->expects($this->any())
->method('getFirstArgument')
->will($this->returnValue('list'));
$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);
} }