Skip to content

Commit

Permalink
Clean up ApplicationTest
Browse files Browse the repository at this point in the history
  • Loading branch information
Seldaek committed May 5, 2016
1 parent 827d52c commit cc793ef
Showing 1 changed file with 24 additions and 9 deletions.
33 changes: 24 additions & 9 deletions tests/Composer/Test/ApplicationTest.php
Expand Up @@ -25,15 +25,21 @@ public function testDevWarning()
$inputMock = $this->getMock('Symfony\Component\Console\Input\InputInterface');
$outputMock = $this->getMock('Symfony\Component\Console\Output\OutputInterface');

$inputMock->expects($this->any())
->method('hasParameterOption')
->with($this->equalTo('--no-plugins'))
->will($this->returnValue(true));
$index = 0;
$inputMock->expects($this->at($index++))
->method('getParameterOption')
->with($this->equalTo(array('--working-dir', '-d')))
->will($this->returnValue(false));

$inputMock->expects($this->any())
$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));

$index = 0;
$outputMock->expects($this->at($index++))
->method("writeError");
Expand All @@ -60,7 +66,6 @@ public function testDevWarning()
define('COMPOSER_DEV_WARNING_TIME', time() - 1);
}

$this->setExpectedException('RuntimeException');
$application->doRun($inputMock, $outputMock);
}

Expand All @@ -73,9 +78,20 @@ public function ensureNoDevWarning($command)
$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");
Expand All @@ -84,7 +100,6 @@ public function ensureNoDevWarning($command)
define('COMPOSER_DEV_WARNING_TIME', time() - 1);
}

$this->setExpectedException('RuntimeException');
$application->doRun($inputMock, $outputMock);
}

Expand Down

0 comments on commit cc793ef

Please sign in to comment.