Skip to content

Commit

Permalink
Implement simple QC fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
Allypost committed Dec 5, 2019
1 parent 3865e43 commit 249795d
Showing 1 changed file with 18 additions and 35 deletions.
53 changes: 18 additions & 35 deletions Tests/Acceptance/DoctrineClientManagerTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,10 @@
use Trikoder\Bundle\OAuth2Bundle\Model\Client;
use Trikoder\Bundle\OAuth2Bundle\Model\RefreshToken;

class DoctrineClientManagerTest extends AbstractAcceptanceTest
/**
* @covers \Trikoder\Bundle\OAuth2Bundle\Manager\Doctrine\ClientManager
*/
final class DoctrineClientManagerTest extends AbstractAcceptanceTest
{
public function testSimpleDelete(): void
{
Expand All @@ -28,11 +31,7 @@ public function testSimpleDelete(): void
$this->assertNull(
$em
->getRepository(Client::class)
->findOneBy(
[
'identifier' => $client->getIdentifier(),
]
)
->find($client->getIdentifier())
);
}

Expand All @@ -55,21 +54,17 @@ public function testClientDeleteCascadesToAccessTokens(): void
$this->assertNull(
$em
->getRepository(Client::class)
->findOneBy(
[
'identifier' => $client->getIdentifier(),
]
)
->find($client->getIdentifier())
);

// The entity manager has to be cleared manually
// because it doesn't process deep integrity constraints
$em->clear();

$this->assertNull(
$em
->getRepository(AccessToken::class)
->findOneBy(
[
'identifier' => $accessToken->getIdentifier(),
]
)
->find($accessToken->getIdentifier())
);
}

Expand All @@ -96,35 +91,23 @@ public function testClientDeleteCascadesToAccessTokensAndRefreshTokens(): void
$this->assertNull(
$em
->getRepository(Client::class)
->findOneBy(
[
'identifier' => $client->getIdentifier(),
]
)
->find($client->getIdentifier())
);

// The entity manager has to be cleared manually
// because it doesn't process deep integrity constraints
$em->clear();

$this->assertNull(
$em
->getRepository(AccessToken::class)
->findOneBy(
[
'identifier' => $accessToken->getIdentifier(),
]
)
->find($accessToken->getIdentifier())
);

// The entity manager has to be cleared manually
// because it doesn't process deep integrity constraints
$em->clear();

/** @var $refreshToken RefreshToken */
$refreshToken = $em
->getRepository(RefreshToken::class)
->findOneBy(
[
'identifier' => $refreshToken->getIdentifier(),
]
)
->find($refreshToken->getIdentifier())
;
$this->assertNotNull($refreshToken);
$this->assertNull($refreshToken->getAccessToken());
Expand Down

0 comments on commit 249795d

Please sign in to comment.