Skip to content

Add support for Symfony 5 and newer PHP versions #32

New issue

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

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

Already on GitHub? # to your account

Open
wants to merge 4 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
5 changes: 4 additions & 1 deletion .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,9 @@ php:
- 5.6
- 7.0
- 7.1
- 7.2
- 7.3
- 7.4

matrix:
include:
Expand All @@ -18,7 +21,7 @@ before_install:
- if [ "$TRAVIS_PHP_VERSION" == "7.0" ]; then wget https://github.com/php-coveralls/php-coveralls/releases/download/v2.1.0/php-coveralls.phar; fi

install:
- COMPOSER_ROOT_VERSION=dev-master composer update --prefer-source $COMPOSER_FLAGS
- COMPOSER_ROOT_VERSION=dev-master COMPOSER_MEMORY_LIMIT=-1 composer update --prefer-source $COMPOSER_FLAGS

script:
- if [ "$TRAVIS_PHP_VERSION" == "7.0" ]; then php php-cs-fixer.phar fix --dry-run -v; fi
Expand Down
14 changes: 7 additions & 7 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -20,16 +20,16 @@
},
"require": {
"php": ">=5.5.1",
"symfony/framework-bundle": "~2.7|~3.0|~4.0",
"symfony/dependency-injection": "~2.7|~3.0|~4.0",
"symfony/yaml": "~2.7|~3.0|~4.0",
"symfony/framework-bundle": "~2.7|~3.0|~4.0|~5.0",
"symfony/dependency-injection": "~2.7|~3.0|~4.0|~5.0",
"symfony/yaml": "~2.7|~3.0|~4.0|~5.0",
"lightsaml/lightsaml": "~1.1"
},
"require-dev": {
"symfony/browser-kit": "~2.7|~3.0|~4.0",
"symfony/finder": "~2.7|~3.0|~4.0",
"symfony/filesystem": "~2.7|~3.0|~4.0",
"symfony/routing": "~2.7|~3.0|~4.0",
"symfony/browser-kit": "~2.7|~3.0|~4.0|~5.0",
"symfony/finder": "~2.7|~3.0|~4.0|~5.0",
"symfony/filesystem": "~2.7|~3.0|~4.0|~5.0",
"symfony/routing": "~2.7|~3.0|~4.0|~5.0",
"phpunit/phpunit": "^5.7"
},
"config": {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,11 @@ class Configuration implements ConfigurationInterface
*/
public function getConfigTreeBuilder()
{
$treeBuilder = new TreeBuilder();
$root = $treeBuilder->root('light_saml_symfony_bridge');
$treeBuilder = new TreeBuilder('light_saml_symfony_bridge');

$root = method_exists($treeBuilder, 'getRootNode')
? $treeBuilder->getRootNode()
: $treeBuilder->root('light_saml_symfony_bridge');

$root->children()
->arrayNode('own')
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,13 +17,13 @@ class BuildContainerTest extends TestCase
public function test_constructs_with_all_containers()
{
new BuildContainer(
$this->getMockBuilder(SystemContainerInterface::class)->getMock(),
$this->getMockBuilder(PartyContainerInterface::class)->getMock(),
$this->getMockBuilder(StoreContainerInterface::class)->getMock(),
$this->getMockBuilder(ProviderContainerInterface::class)->getMock(),
$this->getMockBuilder(CredentialContainerInterface::class)->getMock(),
$this->getMockBuilder(ServiceContainerInterface::class)->getMock(),
$this->getMockBuilder(OwnContainerInterface::class)->getMock()
$this->prophesize(SystemContainerInterface::class)->reveal(),
$this->prophesize(PartyContainerInterface::class)->reveal(),
$this->prophesize(StoreContainerInterface::class)->reveal(),
$this->prophesize(ProviderContainerInterface::class)->reveal(),
$this->prophesize(CredentialContainerInterface::class)->reveal(),
$this->prophesize(ServiceContainerInterface::class)->reveal(),
$this->prophesize(OwnContainerInterface::class)->reveal()
);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,9 @@ class ProviderContainerTest extends TestCase
public function test_constructs_with_all_arguments()
{
new ProviderContainer(
$this->getMockBuilder(AttributeValueProviderInterface::class)->getMock(),
$this->getMockBuilder(SessionInfoProviderInterface::class)->getMock(),
$this->getMockBuilder(NameIdProviderInterface::class)->getMock()
$this->prophesize(AttributeValueProviderInterface::class)->reveal(),
$this->prophesize(SessionInfoProviderInterface::class)->reveal(),
$this->prophesize(NameIdProviderInterface::class)->reveal()
);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -19,15 +19,15 @@ class ServiceContainerTest extends TestCase
public function test_constructs_with_all_arguments()
{
new ServiceContainer(
$this->getMockBuilder(AssertionValidatorInterface::class)->getMock(),
$this->getMockBuilder(AssertionTimeValidatorInterface::class)->getMock(),
$this->getMockBuilder(SignatureResolverInterface::class)->getMock(),
$this->getMockBuilder(EndpointResolverInterface::class)->getMock(),
$this->getMockBuilder(NameIdValidatorInterface::class)->getMock(),
$this->getMockBuilder(BindingFactoryInterface::class)->getMock(),
$this->getMockBuilder(SignatureValidatorInterface::class)->getMock(),
$this->getMockBuilder(CredentialResolverInterface::class)->getMock(),
$this->getMockBuilder(SessionProcessorInterface::class)->getMock()
$this->prophesize(AssertionValidatorInterface::class)->reveal(),
$this->prophesize(AssertionTimeValidatorInterface::class)->reveal(),
$this->prophesize(SignatureResolverInterface::class)->reveal(),
$this->prophesize(EndpointResolverInterface::class)->reveal(),
$this->prophesize(NameIdValidatorInterface::class)->reveal(),
$this->prophesize(BindingFactoryInterface::class)->reveal(),
$this->prophesize(SignatureValidatorInterface::class)->reveal(),
$this->prophesize(CredentialResolverInterface::class)->reveal(),
$this->prophesize(SessionProcessorInterface::class)->reveal()
);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,9 @@ class StoreContainerTest extends TestCase
public function test_constructs_with_all_arguments()
{
new StoreContainer(
$this->getMockBuilder(RequestStateStoreInterface::class)->getMock(),
$this->getMockBuilder(IdStoreInterface::class)->getMock(),
$this->getMockBuilder(SsoStateStoreInterface::class)->getMock()
$this->prophesize(RequestStateStoreInterface::class)->reveal(),
$this->prophesize(IdStoreInterface::class)->reveal(),
$this->prophesize(SsoStateStoreInterface::class)->reveal()
);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -15,11 +15,11 @@ class SystemContainerTest extends TestCase
public function test_constructs_with_all_arguments()
{
new SystemContainer(
$this->getMockBuilder(RequestStack::class)->getMock(),
$this->getMockBuilder(SessionInterface::class)->getMock(),
$this->getMockBuilder(TimeProviderInterface::class)->getMock(),
$this->getMockBuilder(EventDispatcherInterface::class)->getMock(),
$this->getMockBuilder(LoggerInterface::class)->getMock()
$this->prophesize(RequestStack::class)->reveal(),
$this->prophesize(SessionInterface::class)->reveal(),
$this->prophesize(TimeProviderInterface::class)->reveal(),
$this->prophesize(EventDispatcherInterface::class)->reveal(),
$this->prophesize(LoggerInterface::class)->reveal()
);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
use LightSaml\Store\Credential\CredentialStoreInterface;
use LightSaml\SymfonyBridgeBundle\Factory\OwnEntityDescriptorProviderFactory;
use PHPUnit\Framework\TestCase;
use Prophecy\Argument;
use Symfony\Component\Routing\RouterInterface;

class OwnEntityDescriptorProviderFactoryTest extends TestCase
Expand All @@ -16,26 +17,24 @@ public function test_returns_entity_descriptor_builder()
{
$factory = new OwnEntityDescriptorProviderFactory();

$routerMock = $this->getMockBuilder(RouterInterface::class)->getMock();
$routerMock->expects($this->exactly(2))
->method('generate')
->with($this->isType('string'), [], RouterInterface::ABSOLUTE_URL)
$routerMock = $this->prophesize(RouterInterface::class);
$routerMock->generate(Argument::type('string'), [], RouterInterface::ABSOLUTE_URL)
->shouldBeCalledTimes(2)
->willReturn('http://localhost');

$credentialStoreMock = $this->getMockBuilder(CredentialStoreInterface::class)->getMock();
$credentialStoreMock->method('getByEntityId')
->with($ownEntityId = 'own-id')
->willReturn([$credentialMock = $this->getMockBuilder(X509CredentialInterface::class)->getMock()]);
$credentialStoreMock = $this->prophesize(CredentialStoreInterface::class);
$credentialStoreMock->getByEntityId($ownEntityId = 'own-id')
->willReturn([$credentialMock = $this->prophesize(X509CredentialInterface::class)]);

$credentialMock->method('getCertificate')
->willReturn($this->getMockBuilder(X509Certificate::class)->getMock());
$credentialMock->getCertificate()
->willReturn($this->prophesize(X509Certificate::class));

$value = $factory->build(
$ownEntityId,
$routerMock,
$routerMock->reveal(),
'acs',
'sso',
$credentialStoreMock
$credentialStoreMock->reveal()
);

$this->assertInstanceOf(EntityDescriptorProviderInterface::class, $value);
Expand Down