From 589fee1a8af0110d0028b7482d8afa853e93461c Mon Sep 17 00:00:00 2001 From: Ingo Schommer Date: Thu, 16 Jul 2015 22:12:15 +1200 Subject: [PATCH] Removed obsolete TestRunner->$skipTests flag Taken care of by the default PHPUnit implementation of markTestSkipped() --- dev/FunctionalTest.php | 4 +++- dev/SapphireTest.php | 14 ++------------ docs/en/04_Changelogs/4.0.0.md | 1 + tests/core/startup/ErrorControlChainTest.php | 1 - tests/model/GDImageTest.php | 8 ++------ tests/model/ImageTest.php | 8 +++----- tests/model/ImagickImageTest.php | 13 ++++--------- 7 files changed, 15 insertions(+), 34 deletions(-) diff --git a/dev/FunctionalTest.php b/dev/FunctionalTest.php index 1ad9471bb..318f97b73 100644 --- a/dev/FunctionalTest.php +++ b/dev/FunctionalTest.php @@ -76,7 +76,9 @@ class FunctionalTest extends SapphireTest { public function setUp() { // Skip calling FunctionalTest directly. - if(get_class($this) == "FunctionalTest") $this->skipTest = true; + if(get_class($this) == "FunctionalTest") { + $this->markTestSkipped(sprintf('Skipping %s ', get_class($this))); + } parent::setUp(); $this->mainSession = new TestSession(); diff --git a/dev/SapphireTest.php b/dev/SapphireTest.php index da8850868..4b8781af1 100644 --- a/dev/SapphireTest.php +++ b/dev/SapphireTest.php @@ -29,11 +29,6 @@ class SapphireTest extends PHPUnit_Framework_TestCase { */ protected $fixtureFactory; - /** - * @var bool Set whether to include this test in the TestRunner or to skip this. - */ - protected $skipTest = false; - /** * @var Boolean If set to TRUE, this will force a test database to be generated * in {@link setUp()}. Note that this flag is overruled by the presence of a @@ -183,13 +178,8 @@ class SapphireTest extends PHPUnit_Framework_TestCase { $this->originalReadingMode = \Versioned::get_reading_mode(); // We cannot run the tests on this abstract class. - if(get_class($this) == "SapphireTest") $this->skipTest = true; - - if($this->skipTest) { - $this->markTestSkipped(sprintf( - 'Skipping %s ', get_class($this) - )); - + if(get_class($this) == "SapphireTest") { + $this->markTestSkipped(sprintf('Skipping %s ', get_class($this))); return; } diff --git a/docs/en/04_Changelogs/4.0.0.md b/docs/en/04_Changelogs/4.0.0.md index 100d03920..839f66da0 100644 --- a/docs/en/04_Changelogs/4.0.0.md +++ b/docs/en/04_Changelogs/4.0.0.md @@ -53,6 +53,7 @@ * Moved test database cleanup task from `sake dev/tests/cleanupdb` to `sake dev/tasks/CleanupTestDatabasesTask` * Removed `TestRunner` and `JSTestRunner` APIs * Removed `PhpUnitWrapper`, `PhpUnitWrapper_3_4`, `PhpUnitWrapper_3_5`, `PhpUnitWrapper_Generic`, `SapphireTestSuite` APIs + * Removed `SapphireTest->skipTest`, use `markTestSkipped()` in a `setUp()` method instead * `HtmlEditorConfig` is now an abstract class, with a default implementation `TinyMCEConfig` for the built in TinyMCE editor. * `HtmlEditorField::setEditorConfig` may now take an instance of a `HtmlEditorConfig` class, as well as a diff --git a/tests/core/startup/ErrorControlChainTest.php b/tests/core/startup/ErrorControlChainTest.php index b5d9031fc..ebd2f6c75 100644 --- a/tests/core/startup/ErrorControlChainTest.php +++ b/tests/core/startup/ErrorControlChainTest.php @@ -70,7 +70,6 @@ class ErrorControlChainTest extends SapphireTest { if ($rv != 0) { $this->markTestSkipped("Can't run PHP from the command line - is it in your path?"); - $this->skipTest = true; } parent::setUp(); diff --git a/tests/model/GDImageTest.php b/tests/model/GDImageTest.php index 9d333dee7..75f214ba2 100644 --- a/tests/model/GDImageTest.php +++ b/tests/model/GDImageTest.php @@ -3,15 +3,11 @@ class GDImageTest extends ImageTest { public function setUp() { - $skip = !extension_loaded("gd"); - if($skip) { - $this->skipTest = true; - } - parent::setUp(); - if($skip) { + if(!extension_loaded("gd")) { $this->markTestSkipped("The GD extension is required"); + return; } Config::inst()->update('Injector', 'Image_Backend', 'GDBackend'); diff --git a/tests/model/ImageTest.php b/tests/model/ImageTest.php index 0421a274a..9cea5af3d 100644 --- a/tests/model/ImageTest.php +++ b/tests/model/ImageTest.php @@ -15,13 +15,11 @@ class ImageTest extends SapphireTest { protected static $fixture_file = 'ImageTest.yml'; public function setUp() { - if(get_class($this) == "ImageTest") { - $this->skipTest = true; - } - parent::setUp(); - if($this->skipTest) { + // Execute specific subclass + if(get_class($this) == "ImageTest") { + $this->markTestSkipped(sprintf('Skipping %s ', get_class($this))); return; } diff --git a/tests/model/ImagickImageTest.php b/tests/model/ImagickImageTest.php index 67e699825..9b7f15a97 100644 --- a/tests/model/ImagickImageTest.php +++ b/tests/model/ImagickImageTest.php @@ -1,17 +1,12 @@ skipTest = true; - } - parent::setUp(); - - if($skip) { - $this->markTestSkipped("The Imagick extension is not available."); - } + if(!extension_loaded("imagick")) { + $this->markTestSkipped("The Imagick extension is not available."); + return; + } Config::inst()->update('Injector', 'Image_Backend', 'ImagickBackend'); }