Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -11,4 +11,5 @@ phpunit.xml
.phpunit.result.cache

# Tests
tests/.kernel/
tests/config/reference.php
tests/.var/
2 changes: 1 addition & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@
"phpstan/phpstan": "^2.1",
"phpstan/phpstan-symfony": "^2.0",
"symfony/browser-kit": "^6.4|^7.4|^8.0",
"symfony/phpunit-bridge": "^7.4|^8.0"
"symfony/phpunit-bridge": "^8.1"
},
"conflict": {
"doctrine/doctrine-bundle": "<2.8.0",
Expand Down
4 changes: 1 addition & 3 deletions phpunit.xml.dist
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,8 @@
failOnWarning="true"
>
<php>
<env name="KERNEL_CLASS" value="League\Bundle\OAuth2ServerBundle\Tests\TestKernel" />
<env name="SHELL_VERBOSITY" value="-1" />
<server name="KERNEL_CLASS" value="League\Bundle\OAuth2ServerBundle\Tests\TestKernel" />
<env name="SYMFONY_DEPRECATIONS_HELPER" value="max[self]=0" />
<env name="SYMFONY_PHPUNIT_REMOVE" value="" />
</php>

<testsuites>
Expand Down
23 changes: 1 addition & 22 deletions tests/Acceptance/CustomPersistenceManagerTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -24,11 +24,9 @@
use League\Bundle\OAuth2ServerBundle\Tests\Fixtures\FakeRefreshTokenManager;
use League\Bundle\OAuth2ServerBundle\Tests\Fixtures\FixtureFactory;
use League\Bundle\OAuth2ServerBundle\Tests\TestHelper;
use League\Bundle\OAuth2ServerBundle\Tests\TestKernel;
use League\Bundle\OAuth2ServerBundle\ValueObject\RedirectUri;
use PHPUnit\Framework\MockObject\MockObject;
use Symfony\Bundle\FrameworkBundle\Console\Application;
use Symfony\Component\HttpKernel\KernelInterface;

class CustomPersistenceManagerTest extends AbstractAcceptanceTest
{
Expand All @@ -40,7 +38,7 @@ class CustomPersistenceManagerTest extends AbstractAcceptanceTest

protected function setUp(): void
{
$this->client = self::createClient();
$this->client = self::createClient(['environment' => 'custom_persistence']);
$this->accessTokenManager = $this->createMock(AccessTokenManagerInterface::class);
$this->clientManager = $this->createMock(ClientManagerInterface::class);
$this->refreshTokenManager = $this->createMock(RefreshTokenManagerInterface::class);
Expand Down Expand Up @@ -177,23 +175,4 @@ public function testSuccessfullDeviceCodeRequest(): void
$this->client->getResponse();
static::assertResponseIsSuccessful();
}

protected static function createKernel(array $options = []): KernelInterface
{
return new TestKernel(
'test',
false,
null,
[
'custom' => [
'access_token_manager' => 'test.access_token_manager',
'authorization_code_manager' => 'test.authorization_code_manager',
'client_manager' => 'test.client_manager',
'refresh_token_manager' => 'test.refresh_token_manager',
'credentials_revoker' => 'test.credentials_revoker',
'device_code_manager' => 'test.device_code_manager',
],
]
);
}
}
16 changes: 1 addition & 15 deletions tests/Acceptance/JwtLeewayConfigurationTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,16 +5,14 @@
namespace League\Bundle\OAuth2ServerBundle\Tests\Acceptance;

use League\Bundle\OAuth2ServerBundle\Repository\AccessTokenRepository;
use League\Bundle\OAuth2ServerBundle\Tests\TestKernel;
use League\OAuth2\Server\AuthorizationValidators\BearerTokenValidator;
use Symfony\Bundle\FrameworkBundle\Console\Application;
use Symfony\Component\HttpKernel\KernelInterface;

class JwtLeewayConfigurationTest extends AbstractAcceptanceTest
{
protected function setUp(): void
{
$this->client = self::createClient();
$this->client = self::createClient(['environment' => 'jwt_leeway']);
$this->application = new Application($this->client->getKernel());
}

Expand All @@ -27,16 +25,4 @@ public function testLeewayConfigurationIsSet(): void
$expected = new BearerTokenValidator($tokenRepository, new \DateInterval('PT60S'));
$this->assertEquals($expected, $validator);
}

protected static function createKernel(array $options = []): KernelInterface
{
return new TestKernel(
'test',
false,
[
'public_key' => '%env(PUBLIC_KEY_PATH)%',
'jwt_leeway' => 'PT60S',
]
);
}
}
2 changes: 1 addition & 1 deletion tests/Integration/AuthorizationServerCustomGrantTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ final class AuthorizationServerCustomGrantTest extends KernelTestCase
{
public function testAuthorizationServerHasOurCustomGrantEnabled(): void
{
static::bootKernel();
static::bootKernel(['environment' => 'fake_grant']);

/** @var AuthorizationServer $authorizationServer */
$authorizationServer = self::getContainer()->get(AuthorizationServer::class);
Expand Down
Loading