diff options
author | Stefan Giehl <stefan@matomo.org> | 2020-12-10 05:18:07 +0300 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-12-10 05:18:07 +0300 |
commit | 7cde69f763f2cbf2b9a27c8a7dcf7bcaa950c3bd (patch) | |
tree | da719a778d96e167ee4ba55c89a529c1c3bb0dce /tests/PHPUnit/Framework | |
parent | 06918eea4d2ca01298200348b40f57817433b931 (diff) |
Allow using last (week|month|year) as date param (#16830)
* Allow using last (week|month|year) as date param
* Adds some unit tests
* improve tests
* Make it possible to use last (week|month|year) for api requests
* improve test
Diffstat (limited to 'tests/PHPUnit/Framework')
-rw-r--r-- | tests/PHPUnit/Framework/TestRequest/Collection.php | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/tests/PHPUnit/Framework/TestRequest/Collection.php b/tests/PHPUnit/Framework/TestRequest/Collection.php index 0510b7df4b..1a7310f78b 100644 --- a/tests/PHPUnit/Framework/TestRequest/Collection.php +++ b/tests/PHPUnit/Framework/TestRequest/Collection.php @@ -11,6 +11,7 @@ namespace Piwik\Tests\Framework\TestRequest; use Piwik\API\DocumentationGenerator; use Piwik\API\Proxy; use Piwik\API\Request; +use Piwik\Date; use Piwik\Tests\Framework\TestCase\SystemTestCase; use Piwik\Url; use Piwik\UrlHelper; @@ -109,7 +110,7 @@ class Collection { $parametersToSet = array( 'idSite' => $this->testConfig->idSite, - 'date' => ($this->testConfig->periods == array('range') || strpos($this->testConfig->date, ',') !== false) ? + 'date' => ($this->testConfig->periods == array('range') || strpos($this->testConfig->date, ',') !== false || preg_match('/last[ -]?(week|month|year)/i', $this->testConfig->date)) ? $this->testConfig->date : date('Y-m-d', strtotime($this->testConfig->date)), 'expanded' => '1', 'piwikUrl' => 'http://example.org/piwik/', |