Skip to content

Commit

Permalink
Fix tests on symfony 3.2
Browse files Browse the repository at this point in the history
  • Loading branch information
chalasr committed Dec 2, 2016
1 parent 8798a76 commit 7e21ffe
Show file tree
Hide file tree
Showing 3 changed files with 43 additions and 3 deletions.
5 changes: 5 additions & 0 deletions Tests/Functional/Bundle/Bundle.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,13 @@

namespace Lexik\Bundle\JWTAuthenticationBundle\Tests\Functional\Bundle;

use Lexik\Bundle\JWTAuthenticationBundle\Tests\Functional\Bundle\DependencyInjection\BundleExtension;
use Symfony\Component\HttpKernel\Bundle\Bundle as BaseBundle;

class Bundle extends BaseBundle
{
public function getContainerExtension()
{
return new BundleExtension();
}
}
35 changes: 35 additions & 0 deletions Tests/Functional/Bundle/DependencyInjection/BundleExtension.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
<?php

namespace Lexik\Bundle\JWTAuthenticationBundle\Tests\Functional\Bundle\DependencyInjection;

use Symfony\Component\DependencyInjection\ContainerBuilder;
use Symfony\Component\DependencyInjection\Extension\PrependExtensionInterface;
use Symfony\Component\HttpKernel\DependencyInjection\Extension;
use Symfony\Component\HttpKernel\Kernel;

class BundleExtension extends Extension implements PrependExtensionInterface
{
/**
* {@inheritdoc}
*/
public function prepend(ContainerBuilder $container)
{
// Annotation must be disabled since this bundle doesn't use Doctrine
// The framework allows enabling/disabling them only since symfony 3.2 where
// doctrine/annotations has been removed from required dependencies
$annotationsEnabled = (int) Kernel::MAJOR_VERSION >= 3 && (int) Kernel::MINOR_VERSION >= 2;

if (!$annotationsEnabled) {
return;
}

$container->prependExtensionConfig('framework', ['annotations' => ['enabled' => false]]);
}

/**
* {@inheritdoc}
*/
public function load(array $configs, ContainerBuilder $container)
{
}
}
6 changes: 3 additions & 3 deletions Tests/Security/Authentication/Provider/JWTProviderTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ public function testSupports()
/**
* test authenticate method with an invalid token.
*
* @expectedException Symfony\Component\Security\Core\Exception\AuthenticationException
* @expectedException \Symfony\Component\Security\Core\Exception\AuthenticationException
* @expectedExceptionMessage Invalid JWT Token
*/
public function testAuthenticateWithInvalidJWT()
Expand All @@ -66,7 +66,7 @@ public function testAuthenticateWithInvalidJWT()
/**
* test authenticate method.
*
* @expectedException Symfony\Component\Security\Core\Exception\AuthenticationException
* @expectedException \Symfony\Component\Security\Core\Exception\AuthenticationException
* @expectedExceptionMessage Invalid JWT Token
*/
public function testAuthenticateWithoutUsername()
Expand All @@ -90,7 +90,7 @@ public function testAuthenticateWithoutUsername()
/**
* test authenticate method.
*
* @expectedException Symfony\Component\Security\Core\Exception\UsernameNotFoundException
* @expectedException \Symfony\Component\Security\Core\Exception\UsernameNotFoundException
*/
public function testAuthenticateWithNotExistingUser()
{
Expand Down

0 comments on commit 7e21ffe

Please sign in to comment.