Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Refs #4189, use new Omni test fixture for UI tests that combines all …
…other fixtures.
- Loading branch information
diosmosis
committed
Dec 14, 2013
1 parent
6a5c309
commit a68ed87
Showing
32 changed files
with
336 additions
and
96 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,81 @@ | ||
<?php | ||
/** | ||
* Piwik - Open source web analytics | ||
* | ||
* @link http://piwik.org | ||
* @license http://www.gnu.org/licenses/gpl-3.0.html GPL v3 or later | ||
*/ | ||
|
||
use Piwik\Date; | ||
use Piwik\Tracker\Visit; | ||
|
||
/** | ||
* This fixture is the combination of every other fixture defined by Piwik. Should be used | ||
* with year periods. | ||
*/ | ||
class Test_Piwik_Fixture_OmniFixture extends Test_Piwik_BaseFixture | ||
{ | ||
public $month = '2012-01'; | ||
public $idSite = 'all'; | ||
public $dateTime = '2012-02-01'; | ||
public $now = null; | ||
|
||
public $fixtures = array(); | ||
|
||
/** | ||
* Constructor. | ||
*/ | ||
public function __construct() | ||
{ | ||
$date = $this->month . '-01'; | ||
|
||
$classes = get_declared_classes(); | ||
foreach ($classes as $className) { | ||
if (is_subclass_of($className, 'Test_Piwik_BaseFixture') | ||
&& $className != __CLASS__ | ||
) { | ||
$fixture = new $className(); | ||
if (!property_exists($fixture, 'dateTime')) { | ||
continue; | ||
} | ||
|
||
$fixture->dateTime = $this->adjustDateTime($fixture->dateTime, $date); | ||
|
||
$this->fixtures[$className] = $fixture; | ||
|
||
$date = Date::factory($date)->addDay(1)->toString(); | ||
} | ||
} | ||
|
||
$this->now = $this->fixtures['Test_Piwik_Fixture_ManySitesImportedLogsWithXssAttempts']->now; | ||
|
||
// make sure Test_Piwik_Fixture_ManySitesImportedLogsWithXssAttempts is the first fixture | ||
$fixture = $this->fixtures['Test_Piwik_Fixture_ManySitesImportedLogsWithXssAttempts']; | ||
unset($this->fixtures['Test_Piwik_Fixture_ManySitesImportedLogsWithXssAttempts']); | ||
$this->fixtures = array_merge(array('Test_Piwik_Fixture_ManySitesImportedLogsWithXssAttempts' => $fixture), $this->fixtures); | ||
} | ||
|
||
private function adjustDateTime($dateTime, $adjustToDate) | ||
{ | ||
$parts = explode(' ', $dateTime); | ||
|
||
$result = $adjustToDate . ' '; | ||
$result .= isset($parts[1]) ? $parts[1] : '11:22:33'; | ||
|
||
return $result; | ||
} | ||
|
||
public function setUp() | ||
{ | ||
foreach ($this->fixtures as $name => $fixture) { | ||
$fixture->setUp(); | ||
} | ||
} | ||
|
||
public function tearDown() | ||
{ | ||
foreach ($this->fixtures as $fixture) { | ||
$fixture->tearDown(); | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.