Pārlūkot izejas kodu

Clean up ApplicationTest

Jordi Boggiano 8 gadi atpakaļ
vecāks
revīzija
1aa31caec5
1 mainītis faili ar 24 papildinājumiem un 9 dzēšanām
  1. 24 9
      tests/Composer/Test/ApplicationTest.php

+ 24 - 9
tests/Composer/Test/ApplicationTest.php

@@ -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())
-            ->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')
             ->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);
     }
     }