Skip to content

Navigation Menu

Sign in
Appearance settings
Sign up
Appearance settings

Commit 7fb26f3

Browse filesBrowse the repository at this point in the historyBrowse files
committed
[AccessToken] should fix last failing tests
1 parent 2c14fd2 commit 7fb26f3
Copy full SHA for 7fb26f3

3 files changed

+25-2Lines changed: 25 additions & 2 deletions

File tree

Expand file treeCollapse file tree
Open diff view settings
Filter options
Expand file treeCollapse file tree
Open diff view settings
Collapse file

‎src/Symfony/Bundle/FrameworkBundle/DependencyInjection/Configuration.php‎

Copy file name to clipboardExpand all lines: src/Symfony/Bundle/FrameworkBundle/DependencyInjection/Configuration.php
+4-2Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@
1515
use Psr\Log\LogLevel;
1616
use Seld\JsonLint\JsonParser;
1717
use Symfony\Bundle\FullStack;
18+
use Symfony\Component\AccessToken\CredentialsInterface;
1819
use Symfony\Component\Asset\Package;
1920
use Symfony\Component\AssetMapper\AssetMapper;
2021
use Symfony\Component\Cache\Adapter\DoctrineAdapter;
@@ -156,7 +157,7 @@ public function getConfigTreeBuilder(): TreeBuilder
156157
$this->addRouterSection($rootNode);
157158
$this->addSessionSection($rootNode);
158159
$this->addRequestSection($rootNode);
159-
$this->addAccessTokenSection($rootNode);
160+
$this->addAccessTokenSection($rootNode, $enableIfStandalone);
160161
$this->addAssetsSection($rootNode, $enableIfStandalone);
161162
$this->addAssetMapperSection($rootNode, $enableIfStandalone);
162163
$this->addTranslatorSection($rootNode, $enableIfStandalone);
@@ -723,12 +724,13 @@ private function addRequestSection(ArrayNodeDefinition $rootNode): void
723724
;
724725
}
725726

726-
private function addAccessTokenSection(ArrayNodeDefinition $rootNode): void
727+
private function addAccessTokenSection(ArrayNodeDefinition $rootNode, callable $enableIfStandalone): void
727728
{
728729
$rootNode
729730
->children()
730731
->arrayNode('access_token')
731732
->info('access token manager configuration')
733+
->{$enableIfStandalone('symfony/access-token', CredentialsInterface::class)}()
732734
->canBeEnabled()
733735
->children()
734736
->arrayNode('lock')
Collapse file

‎src/Symfony/Bundle/FrameworkBundle/Tests/DependencyInjection/ConfigurationTest.php‎

Copy file name to clipboardExpand all lines: src/Symfony/Bundle/FrameworkBundle/Tests/DependencyInjection/ConfigurationTest.php
+9Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@
1515
use PHPUnit\Framework\TestCase;
1616
use Symfony\Bundle\FrameworkBundle\DependencyInjection\Configuration;
1717
use Symfony\Bundle\FullStack;
18+
use Symfony\Component\AccessToken\CredentialsInterface;
1819
use Symfony\Component\Cache\Adapter\DoctrineAdapter;
1920
use Symfony\Component\Config\Definition\Exception\InvalidConfigurationException;
2021
use Symfony\Component\Config\Definition\Processor;
@@ -752,6 +753,14 @@ protected static function getBundleDefaultConfig()
752753
'enabled' => false,
753754
'formats' => [],
754755
],
756+
'access_token' => [
757+
'enabled' => !class_exists(FullStack::class) && interface_exists(CredentialsInterface::class),
758+
'lock' => [
759+
'enabled' => true,
760+
'ttl' => 5,
761+
],
762+
'credentials' => [],
763+
],
755764
'assets' => [
756765
'enabled' => !class_exists(FullStack::class),
757766
'version_strategy' => null,
Collapse file

‎src/Symfony/Bundle/FrameworkBundle/Tests/DependencyInjection/FrameworkExtensionTestCase.php‎

Copy file name to clipboardExpand all lines: src/Symfony/Bundle/FrameworkBundle/Tests/DependencyInjection/FrameworkExtensionTestCase.php
+12Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -695,6 +695,10 @@ public function testEmptyRequestFormats()
695695

696696
public function testAccessToken()
697697
{
698+
if (!interface_exists(CredentialsInterface::class)) {
699+
$this->markTestSkipped('AccessToken not available.');
700+
}
701+
698702
$container = $this->createContainerFromFile('access_token');
699703

700704
$this->assertTrue($container->hasDefinition('access_token.manager'));
@@ -711,13 +715,21 @@ public function testAccessToken()
711715

712716
public function testAccessTokenDisabled()
713717
{
718+
if (!interface_exists(CredentialsInterface::class)) {
719+
$this->markTestSkipped('AccessToken not available.');
720+
}
721+
714722
$container = $this->createContainerFromFile('access_token_disabled');
715723

716724
$this->assertFalse($container->hasDefinition('access_token.manager'));
717725
}
718726

719727
public function testAccessTokenNoLock()
720728
{
729+
if (!interface_exists(CredentialsInterface::class)) {
730+
$this->markTestSkipped('AccessToken not available.');
731+
}
732+
721733
$container = $this->createContainerFromFile('access_token_no_lock');
722734

723735
$this->assertTrue($container->hasDefinition('access_token.manager'));

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.