/** * * @return void */ public function delete() { $this->get_token()->delete(); foreach (API_OAuth2_AuthCode::load_codes_by_account($this->app, $this) as $code) { $code->delete(); } foreach (API_OAuth2_RefreshToken::load_by_account($this->app, $this) as $token) { $token->delete(); } $sql = 'DELETE FROM api_accounts WHERE api_account_id = :account_id'; $stmt = $this->app['phraseanet.appbox']->get_connection()->prepare($sql); $stmt->execute(['account_id' => $this->id]); $stmt->closeCursor(); return; }
public function testLoad_codes_by_account() { $this->assertTrue(is_array(API_OAuth2_AuthCode::load_codes_by_account(self::$DI['app'], $this->account))); $this->assertTrue(count(API_OAuth2_AuthCode::load_codes_by_account(self::$DI['app'], $this->account)) > 0); }