Skip to content
This repository was archived by the owner on Feb 14, 2023. It is now read-only.

Commit 92fa98a

Browse files
committed
Merge pull request #1 from Spomky-Labs/develop
Tests are now executed on PHP5.3
2 parents b7b584e + 240c6c1 commit 92fa98a

File tree

3 files changed

+24
-10
lines changed

3 files changed

+24
-10
lines changed

.travis.yml

+1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
language: php
22

33
php:
4+
- 5.3
45
- 5.4
56
- 5.5
67
- 5.6

Features/bootstrap/SpomkyLabs/RoleHierarchyBundle/Features/Context/FeatureContext.php

+22-7
Original file line numberDiff line numberDiff line change
@@ -2,21 +2,36 @@
22

33
namespace SpomkyLabs\RoleHierarchyBundle\Features\Context;
44

5-
use Behat\Symfony2Extension\Context\KernelDictionary;
6-
use Behat\MinkExtension\Context\MinkContext;
5+
use Behat\Symfony2Extension\Context\KernelAwareContext;
76
use Behat\Behat\Context\SnippetAcceptingContext;
7+
use Behat\MinkExtension\Context\MinkContext;
8+
use Symfony\Component\HttpKernel\KernelInterface;
89
use Symfony\Component\BrowserKit\Cookie;
910
use Symfony\Component\Security\Core\Authentication\Token\UsernamePasswordToken;
1011

1112
/**
1213
* Behat context class.
1314
*/
14-
class FeatureContext extends MinkContext implements SnippetAcceptingContext
15+
class FeatureContext extends MinkContext implements KernelAwareContext, SnippetAcceptingContext
1516
{
16-
use KernelDictionary;
17-
17+
private $kernel;
1818
private $result = null;
1919

20+
public function setKernel(KernelInterface $kernel)
21+
{
22+
$this->kernel = $kernel;
23+
24+
return $this;
25+
}
26+
27+
/**
28+
* @return \Symfony\Component\HttpKernel\KernelInterface
29+
*/
30+
public function getKernel()
31+
{
32+
return $this->kernel;
33+
}
34+
2035
/**
2136
* @Given I am logged in as :username
2237
*/
@@ -26,7 +41,7 @@ public function iAmAnLoggedInAs($username)
2641

2742
$session = $client->getContainer()->get('session');
2843

29-
$user = $this->kernel->getContainer()->get('test_bundle.user_manager')->getUser($username);
44+
$user = $this->getKernel()->getContainer()->get('test_bundle.user_manager')->getUser($username);
3045

3146
$token = new UsernamePasswordToken($user, null, 'main', $user->getRoles());
3247
$session->set('_security_main', serialize($token));
@@ -50,7 +65,7 @@ public function iAmOnThePage($uri)
5065
*/
5166
public function iWantToVerifyIfIsGranted($grant)
5267
{
53-
$this->result = $this->getContainer()->get("security.context")->isGranted($grant);
68+
$this->result = $this->getKernel()->getContainer()->get("security.context")->isGranted($grant);
5469
}
5570

5671
/**

README.md

+1-3
Original file line numberDiff line numberDiff line change
@@ -19,9 +19,7 @@ This version of the bundle requires:
1919
* Symfony 2.3+
2020
* PHP 5.3+
2121

22-
It has been successfully tested using `PHP 5.4` to `PHP 5.6` and `HHVM` under Symfony `2.3` to `2.6`.
23-
24-
Note: PHP 5.3 environment have not been tested but should work (tests only fail because of the use of traits introduced in PHP 5.4).
22+
It has been successfully tested using `PHP 5.3` to `PHP 5.6` and `HHVM` under Symfony `2.3` to `2.6`.
2523

2624
# Installation #
2725

0 commit comments

Comments
 (0)