private function addLineIfNotEmpty(TestsQueue &$testSuites, $line)
 {
     $line = trim($line);
     if (!empty($line)) {
         $testSuites->add($line);
     }
 }
 public static function execute($xmlFile)
 {
     $simpleObject = self::readFromXml($xmlFile);
     $arrayOfStrings = self::extractSuitesFromXmlObject($simpleObject);
     $testSuites = new TestsQueue();
     foreach ($arrayOfStrings as $string) {
         $testSuites->add($string);
     }
     return $testSuites;
 }
 /**
  * @test
  */
 public function shouldCreateAnArrayOfTestSuitesFromXML()
 {
     $output = CreateTestsQueueFromPhpUnitXML::execute(__DIR__ . '/Fixture/phpunit.xml.dist');
     $directory = __DIR__ . '/Infrastructure/';
     $files = array('InMemoryQueueFactoryTest.php', 'InMemoryQueueTest.php');
     $queue = new TestsQueue();
     foreach ($files as $file) {
         $queue->add($directory . $file);
     }
     $this->assertEquals($queue, $output);
 }
 public static function execute($xmlFile)
 {
     $configuration = \PHPUnit_Util_Configuration::getInstance($xmlFile);
     $testSuites = new TestsQueue();
     /** @var \PHPUnit_Framework_TestSuite $bla */
     foreach ($configuration->getTestSuiteConfiguration()->getIterator() as $testSuite) {
         $class = new \ReflectionClass($testSuite->getName());
         $testSuites->add($class->getFileName());
     }
     return $testSuites;
 }
 /**
  * @test
  */
 public function shouldPushIntoTheQueueTheXMLFile()
 {
     $directory = __DIR__ . '/Infrastructure/';
     $files = array('InMemoryQueueFactoryTest.php', 'InMemoryQueueTest.php');
     $assertion = new TestsQueue();
     foreach ($files as $file) {
         $assertion->add($directory . $file);
     }
     $queue = $this->createMock('\\Liuggio\\Fastest\\Queue\\QueueInterface');
     $queue->expects($this->once())->method('push')->with($assertion);
     $factory = $this->getMockBuilder('\\Liuggio\\Fastest\\Queue\\QueueFactoryInterface')->disableOriginalConstructor()->getMock();
     $factory->expects($this->once())->method('create')->willReturn($queue);
     $reader = new ReadFromInputAndPushIntoTheQueue($factory);
     $ret = $reader->execute(__DIR__ . '/Fixture/phpunit.xml.dist', true);
     $this->assertEquals($queue, $ret);
 }
 private function assertTestsQueueIsNotEmpty(TestsQueue $testsQueue)
 {
     if ($testsQueue->isEmpty()) {
         throw new \Exception('Empty input try piping some files.');
     }
 }