diff --git a/tests/Alchemy/Tests/Phrasea/Controller/Api/ApiTestCase.php b/tests/Alchemy/Tests/Phrasea/Controller/Api/ApiTestCase.php index 1b78483f55..917077abe6 100644 --- a/tests/Alchemy/Tests/Phrasea/Controller/Api/ApiTestCase.php +++ b/tests/Alchemy/Tests/Phrasea/Controller/Api/ApiTestCase.php @@ -64,7 +64,7 @@ abstract class ApiTestCase extends \PhraseanetWebTestCase }); if (!self::$apiInitialized) { - self::$account = \API_OAuth2_Account::load_with_user(self::$DI['app'], self::$DI['oauth2-app-user_notAdmin'], self::$DI['user_notAdmin']); + self::$account = \API_OAuth2_Account::load_with_user(self::$DI['app'], self::$DI['oauth2-app-user-not-admin'], self::$DI['user_notAdmin']); self::$account->set_revoked(false); self::$token = self::$account->get_token()->get_value(); diff --git a/tests/Alchemy/Tests/Phrasea/Controller/Api/OAuth2Test.php b/tests/Alchemy/Tests/Phrasea/Controller/Api/OAuth2Test.php index 40cea817ca..8a1376be81 100644 --- a/tests/Alchemy/Tests/Phrasea/Controller/Api/OAuth2Test.php +++ b/tests/Alchemy/Tests/Phrasea/Controller/Api/OAuth2Test.php @@ -32,8 +32,8 @@ class OAuth2Test extends \PhraseanetAuthenticatedWebTestCase $this->queryParameters = [ "response_type" => "code", - "client_id" => self::$DI['oauth2-app-user']->get_client_id(), - "redirect_uri" => self::$DI['oauth2-app-user']->get_redirect_uri(), + "client_id" => self::$DI['oauth2-app-user']->getClientId(), + "redirect_uri" => self::$DI['oauth2-app-user']->getRedirectId(), "scope" => "", "state" => "valueTest" ]; @@ -96,7 +96,7 @@ class OAuth2Test extends \PhraseanetAuthenticatedWebTestCase public static function getAccount() { $sql = "SELECT api_account_id FROM api_accounts WHERE application_id = :app_id AND usr_id = :usr_id"; - $t = [":app_id" => self::$DI['oauth2-app-user']->get_id(), ":usr_id" => self::$DI['user']->getId()]; + $t = [":app_id" => self::$DI['oauth2-app-user']->getId(), ":usr_id" => self::$DI['user']->getId()]; $conn = self::$DI['app']['phraseanet.appbox']->get_connection(); $stmt = $conn->prepare($sql); $stmt->execute($t); @@ -135,8 +135,8 @@ class OAuth2Test extends \PhraseanetAuthenticatedWebTestCase self::$DI['client']->request('GET', '/api/oauthv2/authorize', $this->queryParameters); $this->assertTrue(self::$DI['client']->getResponse()->isSuccessful()); - $this->assertRegExp("/" . self::$DI['oauth2-app-user']->get_client_id() . "/", self::$DI['client']->getResponse()->getContent()); - $this->assertRegExp("/" . str_replace("/", '\/', self::$DI['oauth2-app-user']->get_redirect_uri()) . "/", self::$DI['client']->getResponse()->getContent()); + $this->assertRegExp("/" . self::$DI['oauth2-app-user']->getCLientId() . "/", self::$DI['client']->getResponse()->getContent()); + $this->assertRegExp("/" . str_replace("/", '\/', self::$DI['oauth2-app-user']->getRedirectUri()) . "/", self::$DI['client']->getResponse()->getContent()); $this->assertRegExp("/" . $this->queryParameters["response_type"] . "/", self::$DI['client']->getResponse()->getContent()); $this->assertRegExp("/" . $this->queryParameters["scope"] . "/", self::$DI['client']->getResponse()->getContent()); $this->assertRegExp("/" . $this->queryParameters["state"] . "/", self::$DI['client']->getResponse()->getContent()); diff --git a/tests/Alchemy/Tests/Phrasea/Controller/Root/AccountTest.php b/tests/Alchemy/Tests/Phrasea/Controller/Root/AccountTest.php index 7333bd9b47..1f7eb48c4c 100644 --- a/tests/Alchemy/Tests/Phrasea/Controller/Root/AccountTest.php +++ b/tests/Alchemy/Tests/Phrasea/Controller/Root/AccountTest.php @@ -376,7 +376,7 @@ class AccountTest extends \PhraseanetAuthenticatedWebTestCase */ public function testAUthorizedAppGrantAccessSuccessfull($revoke, $expected) { - self::$DI['client']->request('GET', '/account/security/application/' . self::$DI['oauth2-app-user']->get_id() . '/grant/', [ + self::$DI['client']->request('GET', '/account/security/application/' . self::$DI['oauth2-app-user']->getId() . '/grant/', [ 'revoke' => $revoke ], [], [ 'HTTP_ACCEPT' => 'application/json', diff --git a/tests/classes/PhraseanetTestCase.php b/tests/classes/PhraseanetTestCase.php index e0b5f434ec..ac85c41c5e 100644 --- a/tests/classes/PhraseanetTestCase.php +++ b/tests/classes/PhraseanetTestCase.php @@ -202,7 +202,7 @@ abstract class PhraseanetTestCase extends WebTestCase return new $DI['app']['repo.api-applications']->find(self::$fixtureIds['oauth']['user']); }); - self::$DI['oauth2-app-user_notAdmin'] = self::$DI->share(function ($DI) { + self::$DI['oauth2-app-user-not-admin'] = self::$DI->share(function ($DI) { return new $DI['app']['repo.api-applications']->find(self::$fixtureIds['oauth']['user-not-admin']); }); diff --git a/tests/classes/api/oauthv2/ApplicationTest.php b/tests/classes/api/oauthv2/ApplicationTest.php index 575e3997a6..9238f9ebe8 100644 --- a/tests/classes/api/oauthv2/ApplicationTest.php +++ b/tests/classes/api/oauthv2/ApplicationTest.php @@ -36,7 +36,7 @@ class api_oauthv2_ApplicationTest extends \PhraseanetTestCase $found = false; foreach ($apps as $app) { - if ($app->get_id() === self::$DI['oauth2-app-user']->get_id()) { + if ($app->get_id() === self::$DI['oauth2-app-user']->getId()) { $found = true; } $this->assertInstanceOf('ApiApplication', $app); @@ -55,9 +55,9 @@ class api_oauthv2_ApplicationTest extends \PhraseanetTestCase $this->assertTrue(in_array(self::$DI['oauth2-app-user']->getType(), [ApiApplication::DESKTOP_TYPE, ApiApplication::WEB_TYPE])); $this->assertTrue(is_string(self::$DI['oauth2-app-user']->getNonce())); $this->assertEquals(64, strlen(self::$DI['oauth2-app-user']->getNonce())); - self::$DI['oauth2-app-user']->set_type(ApiApplication::WEB_TYPE); + self::$DI['oauth2-app-user']->setType(ApiApplication::WEB_TYPE); $this->assertEquals(ApiApplication::WEB_TYPE, self::$DI['oauth2-app-user']->getType()); - self::$DI['oauth2-app-user']->set_type(ApiApplication::DESKTOP_TYPE); + self::$DI['oauth2-app-user']->setType(ApiApplication::DESKTOP_TYPE); $this->assertEquals(ApiApplication::DESKTOP_TYPE, self::$DI['oauth2-app-user']->getType()); $this->assertEquals(ApiApplication::NATIVE_APP_REDIRECT_URI, self::$DI['oauth2-app-user']->getRedirectUri()); self::$DI['oauth2-app-user']->setType(ApiApplication::WEB_TYPE);