Skip to content

Commit

Permalink
fix tests
Browse files Browse the repository at this point in the history
  • Loading branch information
chalasr committed Mar 10, 2024
1 parent 9850d82 commit 40a37f2
Show file tree
Hide file tree
Showing 3 changed files with 28 additions and 0 deletions.
4 changes: 4 additions & 0 deletions tests/Acceptance/CustomPersistenceManagerTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,11 @@
use League\Bundle\OAuth2ServerBundle\Model\Client;
use League\Bundle\OAuth2ServerBundle\Model\RefreshToken;
use League\Bundle\OAuth2ServerBundle\OAuth2Events;
use League\Bundle\OAuth2ServerBundle\Service\CredentialsRevokerInterface;
use League\Bundle\OAuth2ServerBundle\Tests\Fixtures\FakeAccessTokenManager;
use League\Bundle\OAuth2ServerBundle\Tests\Fixtures\FakeAuthorizationCodeManager;
use League\Bundle\OAuth2ServerBundle\Tests\Fixtures\FakeClientManager;
use League\Bundle\OAuth2ServerBundle\Tests\Fixtures\FakeCredentialsRevoker;
use League\Bundle\OAuth2ServerBundle\Tests\Fixtures\FakeRefreshTokenManager;
use League\Bundle\OAuth2ServerBundle\Tests\Fixtures\FixtureFactory;
use League\Bundle\OAuth2ServerBundle\Tests\TestHelper;
Expand Down Expand Up @@ -49,6 +51,7 @@ public function testRegisteredServices(): void
static::assertInstanceOf(FakeAuthorizationCodeManager::class, $this->client->getContainer()->get(AuthorizationCodeManagerInterface::class));
static::assertInstanceOf(FakeClientManager::class, $this->client->getContainer()->get(ClientManagerInterface::class));
static::assertInstanceOf(FakeRefreshTokenManager::class, $this->client->getContainer()->get(RefreshTokenManagerInterface::class));
static::assertInstanceOf(FakeCredentialsRevoker::class, $this->client->getContainer()->get(CredentialsRevokerInterface::class));
}

public function testSuccessfulClientCredentialsRequest(): void
Expand Down Expand Up @@ -162,6 +165,7 @@ protected static function createKernel(array $options = []): KernelInterface
'authorization_code_manager' => 'test.authorization_code_manager',
'client_manager' => 'test.client_manager',
'refresh_token_manager' => 'test.refresh_token_manager',
'credentials_revoker' => 'test.credentials_revoker',
],
]
);
Expand Down
22 changes: 22 additions & 0 deletions tests/Fixtures/FakeCredentialsRevoker.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
<?php

declare(strict_types=1);

namespace League\Bundle\OAuth2ServerBundle\Tests\Fixtures;

use League\Bundle\OAuth2ServerBundle\Manager\RefreshTokenManagerInterface;
use League\Bundle\OAuth2ServerBundle\Model\AbstractClient;
use League\Bundle\OAuth2ServerBundle\Model\RefreshTokenInterface;
use League\Bundle\OAuth2ServerBundle\Service\CredentialsRevokerInterface;
use Symfony\Component\Security\Core\User\UserInterface;

class FakeCredentialsRevoker implements CredentialsRevokerInterface
{
public function revokeCredentialsForClient(AbstractClient $client): void
{
}

public function revokeCredentialsForUser(UserInterface $user): void
{
}
}
2 changes: 2 additions & 0 deletions tests/TestKernel.php
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
use League\Bundle\OAuth2ServerBundle\Tests\Fixtures\FakeAccessTokenManager;
use League\Bundle\OAuth2ServerBundle\Tests\Fixtures\FakeAuthorizationCodeManager;
use League\Bundle\OAuth2ServerBundle\Tests\Fixtures\FakeClientManager;
use League\Bundle\OAuth2ServerBundle\Tests\Fixtures\FakeCredentialsRevoker;
use League\Bundle\OAuth2ServerBundle\Tests\Fixtures\FakeGrant;
use League\Bundle\OAuth2ServerBundle\Tests\Fixtures\FakeRefreshTokenManager;
use League\Bundle\OAuth2ServerBundle\Tests\Fixtures\FixtureFactory;
Expand Down Expand Up @@ -226,6 +227,7 @@ private function configureCustomPersistenceServices(ContainerBuilder $container)
$container->register('test.authorization_code_manager', FakeAuthorizationCodeManager::class)->setPublic(true);
$container->register('test.client_manager', FakeClientManager::class)->setPublic(true);
$container->register('test.refresh_token_manager', FakeRefreshTokenManager::class)->setPublic(true);
$container->register('test.credentials_revoker', FakeCredentialsRevoker::class)->setPublic(true);
}

private function registerFakeGrant(ContainerBuilder $container): void
Expand Down

0 comments on commit 40a37f2

Please sign in to comment.