Add tests

This commit is contained in:
Nicolas Le Goff
2014-03-12 20:36:39 +01:00
parent 137cacea0b
commit 6b50ee15a7
5 changed files with 123 additions and 6 deletions

View File

@@ -60,12 +60,16 @@ class ApiApplicationManipulatorTest extends \PhraseanetTestCase
'Desktop application description',
'http://desktop-app-url.net'
);
$applicationSave = clone $application;
$countBefore = count(self::$DI['app']['repo.api-applications']->findAll());
/**
* @todo Link accounts and tokens to application and tests if everything is deleted
*/
$account = self::$DI['app']['manipulator.api-account']->create($application, self::$DI['user']);
self::$DI['app']['manipulator.api-oauth-token']->create($account);
$manipulator->delete($application);
$this->assertGreaterThan(count(self::$DI['app']['repo.api-applications']->findAll()), $countBefore);
$accounts = self::$DI['app']['repo.api-accounts']->findByUserAndApplication(self::$DI['user'], $applicationSave);
$this->assertEquals(0, count($accounts));
$tokens = self::$DI['app']['repo.api-oauth-tokens']->findOauthTokens($account);
$this->assertEquals(0, count($tokens));
}
public function testUpdate()