diff options
Diffstat (limited to 'plugins/SitesManager/tests/Integration/ModelTest.php')
-rw-r--r-- | plugins/SitesManager/tests/Integration/ModelTest.php | 62 |
1 files changed, 35 insertions, 27 deletions
diff --git a/plugins/SitesManager/tests/Integration/ModelTest.php b/plugins/SitesManager/tests/Integration/ModelTest.php index 21ff01479c..433662dda9 100644 --- a/plugins/SitesManager/tests/Integration/ModelTest.php +++ b/plugins/SitesManager/tests/Integration/ModelTest.php @@ -1,4 +1,5 @@ <?php + /** * Matomo - free/libre analytics platform * @@ -31,21 +32,21 @@ class ModelTest extends IntegrationTestCase $this->model = new Model(); } - public function test_getUsedTypeIds_shouldReturnNoType_IfNoSitesExist() + public function testGetUsedTypeIdsShouldReturnNoTypeIfNoSitesExist() { - $this->assertSame(array(), $this->model->getUsedTypeIds()); + $this->assertSame([], $this->model->getUsedTypeIds()); } - public function test_getUsedTypeIds_shouldReturnOnlyOneType_IfAllSitesUseSameType() + public function testGetUsedTypeIdsShouldReturnOnlyOneTypeIfAllSitesUseSameType() { for ($i = 0; $i < 9; $i++) { $this->createMeasurable('website'); } - $this->assertSame(array('website'), $this->model->getUsedTypeIds()); + $this->assertSame(['website'], $this->model->getUsedTypeIds()); } - public function test_getUsedTypeIds_shouldReturnAnotherType_IfDifferentOnesAreUsed() + public function testGetUsedTypeIdsShouldReturnAnotherTypeIfDifferentOnesAreUsed() { for ($i = 0; $i < 9; $i++) { $this->createMeasurable('website'); @@ -53,10 +54,10 @@ class ModelTest extends IntegrationTestCase $this->createMeasurable('mobileapp'); } - $this->assertSame(array('website', 'universal', 'mobileapp'), $this->model->getUsedTypeIds()); + $this->assertSame(['website', 'universal', 'mobileapp'], $this->model->getUsedTypeIds()); } - public function test_getAllKnownUrlsForAllSites_shouldReturnAllUrls() + public function testGetAllKnownUrlsForAllSitesShouldReturnAllUrls() { $idSite = $this->createMeasurable('website', 'http://apache.piwik'); $this->model->insertSiteUrl($idSite, 'http://example.apache.piwik'); @@ -68,45 +69,52 @@ class ModelTest extends IntegrationTestCase $idSite3 = $this->createMeasurable('website', 'http://example.pro'); - $expected = array( - array( + $expected = [ + [ 'idsite' => $idSite, 'url' => 'http://apache.piwik' - ), - array( + ], + [ 'idsite' => $idSite2, 'url' => 'http://piwik.net' - ), - array( + ], + [ 'idsite' => $idSite3, 'url' => 'http://example.pro' - ), - array( + ], + [ 'idsite' => $idSite, 'url' => 'http://example.apache.piwik' - ), - array( + ], + [ 'idsite' => $idSite, 'url' => 'http://example.org' - ), - array( + ], + [ 'idsite' => $idSite2, 'url' => 'http://example.com' - ), - array( + ], + [ 'idsite' => $idSite2, 'url' => 'http://example.org' - ) + ] - ); + ]; $this->assertEquals($expected, $this->model->getAllKnownUrlsForAllSites()); } private function createMeasurable($type, $siteUrl = false) { - return Fixture::createWebsite('2015-01-01 00:00:00', - $ecommerce = 0, $siteName = false, $siteUrl, - $siteSearch = 1, $searchKeywordParameters = null, - $searchCategoryParameters = null, $timezone = null, $type); + return Fixture::createWebsite( + '2015-01-01 00:00:00', + $ecommerce = 0, + $siteName = false, + $siteUrl, + $siteSearch = 1, + $searchKeywordParameters = null, + $searchCategoryParameters = null, + $timezone = null, + $type + ); } } |