diff --git a/tests/PHPUnit/BaseFixture.php b/tests/PHPUnit/BaseFixture.php index 285f1c5d4b0e79430aca422a6f5fe4d730f40304..18d0d9bfb1959f02bc25e5846343fa7d5c7b9ffc 100644 --- a/tests/PHPUnit/BaseFixture.php +++ b/tests/PHPUnit/BaseFixture.php @@ -216,7 +216,14 @@ abstract class Test_Piwik_BaseFixture extends PHPUnit_Framework_Assert */ public static function getTokenAuth() { - $login = 'admin'; + $user = self::createSuperUser(); + + return $user['token_auth']; + } + + public static function createSuperUser() + { + $login = 'admin'; $password = '098f6bcd4621d373cade4e832627b4f6'; $token = APIUsersManager::getInstance()->getTokenAuth($login, $password); @@ -232,7 +239,7 @@ abstract class Test_Piwik_BaseFixture extends PHPUnit_Framework_Assert $model->setSuperUserAccess($login, true); } - return $token; + return $model->getUserByTokenAuth($token); } /** diff --git a/tests/PHPUnit/Fixtures/ManySitesImportedLogs.php b/tests/PHPUnit/Fixtures/ManySitesImportedLogs.php index ec5460a5a329616ab0ca2a4361bc0684bb6dfa01..1f9fc232b7b62a5ebae52192ba02910f741de5d4 100644 --- a/tests/PHPUnit/Fixtures/ManySitesImportedLogs.php +++ b/tests/PHPUnit/Fixtures/ManySitesImportedLogs.php @@ -131,7 +131,7 @@ class Test_Piwik_Fixture_ManySitesImportedLogs extends Test_Piwik_BaseFixture '--enable-testmode' => false, '--recorders' => '4', '--recorder-max-payload-size' => '2'); - + self::createSuperUser(); self::executeLogImporter($logFile, $opts); } @@ -149,7 +149,7 @@ class Test_Piwik_Fixture_ManySitesImportedLogs extends Test_Piwik_BaseFixture '--enable-testmode' => false, '--recorders' => '4', '--recorder-max-payload-size' => '1'); - + self::createSuperUser(); self::executeLogImporter($logFile, $opts); }