diff options
author | diosmosis <diosmosis@users.noreply.github.com> | 2018-05-24 17:24:57 +0300 |
---|---|---|
committer | Matthieu Aubry <mattab@users.noreply.github.com> | 2018-05-24 17:24:57 +0300 |
commit | 61bf67bdb87f59fd098e0206417f50efb1f9bac7 (patch) | |
tree | d653c9fcdb05613a76a22ff5a94244a2370f7d94 /plugins/Live/tests | |
parent | 5d0d5af2fad9f0e94dd2329b476eeebf112cdc42 (diff) |
Use DI to inject test now value for ApiCounterTest. (#12977)
Diffstat (limited to 'plugins/Live/tests')
-rw-r--r-- | plugins/Live/tests/System/ApiCounterTest.php | 17 |
1 files changed, 15 insertions, 2 deletions
diff --git a/plugins/Live/tests/System/ApiCounterTest.php b/plugins/Live/tests/System/ApiCounterTest.php index f957b09608..47b2e24623 100644 --- a/plugins/Live/tests/System/ApiCounterTest.php +++ b/plugins/Live/tests/System/ApiCounterTest.php @@ -25,11 +25,23 @@ use Piwik\Tests\Framework\TestCase\SystemTestCase; class ApiCounterTest extends SystemTestCase { /** + * @var int + */ + private static $testNow; + + /** * @var API */ private $api; private $idSite = 1; + public static function setUpBeforeClass() + { + self::$testNow = strtotime('2018-02-03 04:45:40'); + + parent::setUpBeforeClass(); + } + public function setUp() { parent::setUp(); @@ -104,7 +116,7 @@ class ApiCounterTest extends SystemTestCase private function trackSomeVisits() { - $nowTimestamp = time(); + $nowTimestamp = self::$testNow; // use local tracker so mock location provider can be used $t = Fixture::getTracker($this->idSite, $nowTimestamp, $defaultInit = true, $useLocal = false); @@ -180,7 +192,8 @@ class ApiCounterTest extends SystemTestCase public static function provideContainerConfigBeforeClass() { return array( - 'Piwik\Access' => new FakeAccess() + 'Piwik\Access' => new FakeAccess(), + 'Tests.now' => self::$testNow, ); } } |