diff options
author | diosmosis <benaka@piwik.pro> | 2015-12-25 20:27:03 +0300 |
---|---|---|
committer | diosmosis <benaka@piwik.pro> | 2016-01-13 15:42:23 +0300 |
commit | 6fdf3c30b6eabef360b0158bd4abf137a0b2e79c (patch) | |
tree | 4ad255337a5104a5b7b9af819872e27d1cdc5db2 /tests | |
parent | 1a13eb84e573bc5612305084267be357830a1935 (diff) |
When generating the OmniFixture dump, restore site properties to their initial values before setting up each initial fixture. Ensures that changes to site properties by fixtures are reset before setting up the next fixture.
Diffstat (limited to 'tests')
-rw-r--r-- | tests/PHPUnit/Fixtures/OmniFixture.php | 45 | ||||
-rw-r--r-- | tests/resources/OmniFixture-dump.sql.gz | bin | 81192 -> 82980 bytes |
2 files changed, 40 insertions, 5 deletions
diff --git a/tests/PHPUnit/Fixtures/OmniFixture.php b/tests/PHPUnit/Fixtures/OmniFixture.php index c1a7fec433..f2b5aa9c44 100644 --- a/tests/PHPUnit/Fixtures/OmniFixture.php +++ b/tests/PHPUnit/Fixtures/OmniFixture.php @@ -8,12 +8,10 @@ namespace Piwik\Tests\Fixtures; use Piwik\Date; -use Piwik\Access; use Piwik\Option; use ReflectionClass; -use Piwik\Plugins\VisitsSummary\API as VisitsSummaryAPI; +use Piwik\Plugins\SitesManager\API as SitesManagerAPI; use Piwik\Tests\Framework\Fixture; -use Piwik\Tests\Framework\OverrideLogin; /** * This fixture is the combination of every other fixture defined by Piwik. Should be used @@ -120,10 +118,15 @@ class OmniFixture extends Fixture public function setUp() { + $firstFixture = array_shift($this->fixtures); + $this->setUpFixture($firstFixture); + + $initialSitesProperties = SitesManagerAPI::getInstance()->getAllSites(); + foreach ($this->fixtures as $fixture) { - echo "Setting up " . get_class($fixture) . "...\n"; + $this->restoreSitesProperties($initialSitesProperties); - $fixture->setUp(); + $this->setUpFixture($fixture); } Option::set("Tests.forcedNowTimestamp", $this->now->getTimestamp()); @@ -137,4 +140,36 @@ class OmniFixture extends Fixture $fixture->tearDown(); } } + + private function setUpFixture(Fixture $fixture) + { + echo "Setting up " . get_class($fixture) . "...\n"; + $fixture->setUp(); + } + + private function restoreSitesProperties($initialSitesProperties) + { + foreach ($initialSitesProperties as $idSite => $properties) { + SitesManagerAPI::getInstance()->updateSite( + $idSite, + $siteName = $properties['name'], + $urls = $properties[''], + $ecommerce = $properties['ecommerce'], + $siteSearch = $properties['sitesearch'], + $searchKeywordParameters = $properties['sitesearch_keyword_parameters'], + $searchCategoryParameters = $properties['sitesearch_category_parameters'], + $excludedIps = $properties['excluded_ips'], + $excludedQueryParameters = $properties['excluded_parameters'], + $timezone = $properties['timezone'], + $currency = $properties['currency'], + $group = $properties['group'], + $startDate = $properties['ts_created'], + $excludedUserAgents = $properties['excluded_user_agents'], + $keepURLFragments = $properties['keep_url_fragment'], + $type = $properties['type'], + $settings = null, + $excludeUnknownUrls = $properties['exclude_unknown_urls'] + ); + } + } }
\ No newline at end of file diff --git a/tests/resources/OmniFixture-dump.sql.gz b/tests/resources/OmniFixture-dump.sql.gz Binary files differindex 75ca5eacba..ca5c1a7267 100644 --- a/tests/resources/OmniFixture-dump.sql.gz +++ b/tests/resources/OmniFixture-dump.sql.gz |