diff --git a/CHANGELOG.md b/CHANGELOG.md index 286a560a..cbf43348 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -9,6 +9,7 @@ ### Changed - The `logs/results.xml` could now be also accessed locally (the XSLT is now embedded right into the file, so we don't encounter same-origin policy problems). - Use tagged version 0.6.0 of [php-webdriver](https://github.com/facebook/php-webdriver). +- Upgraded to Symfony 2.7 (causing eg. the `--help` format to change a bit - according to [docopt](http://docopt.org/) standard) ### Fixed - Properly trigger PHPUnit colored (ANSI) mode when Steward itself is in ANSI mode. diff --git a/composer.json b/composer.json index ad513c47..e4c852b6 100644 --- a/composer.json +++ b/composer.json @@ -19,14 +19,15 @@ "phpunit/phpunit": "4.6.*", "ext-zip": "*", "ext-curl": "*", - "symfony/console": "~2.6", - "symfony/process": "~2.6", - "symfony/finder": "~2.6", - "symfony/event-dispatcher": "~2.6", + "symfony/console": "~2.7", + "symfony/process": "~2.7", + "symfony/finder": "~2.7", + "symfony/event-dispatcher": "~2.7", "nette/reflection": "~2.2", "nette/utils": "~2.2", "facebook/webdriver": "~0.6.0", - "clue/graph": "~0.7.1", + "clue/graph": "~0.9.0", + "graphp/algorithms": "^0.8.1", "florianwolters/component-util-singleton": "0.3.2", "caseyamcl/configula": "~2.3", "doctrine/inflector": "~1.0" diff --git a/src-tests/Component/AbstractComponentTest.php b/src-tests/Component/AbstractComponentTest.php index 58a4bca4..559fe91e 100644 --- a/src-tests/Component/AbstractComponentTest.php +++ b/src-tests/Component/AbstractComponentTest.php @@ -16,7 +16,7 @@ class AbstractComponentTest extends \PHPUnit_Framework_TestCase protected function setUp() { - $this->testCase = $this->getMockBuilder('Lmc\Steward\Test\AbstractTestCase') + $this->testCase = $this->getMockBuilder(AbstractTestCase::class) ->setMethods(null) ->getMock(); diff --git a/src-tests/Component/LegacyTest.php b/src-tests/Component/LegacyTest.php index 67c0cc8d..ba5ae48e 100644 --- a/src-tests/Component/LegacyTest.php +++ b/src-tests/Component/LegacyTest.php @@ -17,7 +17,7 @@ class LegacyTest extends \PHPUnit_Framework_TestCase public function setUp() { - $this->testCase = $this->getMockBuilder('Lmc\Steward\Test\AbstractTestCase') + $this->testCase = $this->getMockBuilder(AbstractTestCase::class) ->setMethods(['getName']) ->getMock(); diff --git a/src-tests/Process/Fixtures/MockOrderStrategy.php b/src-tests/Process/Fixtures/MockOrderStrategy.php index 14381ef9..ec0c881c 100644 --- a/src-tests/Process/Fixtures/MockOrderStrategy.php +++ b/src-tests/Process/Fixtures/MockOrderStrategy.php @@ -2,7 +2,8 @@ namespace Lmc\Steward\Process\Fixtures; -use Fhaculty\Graph\Algorithm\Tree\OutTree; +use Fhaculty\Graph\Vertex; +use Graphp\Algorithms\Tree\OutTree; use Lmc\Steward\Process\OptimizeOrderInterface; class MockOrderStrategy implements OptimizeOrderInterface @@ -19,6 +20,7 @@ public function optimize(OutTree $tree) $i = 0; $output = []; + /** @var Vertex $vertex */ foreach ($vertices as $vertex) { $output[$vertex->getId()] = $i++; } diff --git a/src-tests/Process/MaxTotalDelayStrategyTest.php b/src-tests/Process/MaxTotalDelayStrategyTest.php index 0a6efe3e..74c0b0bd 100644 --- a/src-tests/Process/MaxTotalDelayStrategyTest.php +++ b/src-tests/Process/MaxTotalDelayStrategyTest.php @@ -2,7 +2,7 @@ namespace Lmc\Steward\Process; -use Fhaculty\Graph\Algorithm\Tree\OutTree; +use Graphp\Algorithms\Tree\OutTree; use Fhaculty\Graph\Graph; class MaxTotalDelayStrategyTest extends \PHPUnit_Framework_TestCase diff --git a/src-tests/Process/ProcessSetTest.php b/src-tests/Process/ProcessSetTest.php index 58497caa..06c1c08f 100644 --- a/src-tests/Process/ProcessSetTest.php +++ b/src-tests/Process/ProcessSetTest.php @@ -2,6 +2,7 @@ namespace Lmc\Steward\Process; +use Graphp\Algorithms\Tree\OutTree; use Lmc\Steward\Process\Fixtures\MockOrderStrategy; use Lmc\Steward\Publisher\XmlPublisher; use Symfony\Component\Console\Output\BufferedOutput; @@ -151,9 +152,9 @@ public function testShouldAddAndGetProcess() $this->assertArrayHasKey('Baz', $processes); $process = $processes['Baz']; - $this->assertInstanceOf('stdClass', $process); + $this->assertInstanceOf(\stdClass::class, $process); $this->assertEquals(ProcessSet::PROCESS_STATUS_QUEUED, $process->status); - $this->assertInstanceOf('Symfony\Component\Process\Process', $process->process); + $this->assertInstanceOf(Process::class, $process->process); $this->assertEquals('Foo', $process->delayAfter); $this->assertEquals(5, $process->delayMinutes); $this->assertNull($process->finishedTime); @@ -294,7 +295,7 @@ public function testShouldBuildGraphTreeFromProcessDependencies() $tree = $this->set->buildTree(); - $this->assertInstanceOf('Fhaculty\Graph\Algorithm\Tree\OutTree', $tree); + $this->assertInstanceOf(OutTree::class, $tree); $this->assertEquals(2, $tree->getHeight()); // 2, because single vertex graph has height 0 $root = $tree->getVertexRoot(); diff --git a/src-tests/Publisher/XmlPublisherTest.php b/src-tests/Publisher/XmlPublisherTest.php index df33d5d1..87eb7006 100644 --- a/src-tests/Publisher/XmlPublisherTest.php +++ b/src-tests/Publisher/XmlPublisherTest.php @@ -98,10 +98,10 @@ public function testShouldAddTestResultToEmptyFile() $fullXml = simplexml_load_file($fileName); $xml = $fullXml[0]; - $this->assertInstanceOf('\SimpleXMLElement', $xml->testcase); + $this->assertInstanceOf(\SimpleXMLElement::class, $xml->testcase); $this->assertEquals('testCaseNameFoo', $xml->testcase['name']); - $this->assertInstanceOf('\SimpleXMLElement', $xml->testcase->test); + $this->assertInstanceOf(\SimpleXMLElement::class, $xml->testcase->test); $this->assertEquals(1, count($xml->testcase->test)); $this->assertEquals('testNameBar', $xml->testcase->test['name']); @@ -135,7 +135,7 @@ public function testShouldUpdateTestStatusWhenTestIsDone($params) $xml = simplexml_load_file($fileName)[0]; // still only one test result is present - $this->assertInstanceOf('\SimpleXMLElement', $xml->testcase->test); + $this->assertInstanceOf(\SimpleXMLElement::class, $xml->testcase->test); $this->assertEquals(1, count($xml->testcase->test)); // the status is now updated and result is set @@ -159,7 +159,7 @@ public function testShouldAddTestcaseResultToEmptyFile() /** @var \SimpleXMLElement $xml */ $xml = simplexml_load_file($fileName)[0]; - $this->assertInstanceOf('\SimpleXMLElement', $xml->testcase); + $this->assertInstanceOf(\SimpleXMLElement::class, $xml->testcase); $this->assertEquals('testCaseNameFoo', $xml->testcase['name']); $this->assertEquals('queued', $xml->testcase['status']); $this->assertEmpty($xml->testcase->test['result']); @@ -189,7 +189,7 @@ public function testShouldUpdateTestcaseStatusWhenDone($params) /** @var \SimpleXMLElement $xml */ $xml = simplexml_load_file($fileName)[0]; - $this->assertInstanceOf('\SimpleXMLElement', $xml->testcase); + $this->assertInstanceOf(\SimpleXMLElement::class, $xml->testcase); $this->assertEquals('testCaseNameFoo', $xml->testcase['name']); $this->assertEquals('done', $xml->testcase['status']); $this->assertEquals('passed', $xml->testcase['result']); diff --git a/src/Console/Command/RunTestsCommand.php b/src/Console/Command/RunTestsCommand.php index 4c871a79..9c479d8e 100644 --- a/src/Console/Command/RunTestsCommand.php +++ b/src/Console/Command/RunTestsCommand.php @@ -134,6 +134,9 @@ protected function configure() 'Publish test results to test storage' ); + $this->addUsage('staging firefox'); + $this->addUsage('--group=foo --group=bar --exclude-group=baz -vvv development phantomjs'); + $this->getDispatcher()->dispatch(CommandEvents::CONFIGURE, new BasicConsoleEvent($this)); } diff --git a/src/Process/MaxTotalDelayStrategy.php b/src/Process/MaxTotalDelayStrategy.php index 94bf9ab6..aec4c8a7 100644 --- a/src/Process/MaxTotalDelayStrategy.php +++ b/src/Process/MaxTotalDelayStrategy.php @@ -2,8 +2,9 @@ namespace Lmc\Steward\Process; -use Fhaculty\Graph\Algorithm\ShortestPath\Dijkstra; -use Fhaculty\Graph\Algorithm\Tree\OutTree; +use Graphp\Algorithms\ShortestPath\Dijkstra; +use Graphp\Algorithms\Tree\OutTree; +use Fhaculty\Graph\Vertex; class MaxTotalDelayStrategy implements OptimizeOrderInterface { @@ -24,6 +25,7 @@ public function optimize(OutTree $tree) // for each vertex (process) get maximum total weight of its subtree (longest distance) $subTreeMaxDistances = []; + /** @var Vertex $childVertex */ foreach ($children as $childVertex) { $alg = new Dijkstra($childVertex); // get map with distances to all linked reachable vertexes diff --git a/src/Process/OptimizeOrderInterface.php b/src/Process/OptimizeOrderInterface.php index a5dcccc8..eb491275 100644 --- a/src/Process/OptimizeOrderInterface.php +++ b/src/Process/OptimizeOrderInterface.php @@ -2,7 +2,7 @@ namespace Lmc\Steward\Process; -use Fhaculty\Graph\Algorithm\Tree\OutTree; +use Graphp\Algorithms\Tree\OutTree; /** * Interface for optimizers of tests order. diff --git a/src/Process/ProcessSet.php b/src/Process/ProcessSet.php index 078b6c59..1454db3f 100644 --- a/src/Process/ProcessSet.php +++ b/src/Process/ProcessSet.php @@ -2,7 +2,7 @@ namespace Lmc\Steward\Process; -use Fhaculty\Graph\Algorithm\Tree\OutTree; +use Graphp\Algorithms\Tree\OutTree; use Fhaculty\Graph\Graph; use Lmc\Steward\Publisher\AbstractPublisher; use Symfony\Component\Console\Output\OutputInterface;