Skip to content

Commit

Permalink
Reduce deprecations spotted in newer Symfony
Browse files Browse the repository at this point in the history
  • Loading branch information
stloyd committed Aug 26, 2023
1 parent 0732506 commit fb4d1c2
Show file tree
Hide file tree
Showing 6 changed files with 105 additions and 59 deletions.
4 changes: 2 additions & 2 deletions phpunit.xml.dist
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,8 @@
</coverage>

<php>
<!-- Allowing 14 deprecations related to changes in Symfony AbstractController 5.4+ -->
<env name="SYMFONY_DEPRECATIONS_HELPER" value="max[direct]=14"/>
<!-- Allowing 1 deprecation related to changes in Symfony AbstractController 5.4+ -->
<env name="SYMFONY_DEPRECATIONS_HELPER" value="max[direct]=1"/>
<env name="KERNEL_CLASS" value="HWI\Bundle\OAuthBundle\Tests\App\AppKernel"/>
</php>

Expand Down
5 changes: 2 additions & 3 deletions tests/App/AppKernel.php
Original file line number Diff line number Diff line change
Expand Up @@ -41,18 +41,17 @@ public function registerBundles(): array

public function registerContainerConfiguration(LoaderInterface $loader): void
{
$loader->load(__DIR__.'/config/config.yaml');

if (Kernel::VERSION_ID >= 60000) {
$loader->load(__DIR__.'/config/config_v6.yaml');
$loader->load(__DIR__.'/config/security_v6.yaml');
} elseif (Kernel::VERSION_ID >= 50100 && Kernel::VERSION_ID < 59999) {
$loader->load(__DIR__.'/config/config_v5.yaml');
if (0 === (int) getenv('USE_NEW_SYMFONY_SECURITY')) {
$loader->load(__DIR__.'/config/security_v5_bc.yaml');
} else {
$loader->load(__DIR__.'/config/security_v5.yaml');
}
} else {
$loader->load(__DIR__.'/config/security_v4.yaml');
}
}

Expand Down
File renamed without changes.
101 changes: 101 additions & 0 deletions tests/App/config/config_v6.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,101 @@
framework:
test: ~
secret: secret
router:
utf8: true
resource: "%kernel.project_dir%/../App/config/routing.yaml"
translator: ~
form:
enabled: true
csrf_protection: ~
session:
handler_id: 'session.handler.native'
http_method_override: false

monolog:
handlers:
main:
type: stream
path: "%kernel.logs_dir%/%kernel.environment%.log"
level: debug

services:
_defaults:
autowire: true
autoconfigure: true

HWI\Bundle\OAuthBundle\Tests\App\Controller\HomeController:
tags:
- controller.service_arguments

HWI\Bundle\OAuthBundle\Tests\App\Form\RegistrationFormHandler: ~
HWI\Bundle\OAuthBundle\Tests\App\Form\RegistrationFormType: ~
HWI\Bundle\OAuthBundle\Tests\App\UserProvider: ~

# Must be "public" to allow replacing it with mock client
hwi_oauth.http_client:
class: Symfony\Contracts\HttpClient\HttpClientInterface
public: true

app.oauth2_resource_owner:
class: HWI\Bundle\OAuthBundle\Tests\App\ResourceOwner\OAuth2ResourceOwner
arguments:
$options: {
access_token_url: 'http://custom/token',
authorization_url: 'http://custom/auth',
infos_url: 'http://custom/info',
client_id: 'client_id',
client_secret: 'client_secret',
}
$name: 'custom'
$storage: '@hwi_oauth.storage.session'

doctrine:
dbal:
driver: pdo_sqlite
url: 'sqlite:///:memory:'
orm:
auto_generate_proxy_classes: '%kernel.debug%'
auto_mapping: true

hwi_oauth:
connect:
confirmation: true
account_connector: HWI\Bundle\OAuthBundle\Tests\App\UserProvider
registration_form_handler: HWI\Bundle\OAuthBundle\Tests\App\Form\RegistrationFormHandler
registration_form: HWI\Bundle\OAuthBundle\Tests\App\Form\RegistrationFormType
resource_owners:
google:
type: google
client_id: 'google_client_id'
client_secret: 'google_client_secret'
scope: 'https://www.googleapis.com/auth/userinfo.email https://www.googleapis.com/auth/userinfo.profile'
yahoo:
type: yahoo
client_id: 'yahoo_client_id'
client_secret: 'yahoo_client_secret'
scope: 'scope=mail-r sdct-r'
options:
refresh_on_expire: true
oauth2:
service: 'app.oauth2_resource_owner'
oauth1:
class: 'HWI\Bundle\OAuthBundle\Tests\App\ResourceOwner\OAuth1ResourceOwner'
client_id: "fake_client_id"
client_secret: "fake_client_secret"
options:
access_token_url: 'http://localhost/token'
authorization_url: 'http://localhost/auth'
infos_url: 'http://localhost/info'
request_token_url: 'http://localhost/request-token'
custom:
class: 'HWI\Bundle\OAuthBundle\Tests\App\ResourceOwner\CustomResourceOwner'
client_id: "fake_client_id"
client_secret: "fake_client_secret"
base_url: "http://localhost/"

twig:
strict_variables: '%kernel.debug%'
exception_controller: ~
paths:
'%kernel.project_dir%/templates': 'Acme'
52 changes: 0 additions & 52 deletions tests/App/config/security_v4.yaml

This file was deleted.

2 changes: 0 additions & 2 deletions tests/App/config/security_v6.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,6 @@ security:
HWI\Bundle\OAuthBundle\Tests\App\UserProvider:
id: HWI\Bundle\OAuthBundle\Tests\App\UserProvider

enable_authenticator_manager: true

firewalls:
api:
pattern: ^/api/
Expand Down

0 comments on commit fb4d1c2

Please sign in to comment.