diff --git a/.coveralls.yml b/.coveralls.yml
deleted file mode 100644
index 9320fb2..0000000
--- a/.coveralls.yml
+++ /dev/null
@@ -1,3 +0,0 @@
-service_name: travis-ci
-src_dir: ./
-coverage_clover: build/logs/clover.xml
diff --git a/.travis.yml b/.travis.yml
deleted file mode 100644
index d253dd9..0000000
--- a/.travis.yml
+++ /dev/null
@@ -1,25 +0,0 @@
-language: php
-
-php:
- - "7.1"
- - "7.3"
-
-env:
- - SYMFONY_VERSION=3.4.*
- - SYMFONY_VERSION=4.3.*
-
-before_script:
- - composer self-update
- - if [ "$SYMFONY_VERSION" != "" ]; then composer require "symfony/dependency-injection:${SYMFONY_VERSION}" --no-update; fi;
- - if [ "$SYMFONY_VERSION" != "" ]; then composer require "symfony/config:${SYMFONY_VERSION}" --no-update; fi;
- - if [ "$SYMFONY_VERSION" != "" ]; then composer require "symfony/http-kernel:${SYMFONY_VERSION}" --no-update; fi;
- - if [ "$SYMFONY_VERSION" != "" ]; then composer require "symfony/security:${SYMFONY_VERSION}" --no-update; fi;
- - if [ "$SYMFONY_VERSION" != "" ]; then composer require "symfony/event-dispatcher:${SYMFONY_VERSION}" --no-update; fi;
- - composer install --no-scripts --no-interaction --dev
- - composer dump-autoload -o
-
-after_script:
- - php vendor/bin/coveralls -v
-
-script:
- - ./vendor/bin/phpunit --coverage-clover build/logs/clover.xml
diff --git a/Resources/config/services.xml b/Resources/config/services.xml
index e7cec74..f297e83 100644
--- a/Resources/config/services.xml
+++ b/Resources/config/services.xml
@@ -7,6 +7,7 @@
+
diff --git a/Services/Proxy/Impl/UseCaseProxyFactoryImpl.php b/Services/Proxy/Impl/UseCaseProxyFactoryImpl.php
index bff305f..0af9534 100644
--- a/Services/Proxy/Impl/UseCaseProxyFactoryImpl.php
+++ b/Services/Proxy/Impl/UseCaseProxyFactoryImpl.php
@@ -48,7 +48,9 @@ class UseCaseProxyFactoryImpl implements UseCaseProxyFactory
*/
private $builder;
- public function __construct()
+ public function __construct(
+ private readonly AuthorizationCheckerInterface $authorizationChecker
+ )
{
$this->builder = new UseCaseProxyBuilderImpl();
}
@@ -114,15 +116,7 @@ private function buildSecurity(array $tagParameters)
if (isset($tagParameters['security'])) {
$security = $this->container->get($tagParameters['security']);
} else {
- $defaultSecurityContextId = $this->container->getParameter(
- 'openclassrooms.use_case.default_authorization_checker'
- );
- if (!$this->container->has($defaultSecurityContextId)) {
- throw new SecurityIsNotDefinedException('Default security context: \''.$defaultSecurityContextId.'\' is not defined.');
- }
- $security = $this->container->get(
- $this->container->getParameter('openclassrooms.use_case.default_authorization_checker')
- );
+ $security = $this->authorizationChecker;
}
if ($security instanceof AuthorizationCheckerInterface) {
/** @var SecurityFactory $securityFactory */
diff --git a/Tests/DependencyInjection/Fixtures/Resources/config/services.xml b/Tests/DependencyInjection/Fixtures/Resources/config/services.xml
index 8e945b7..f408055 100644
--- a/Tests/DependencyInjection/Fixtures/Resources/config/services.xml
+++ b/Tests/DependencyInjection/Fixtures/Resources/config/services.xml
@@ -16,6 +16,7 @@
OpenClassrooms\Bundle\UseCaseBundle\Tests\DependencyInjection\Fixtures\BusinessRules\UseCases\EventUseCaseStub
+
diff --git a/Tests/DependencyInjection/SecurityOpenClassroomsUseCaseExtensionTest.php b/Tests/DependencyInjection/SecurityOpenClassroomsUseCaseExtensionTest.php
index fd159a6..f911415 100644
--- a/Tests/DependencyInjection/SecurityOpenClassroomsUseCaseExtensionTest.php
+++ b/Tests/DependencyInjection/SecurityOpenClassroomsUseCaseExtensionTest.php
@@ -11,32 +11,6 @@
*/
class SecurityOpenClassroomsUseCaseExtensionTest extends AbstractDependencyInjectionTestCase
{
- /**
- * @test
- */
- public function WithSecurityConfigurationWithoutSecurityContext_SecurityUseCase_ThrowException()
- {
- $this->expectException(SecurityIsNotDefinedException::class);
-
- $this->configLoader->load('SecurityConfiguration.php');
- $this->container->compile();
-
- $this->container->get('openclassrooms.tests.use_cases.configuration_security_use_case_stub');
- }
-
- /**
- * @test
- */
- public function WithDefaultConfigurationWithoutSecurityContext_SecurityUseCase_ThrowException()
- {
- $this->expectException(SecurityIsNotDefinedException::class);
-
- $this->configLoader->load('DefaultConfiguration.php');
- $this->container->compile();
-
- $this->container->get('openclassrooms.tests.use_cases.configuration_security_use_case_stub');
- }
-
/**
* @test
*/