diff options
author | diosmosis <benakamoorthi@fastmail.fm> | 2014-04-04 22:57:20 +0400 |
---|---|---|
committer | diosmosis <benakamoorthi@fastmail.fm> | 2014-04-04 22:57:20 +0400 |
commit | e1f4d6795c7922f5e3330b3d5296314094e6844b (patch) | |
tree | 02659faf0dd08e83496df15f213378ef1fd606b7 /tests | |
parent | 0187cfd6e5c264ce8eac2064ac7b852eb2798697 (diff) |
Add new console command to setup fixture outside of a test so manual testing can be done w/ existing fixtures and so specific custom data can be added by creating a fixture. Includes slight refactor to Fixture.php.
Diffstat (limited to 'tests')
-rw-r--r-- | tests/PHPUnit/DatabaseTestCase.php | 2 | ||||
-rw-r--r-- | tests/PHPUnit/Fixture.php | 5 | ||||
-rw-r--r-- | tests/PHPUnit/Fixtures/UITestFixture.php | 4 | ||||
-rw-r--r-- | tests/PHPUnit/Integration/Core/CronArchive/SharedSiteIdsTest.php | 2 | ||||
-rwxr-xr-x | tests/PHPUnit/IntegrationTestCase.php | 2 | ||||
-rw-r--r-- | tests/lib/screenshot-testing/support/setupDatabase.php | 2 | ||||
-rw-r--r-- | tests/lib/screenshot-testing/support/teardownDatabase.php | 2 |
7 files changed, 9 insertions, 10 deletions
diff --git a/tests/PHPUnit/DatabaseTestCase.php b/tests/PHPUnit/DatabaseTestCase.php index ef3540f50b..eea23e45e3 100644 --- a/tests/PHPUnit/DatabaseTestCase.php +++ b/tests/PHPUnit/DatabaseTestCase.php @@ -37,7 +37,7 @@ class DatabaseTestCase extends PHPUnit_Framework_TestCase $this->fixture = new Fixture(); $this->configureFixture(); - $this->fixture->performSetUp(__CLASS__); + $this->fixture->performSetUp(); } /** diff --git a/tests/PHPUnit/Fixture.php b/tests/PHPUnit/Fixture.php index 057401f9fb..76f8ac4f62 100644 --- a/tests/PHPUnit/Fixture.php +++ b/tests/PHPUnit/Fixture.php @@ -81,10 +81,8 @@ class Fixture extends PHPUnit_Framework_Assert // empty } - public function performSetUp($testCase, $setupEnvironmentOnly = false) + public function performSetUp($setupEnvironmentOnly = false) { - $this->getTestEnvironment()->delete(); - try { if ($this->createConfig) { Config::getInstance()->setTestEnvironment(); @@ -197,6 +195,7 @@ class Fixture extends PHPUnit_Framework_Assert { if ($this->testEnvironment === null) { $this->testEnvironment = new Piwik_TestingEnvironment(); + $this->testEnvironment->delete(); } return $this->testEnvironment; } diff --git a/tests/PHPUnit/Fixtures/UITestFixture.php b/tests/PHPUnit/Fixtures/UITestFixture.php index cfaf75c94c..a3e12abc23 100644 --- a/tests/PHPUnit/Fixtures/UITestFixture.php +++ b/tests/PHPUnit/Fixtures/UITestFixture.php @@ -51,9 +51,9 @@ class UITestFixture extends OmniFixture VisitsSummaryAPI::getInstance()->get($this->idSite, 'year', $date, urlencode($this->segment)); } - public function performSetUp($testCase, $setupEnvironmentOnly = false) + public function performSetUp($setupEnvironmentOnly = false) { - parent::performSetUp($testCase, $setupEnvironmentOnly); + parent::performSetUp($setupEnvironmentOnly); $this->createSegments(); $this->setupDashboards(); diff --git a/tests/PHPUnit/Integration/Core/CronArchive/SharedSiteIdsTest.php b/tests/PHPUnit/Integration/Core/CronArchive/SharedSiteIdsTest.php index 7985f3f0ba..63f35cc1af 100644 --- a/tests/PHPUnit/Integration/Core/CronArchive/SharedSiteIdsTest.php +++ b/tests/PHPUnit/Integration/Core/CronArchive/SharedSiteIdsTest.php @@ -21,7 +21,7 @@ class SharedSiteIdsTest extends DatabaseTestCase public function setUp() { parent::setUp(); - $this->fixture->performSetUp(null, true); + $this->fixture->performSetUp(true); $this->sharedSiteIds = new SharedSiteIds(array(1,2,5,9)); } diff --git a/tests/PHPUnit/IntegrationTestCase.php b/tests/PHPUnit/IntegrationTestCase.php index 2851d80a68..63e353ae10 100755 --- a/tests/PHPUnit/IntegrationTestCase.php +++ b/tests/PHPUnit/IntegrationTestCase.php @@ -86,7 +86,7 @@ abstract class IntegrationTestCase extends PHPUnit_Framework_TestCase } try { - $fixture->performSetUp(get_called_class()); + $fixture->performSetUp(); } catch (Exception $e) { static::fail("Failed to setup fixture: " . $e->getMessage() . "\n" . $e->getTraceAsString()); } diff --git a/tests/lib/screenshot-testing/support/setupDatabase.php b/tests/lib/screenshot-testing/support/setupDatabase.php index 9f7bc0d350..6556707354 100644 --- a/tests/lib/screenshot-testing/support/setupDatabase.php +++ b/tests/lib/screenshot-testing/support/setupDatabase.php @@ -35,7 +35,7 @@ if (!empty($fixtureClass)) { $fixture->resetPersistedFixture = true; } $fixture->printToScreen = true; - $fixture->performSetUp(""); + $fixture->performSetUp(); } // make sure symbolic links exist (phantomjs doesn't support symlink-ing yet) diff --git a/tests/lib/screenshot-testing/support/teardownDatabase.php b/tests/lib/screenshot-testing/support/teardownDatabase.php index 3ef3e8e1f7..572e3d9608 100644 --- a/tests/lib/screenshot-testing/support/teardownDatabase.php +++ b/tests/lib/screenshot-testing/support/teardownDatabase.php @@ -27,5 +27,5 @@ if (!class_exists($fixtureClass)) { $fixture = new $fixtureClass(); $fixture->dropDatabaseInSetUp = false; $fixture->printToScreen = true; -$fixture->performSetUp("", $environmentOnly = true); +$fixture->performSetUp($environmentOnly = true); $fixture->performTearDown("");
\ No newline at end of file |