From c08c377d0c05040605efad755fb568dc33c882e9 Mon Sep 17 00:00:00 2001 From: Ondrej Machulda Date: Sat, 30 May 2015 23:52:32 +0200 Subject: [PATCH 1/4] Upgrade dependencies to symfony 2.7 --- CHANGELOG.md | 1 + composer.json | 8 ++++---- 2 files changed, 5 insertions(+), 4 deletions(-) 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..3c72c09b 100644 --- a/composer.json +++ b/composer.json @@ -19,10 +19,10 @@ "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", From f8199a093763cbd7f005b1cc6ca08a6c5f06e0a2 Mon Sep 17 00:00:00 2001 From: Ondrej Machulda Date: Sun, 31 May 2015 02:21:48 +0200 Subject: [PATCH 2/4] Added usage examples --- src/Console/Command/RunTestsCommand.php | 3 +++ 1 file changed, 3 insertions(+) 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)); } From 059811734c4396cc9c22e3e953dc5e2de533fd62 Mon Sep 17 00:00:00 2001 From: Ondrej Machulda Date: Sat, 30 May 2015 23:52:32 +0200 Subject: [PATCH 3/4] Update clue/graph to latest version --- composer.json | 3 ++- src-tests/Process/Fixtures/MockOrderStrategy.php | 4 +++- src-tests/Process/MaxTotalDelayStrategyTest.php | 2 +- src-tests/Process/ProcessSetTest.php | 3 ++- src/Process/MaxTotalDelayStrategy.php | 6 ++++-- src/Process/OptimizeOrderInterface.php | 2 +- src/Process/ProcessSet.php | 2 +- 7 files changed, 14 insertions(+), 8 deletions(-) diff --git a/composer.json b/composer.json index 3c72c09b..e4c852b6 100644 --- a/composer.json +++ b/composer.json @@ -26,7 +26,8 @@ "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/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..ae65781b 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; @@ -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/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; From 73888698fdac77c76811f7e98e460381cefdc355 Mon Sep 17 00:00:00 2001 From: Ondrej Machulda Date: Mon, 1 Jun 2015 00:54:45 +0200 Subject: [PATCH 4/4] Get class name using class keyword from PHP 5.5 --- src-tests/Component/AbstractComponentTest.php | 2 +- src-tests/Component/LegacyTest.php | 2 +- src-tests/Process/ProcessSetTest.php | 4 ++-- src-tests/Publisher/XmlPublisherTest.php | 10 +++++----- 4 files changed, 9 insertions(+), 9 deletions(-) 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/ProcessSetTest.php b/src-tests/Process/ProcessSetTest.php index ae65781b..06c1c08f 100644 --- a/src-tests/Process/ProcessSetTest.php +++ b/src-tests/Process/ProcessSetTest.php @@ -152,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); 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']);