Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Jjmonagas feature symfony4 support #92

Open
wants to merge 3 commits into
base: master
Choose a base branch
from
Open
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
8 changes: 4 additions & 4 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ env:

cache:
directories:
- $HOME/.composer/cache
- $HOME/.composer/cache

before_install:
- composer self-update
Expand All @@ -33,6 +33,6 @@ script:
- ant test

matrix:
allow_failures:
- env: SYMFONY_VERSION=dev-master
- php: nightly
allow_failures:
- env: SYMFONY_VERSION=dev-master
- php: nightly
12 changes: 6 additions & 6 deletions DependencyInjection/Security/Factory/Factory.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

use Symfony\Component\DependencyInjection\ContainerBuilder;
use Symfony\Component\DependencyInjection\Reference;
use Symfony\Component\DependencyInjection\DefinitionDecorator;
use Symfony\Component\DependencyInjection\ChildDefinition;
use Symfony\Component\Config\Definition\Builder\NodeDefinition;
use Symfony\Bundle\SecurityBundle\DependencyInjection\Security\Factory\SecurityFactoryInterface;

Expand All @@ -17,7 +17,7 @@ public function create(ContainerBuilder $container, $id, $config, $userProviderI
{
$this->encoderId = 'escape_wsse_authentication.encoder.'.$id;

$container->setDefinition($this->encoderId, new DefinitionDecorator('escape_wsse_authentication.encoder'));
$container->setDefinition($this->encoderId, new ChildDefinition('escape_wsse_authentication.encoder'));

if(isset($config['encoder']['algorithm']))
{
Expand All @@ -42,13 +42,13 @@ public function create(ContainerBuilder $container, $id, $config, $userProviderI
{
$this->nonceCacheId = 'escape_wsse_authentication.nonce_cache.'.$id;

$container->setDefinition($this->nonceCacheId, new DefinitionDecorator('escape_wsse_authentication.nonce_cache'));
$container->setDefinition($this->nonceCacheId, new ChildDefinition('escape_wsse_authentication.nonce_cache'));
}

$providerId = 'escape_wsse_authentication.provider.'.$id;

$container
->setDefinition($providerId, new DefinitionDecorator('escape_wsse_authentication.provider'))
->setDefinition($providerId, new ChildDefinition('escape_wsse_authentication.provider'))
->replaceArgument(1, new Reference($userProviderId))
->replaceArgument(2, $id)
->replaceArgument(3, new Reference($this->encoderId))
Expand All @@ -61,7 +61,7 @@ public function create(ContainerBuilder $container, $id, $config, $userProviderI
$listenerId = 'escape_wsse_authentication.listener.'.$id;

$container
->setDefinition($listenerId, new DefinitionDecorator('escape_wsse_authentication.listener'))
->setDefinition($listenerId, new ChildDefinition('escape_wsse_authentication.listener'))
->addArgument($id)
->addArgument(new Reference($entryPointId));

Expand Down Expand Up @@ -115,7 +115,7 @@ protected function createEntryPoint($container, $id, $config, $defaultEntryPoint
$entryPointId = 'escape_wsse_authentication.entry_point.'.$id;

$container
->setDefinition($entryPointId, new DefinitionDecorator('escape_wsse_authentication.entry_point'))
->setDefinition($entryPointId, new ChildDefinition('escape_wsse_authentication.entry_point'))
->replaceArgument(1, $config['realm'])
->replaceArgument(2, $config['profile']);

Expand Down
8 changes: 4 additions & 4 deletions Tests/Security/Core/Authentication/Provider/ProviderTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -70,12 +70,12 @@ private function clearDir()

protected function setUp()
{
$this->userChecker = $this->getMock('Symfony\Component\Security\Core\User\UserCheckerInterface');
$this->userProvider = $this->getMock('Symfony\Component\Security\Core\User\UserProviderInterface');
$this->userChecker = $this->createMock('Symfony\Component\Security\Core\User\UserCheckerInterface');
$this->userProvider = $this->createMock('Symfony\Component\Security\Core\User\UserProviderInterface');
$this->providerKey = 'someproviderkey';
$this->encoder = new MessageDigestPasswordEncoder('sha1', true, 1);
$this->nonceCache = new PhpFileCache(self::$nonceDir);
$this->user = $this->getMock('Symfony\Component\Security\Core\User\UserInterface');
$this->user = $this->createMock('Symfony\Component\Security\Core\User\UserInterface');

$this->clearDir();
}
Expand Down Expand Up @@ -104,7 +104,7 @@ public function providerSupports()
return array(
array($tokenWithoutAttributes, false),
array($tokenWithAttributes, true),
array($this->getMock('Symfony\Component\Security\Core\Authentication\Token\TokenInterface'), false)
array($this->createMock('Symfony\Component\Security\Core\Authentication\Token\TokenInterface'), false)
);
}

Expand Down
8 changes: 4 additions & 4 deletions Tests/Security/Http/EntryPoint/EntryPointTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,8 @@ protected function setUp()

public function testStart()
{
$logger = $this->getMock('Psr\Log\LoggerInterface');
$request = $this->getMock('Symfony\Component\HttpFoundation\Request');
$logger = $this->createMock('Psr\Log\LoggerInterface');
$request = $this->createMock('Symfony\Component\HttpFoundation\Request');
$realm = 'TheRealm';
$profile = 'TheProfile';

Expand All @@ -47,8 +47,8 @@ public function testStart()

public function testStartWithNoException()
{
$logger = $this->getMock('Psr\Log\LoggerInterface');
$request = $this->getMock('Symfony\Component\HttpFoundation\Request');
$logger = $this->createMock('Psr\Log\LoggerInterface');
$request = $this->createMock('Symfony\Component\HttpFoundation\Request');
$realm = 'TheRealm';
$profile = 'TheProfile';

Expand Down
10 changes: 5 additions & 5 deletions Tests/Security/Http/Firewall/ListenerTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -42,14 +42,14 @@ protected function setUp()

if (interface_exists('Symfony\Component\Security\Core\Authentication\Token\Storage\TokenStorageInterface')) {
// TokenStorageInterface for SF >=2.7
$this->securityContext = $this->getMock('Symfony\Component\Security\Core\Authentication\Token\Storage\TokenStorageInterface');
$this->securityContext = $this->createMock('Symfony\Component\Security\Core\Authentication\Token\Storage\TokenStorageInterface');
} else {
// SecurityContextInterface for SF <2.6
$this->securityContext = $this->getMock('Symfony\Component\Security\Core\SecurityContextInterface');
$this->securityContext = $this->createMock('Symfony\Component\Security\Core\SecurityContextInterface');
}

$this->authenticationManager = $this->getMock('Symfony\Component\Security\Core\Authentication\AuthenticationManagerInterface');
$this->authenticationEntryPoint = $this->getMock('Symfony\Component\Security\Http\EntryPoint\AuthenticationEntryPointInterface');
$this->authenticationManager = $this->createMock('Symfony\Component\Security\Core\Authentication\AuthenticationManagerInterface');
$this->authenticationEntryPoint = $this->createMock('Symfony\Component\Security\Http\EntryPoint\AuthenticationEntryPointInterface');
}

/**
Expand All @@ -61,7 +61,7 @@ public function handleReturnToken()
$token->setAttribute('nonce','somenonce');
$token->setAttribute('created','2010-12-12 20:00:00');

$tokenMock2 = $this->getMock('Symfony\Component\Security\Core\Authentication\Token\TokenInterface');
$tokenMock2 = $this->createMock('Symfony\Component\Security\Core\Authentication\Token\TokenInterface');
$this->authenticationManager->expects($this->once())->method('authenticate')->with($token)->will($this->returnValue($tokenMock2));
$this->securityContext->expects($this->once())->method('setToken')->with($tokenMock2);
$this->request->headers->add(array('X-WSSE'=>'UsernameToken Username="someuser", PasswordDigest="somedigest", Nonce="somenonce", Created="2010-12-12 20:00:00"'));
Expand Down
2 changes: 1 addition & 1 deletion Tests/bootstrap.php
Original file line number Diff line number Diff line change
Expand Up @@ -10,4 +10,4 @@
require_once $file;

// disable the deprecation warnings
PHPUnit_Framework_Error_Deprecated::$enabled = FALSE;
//PHPUnit_Framework_Error_Deprecated::$enabled = FALSE;
10 changes: 5 additions & 5 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -17,14 +17,14 @@
],
"minimum-stability": "dev",
"require": {
"php": ">=5.3.9",
"symfony/framework-bundle": "~2.3|~3.0",
"symfony/security-bundle": "~2.3|~3.0",
"php": ">=5.3.9 || ^7.0",
"symfony/framework-bundle": "~2.3 || ~3.0 || ^4.0",
"symfony/security-bundle": "~2.3 || ~3.0 || ^4.0",
"doctrine/common": "~2.2"
},
"require-dev": {
"symfony/finder": "~2.3|~3.0",
"symfony/phpunit-bridge": "~2.7|~3.0"
"symfony/finder": "~2.3 || ~3.0",
"symfony/phpunit-bridge": "~2.7 || ~3.0 || ^4.0"
},
"autoload": {
"psr-0": { "Escape\\WSSEAuthenticationBundle": "" }
Expand Down