diff options
author | Thomas Steur <thomas.steur@googlemail.com> | 2014-10-10 05:52:48 +0400 |
---|---|---|
committer | Thomas Steur <thomas.steur@googlemail.com> | 2014-10-10 05:52:48 +0400 |
commit | afb3df190454fb98db0467be916b724398891b43 (patch) | |
tree | 3eeb591fe4362a83301987201cf1b0394fe414e0 | |
parent | d1f27664efcb16665afddd103435abd3897ba716 (diff) |
we will deprecate old test classes in 4 months and not in 2, simplified test run by only allowing short version, added some examples
-rw-r--r-- | CHANGELOG.md | 8 | ||||
-rw-r--r-- | plugins/CoreConsole/Commands/TestsRun.php | 22 | ||||
-rw-r--r-- | tests/PHPUnit/Unit/DeprecatedMethodsTest.php | 2 | ||||
-rw-r--r-- | tests/PHPUnit/phpunit.xml.dist | 2 | ||||
-rw-r--r-- | tests/README.md | 23 |
5 files changed, 30 insertions, 27 deletions
diff --git a/CHANGELOG.md b/CHANGELOG.md index 172c780bfe..1f1561a585 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -18,10 +18,10 @@ This is a changelog for Piwik platform developers. All changes for our HTTP API' ### Deprecations * The `Piwik::setUserHasSuperUserAccess` method is deprecated, instead use Access::doAsSuperUser. This method will ensure that super user access is properly rescinded after the callback finishes. -* The class is `\IntegrationTestCase` deprecated and will be removed from December 6th 2014. Use `\Piwik\Tests\Impl\SystemTestCase` instead. -* The class is `\DatabaseTestCase` deprecated and will be removed from December 6th 2014. Use `\Piwik\Tests\Impl\IntegrationTestCase` instead. -* The class is `\Piwik\Tests\Fixture` deprecated and will be removed from December 6th 2014. Use `\Piwik\Tests\Impl\Fixture` instead. -* The class is `\Piwik\Tests\OverrideLogin` deprecated and will be removed from December 6ths 2014. Use `\Piwik\Tests\Impl\OverrideLogin` instead. +* The class is `\IntegrationTestCase` deprecated and will be removed from February 6th 2015. Use `\Piwik\Tests\Impl\SystemTestCase` instead. +* The class is `\DatabaseTestCase` deprecated and will be removed from February 6th 2015. Use `\Piwik\Tests\Impl\IntegrationTestCase` instead. +* The class is `\Piwik\Tests\Fixture` deprecated and will be removed from February 6th 2015. Use `\Piwik\Tests\Impl\Fixture` instead. +* The class is `\Piwik\Tests\OverrideLogin` deprecated and will be removed from February 6ths 2015. Use `\Piwik\Tests\Impl\OverrideLogin` instead. ### New API Features * The pivotBy and related query parameters can be used to pivot reports by another dimension. Read more about the new query parameters [here](http://developer.piwik.org/api-reference/reporting-api#optional-api-parameters). diff --git a/plugins/CoreConsole/Commands/TestsRun.php b/plugins/CoreConsole/Commands/TestsRun.php index 2a5575d6ef..cf2d49b6a1 100644 --- a/plugins/CoreConsole/Commands/TestsRun.php +++ b/plugins/CoreConsole/Commands/TestsRun.php @@ -104,9 +104,8 @@ class TestsRun extends ConsoleCommand { if (empty($suite) && empty($groups)) { foreach ($this->getTestsSuites() as $suite) { - if (Common::stringEndsWith($suite, 'Tests')) { - $this->executeTestGroups($suite, $groups, $options, $command, $output); - } + $suite = $this->buildTestSuiteName($suite); + $this->executeTestGroups($suite, $groups, $options, $command, $output); } return; @@ -121,7 +120,7 @@ class TestsRun extends ConsoleCommand private function getTestsSuites() { - return array('unit', 'UnitTests', 'integration', 'IntegrationTests', 'system', 'SystemTests'); + return array('unit', 'integration', 'system'); } /** @@ -165,20 +164,19 @@ class TestsRun extends ConsoleCommand return; } - $suite = ucfirst($suite); - - if (Common::stringEndsWith($suite, 'tests')) { - $suite = str_replace('tests', 'Tests', $suite); - } elseif (strpos($suite, 'Tests') === false) { - $suite = $suite . 'Tests'; - } - $availableSuites = $this->getTestsSuites(); if (!in_array($suite, $availableSuites)) { throw new \InvalidArgumentException('Invalid testsuite specified. Use one of: ' . implode(', ', $availableSuites)); } + $suite = $this->buildTestSuiteName($suite); + return $suite; } + + private function buildTestSuiteName($suite) + { + return ucfirst($suite) . 'Tests'; + } }
\ No newline at end of file diff --git a/tests/PHPUnit/Unit/DeprecatedMethodsTest.php b/tests/PHPUnit/Unit/DeprecatedMethodsTest.php index 2516dca051..4d07c93857 100644 --- a/tests/PHPUnit/Unit/DeprecatedMethodsTest.php +++ b/tests/PHPUnit/Unit/DeprecatedMethodsTest.php @@ -30,7 +30,7 @@ class DeprecatedMethodsTest extends PHPUnit_Framework_TestCase $validTill = '2014-10-20'; $this->assertDeprecatedMethodIsRemoved('\Piwik\SettingsPiwik', 'rewriteTmpPathWithHostname', $validTill); - $validTill = '2014-12-06'; + $validTill = '2015-02-06'; $this->assertDeprecatedClassIsRemoved('\IntegrationTestCase', $validTill); $this->assertDeprecatedClassIsRemoved('\DatabaseTestCase', $validTill); $this->assertDeprecatedClassIsRemoved('\Piwik\Tests\Fixture', $validTill); diff --git a/tests/PHPUnit/phpunit.xml.dist b/tests/PHPUnit/phpunit.xml.dist index fc80aa1358..a900ce40df 100644 --- a/tests/PHPUnit/phpunit.xml.dist +++ b/tests/PHPUnit/phpunit.xml.dist @@ -39,8 +39,6 @@ <exclude>../../plugins/*/Test/Integration</exclude> <exclude>../../plugins/*/tests/Unit</exclude> <exclude>../../plugins/*/Test/Unit</exclude> - <exclude>../../plugins/*/tests/UI</exclude> - <exclude>../../plugins/*/Test/UI</exclude> </testsuite> <testsuite name="IntegrationTests"> <directory>./Integration</directory> diff --git a/tests/README.md b/tests/README.md index dffd94a16b..16d1b1ee90 100644 --- a/tests/README.md +++ b/tests/README.md @@ -70,14 +70,21 @@ To execute the tests: 4. Run the tests - $ cd /path/to/piwik/tests/PHPUnit - $ phpunit --testsuite UnitTests - $ phpunit --testsuite IntegrationTests - $ phpunit --testsuite SystemTests - - There are also two main groups of tests: Core and Plugins - For example run `phpunit --group Core` - to run all Core Piwik tests. + $ cd /path/to/piwik + $ ./console tests:run --testsuite unit + $ ./console tests:run --testsuite integration + $ ./console tests:run --testsuite system + + There are also two main groups of tests: core and plugins + For example run `./console tests:run core` to run all Core Piwik tests. + + You can combine testsuite and groups like this: + `./console tests:run --testsuite unit core`. This would run all unit tests in core. + `./console tests:run --testsuite integration CustomAlerts`. This would run all integration tests of the CustomAlerts plugin. + `./console tests:run CustomAlerts`. This would run all unit, integration and system tests of the CustomAlerts plugin. (group only) + + To execute multiple groups you can separate them via a comma: + `./console tests:run CustomAlerts,Insights`. This would run all unit, integration and system tests of the CustomAlerts and Insights plugin. 5. Write more tests :) See ["Writing Unit tests with PHPUnit"](http://www.phpunit.de/manual/current/en/writing-tests-for-phpunit.html) |