1
0
Fork 0

Clean up ApplicationTest

pull/5297/head
Jordi Boggiano 2016-05-06 00:28:45 +01:00
parent 71cbd8f7e6
commit 1aa31caec5
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');
$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')
->with($this->equalTo('--no-plugins'))
->will($this->returnValue(true));
$inputMock->expects($this->any())
->method('getFirstArgument')
->will($this->returnValue('list'));
$index = 0;
$outputMock->expects($this->at($index++))
->method("writeError");
@ -60,7 +66,6 @@ class ApplicationTest extends TestCase
define('COMPOSER_DEV_WARNING_TIME', time() - 1);
}
$this->setExpectedException('RuntimeException');
$application->doRun($inputMock, $outputMock);
}
@ -73,9 +78,20 @@ class ApplicationTest extends TestCase
$inputMock = $this->getMock('Symfony\Component\Console\Input\InputInterface');
$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($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())
->method("writeln");
@ -84,7 +100,6 @@ class ApplicationTest extends TestCase
define('COMPOSER_DEV_WARNING_TIME', time() - 1);
}
$this->setExpectedException('RuntimeException');
$application->doRun($inputMock, $outputMock);
}