From 4240438b20a895b5a87d0ed5bdfac70daf8ee04c Mon Sep 17 00:00:00 2001 From: sgiehl <stefangiehl@gmail.com> Date: Wed, 29 Aug 2012 19:42:10 +0000 Subject: [PATCH] small test improvements git-svn-id: http://dev.piwik.org/svn/trunk@6884 59fd770c-687e-43c8-a1e3-f5a4ff64c105 --- .../Integration/EcommerceOrderWithItemsTest.php | 10 +++++----- tests/PHPUnit/IntegrationTestCase.php | 14 ++++++++------ 2 files changed, 13 insertions(+), 11 deletions(-) diff --git a/tests/PHPUnit/Integration/EcommerceOrderWithItemsTest.php b/tests/PHPUnit/Integration/EcommerceOrderWithItemsTest.php index 06f20b715c..4a809a3eaa 100755 --- a/tests/PHPUnit/Integration/EcommerceOrderWithItemsTest.php +++ b/tests/PHPUnit/Integration/EcommerceOrderWithItemsTest.php @@ -204,11 +204,11 @@ class Test_Piwik_Integration_EcommerceOrderWithItems extends IntegrationTestCase $t->setEcommerceView('SKU2', 'PRODUCT name', $category, $price); $t->setCustomVariable(5, 'VisitorType', 'NewLoggedOut', 'visit'); $t->setCustomVariable(4, 'ValueIsZero', '0', 'visit'); - self::assertTrue($t->getCustomVariable(3, 'page') == array('_pks', 'SKU2')); - self::assertTrue($t->getCustomVariable(4, 'page') == array('_pkn', 'PRODUCT name')); - self::assertTrue($t->getCustomVariable(5, 'page') == array('_pkc', $category)); - self::assertTrue($t->getCustomVariable(2, 'page') == array('_pkp', $price)); - self::assertTrue($t->getCustomVariable(5, 'visit') == array('VisitorType', 'NewLoggedOut')); + self::assertEquals(array('_pks', 'SKU2'), $t->getCustomVariable(3, 'page')); + self::assertEquals(array('_pkn', 'PRODUCT name'), $t->getCustomVariable(4, 'page')); + self::assertEquals(array('_pkc', $category), $t->getCustomVariable(5, 'page')); + self::assertEquals(array('_pkp', $price), $t->getCustomVariable(2, 'page')); + self::assertEquals(array('VisitorType', 'NewLoggedOut'), $t->getCustomVariable(5, 'visit')); self::checkResponse($t->doTrackPageView('incredible title!')); $t->setForceVisitDateTime(Piwik_Date::factory($dateTime)->addHour(0.1)->getDatetime()); diff --git a/tests/PHPUnit/IntegrationTestCase.php b/tests/PHPUnit/IntegrationTestCase.php index 54a1e77f82..a74b31b5ee 100755 --- a/tests/PHPUnit/IntegrationTestCase.php +++ b/tests/PHPUnit/IntegrationTestCase.php @@ -378,10 +378,10 @@ abstract class IntegrationTestCase extends PHPUnit_Framework_TestCase $expectedResponse = base64_decode($trans_gif_64); self::assertEquals($expectedResponse, $response, "Expected GIF beacon, got: <br/>\n" . $response ."<br/>\n"); } - + /** * Returns URL to Piwik root. - * + * * @return string */ protected static function getRootUrl() @@ -394,11 +394,11 @@ abstract class IntegrationTestCase extends PHPUnit_Framework_TestCase { $pathBeforeRoot = 'plugins'; } - + $piwikUrl = substr($piwikUrl, 0, strpos($piwikUrl, $pathBeforeRoot.'/')); return $piwikUrl; } - + /** * Returns URL to the proxy script, used to ensure piwik.php * uses the test environment, and allows variable overwriting @@ -413,7 +413,7 @@ abstract class IntegrationTestCase extends PHPUnit_Framework_TestCase /** * Returns the super user token auth that can be used in tests. Can be used to * do bulk tracking. - * + * * @return string */ public static function getTokenAuth() @@ -421,7 +421,7 @@ abstract class IntegrationTestCase extends PHPUnit_Framework_TestCase // get token auth $pwd = Zend_Registry::get('config')->superuser->password; if(strlen($pwd) != 32) $pwd = md5($pwd); - + return Piwik_UsersManager_API::getInstance()->getTokenAuth( Zend_Registry::get('config')->superuser->login, $pwd); } @@ -434,11 +434,13 @@ abstract class IntegrationTestCase extends PHPUnit_Framework_TestCase * @param array $parametersToSet Parameters to set in api call * @param array $formats Array of 'format' to fetch from API * @param array $periods Array of 'period' to query API + * @param bool $supertableApi * @param bool $setDateLastN If set to true, the 'date' parameter will be rewritten to query instead a range of dates, rather than one period only. * @param bool|string $language 2 letter language code, defaults to default piwik language * @param bool|string $segment * @param bool|string $fileExtension * + * @throws Exception * @return array of API URLs query strings */ protected function generateUrlsApi( $parametersToSet, $formats, $periods, $supertableApi = false, $setDateLastN = false, $language = false, $segment = false, $fileExtension = false ) -- GitLab