Skip to content
This repository was archived by the owner on Sep 16, 2021. It is now read-only.

Commit 9f02933

Browse files
committed
Made behat tests more stable
1 parent bdc0511 commit 9f02933

File tree

5 files changed

+14
-6
lines changed

5 files changed

+14
-6
lines changed

Tests/Features/resource_api_phpcr.feature

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ Feature: Request Resources from the REST API
1010
repository:
1111
doctrine_phpcr:
1212
phpcr_repo:
13-
basepath: /tests/cmf/articles
13+
basepath: /tests/cmf/articles
1414
1515
1616

Tests/Features/resource_api_phpcr_odm.feature

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ Feature: Request Resources from the REST API
1313
basepath: /tests/cmf/articles
1414
1515
cmf_resource_rest:
16-
payload_alias:
16+
payload_alias_map:
1717
article: { repository: doctrine_phpcr_odm, type: "Symfony\Cmf\Bundle\ResourceRestBundle\Tests\Resources\TestBundle\Document\Article" }
1818
"""
1919

Tests/Resources/app/AppKernel.php

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,12 +2,19 @@
22

33
use Symfony\Cmf\Component\Testing\HttpKernel\TestKernel;
44
use Symfony\Component\Config\Loader\LoaderInterface;
5+
use Symfony\Cmf\Bundle\ResourceRestBundle\Tests\Features\Context\ResourceContext;
56

67
/**
78
* This is the kernel used by the application being tested
89
*/
910
class AppKernel extends TestKernel
1011
{
12+
private $configPath;
13+
14+
public function setConfig($configPath)
15+
{
16+
$this->config = $configPath;
17+
}
1118
public function configure()
1219
{
1320
$this->requireBundleSets(array(
@@ -26,5 +33,9 @@ public function configure()
2633
public function registerContainerConfiguration(LoaderInterface $loader)
2734
{
2835
$loader->load(__DIR__.'/config/config.php');
36+
37+
if ($this->getEnvironment() !== 'behat') {
38+
$loader->import(ResourceContext::getConfigurationFile());
39+
}
2940
}
3041
}

Tests/Resources/app/config/config.php

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,3 @@
88
$loader->import(CMF_TEST_CONFIG_DIR.'/dist/monolog.yml');
99
$loader->import(CMF_TEST_CONFIG_DIR.'/dist/doctrine.yml');
1010
$loader->import(CMF_TEST_CONFIG_DIR.'/phpcr_odm.php');
11-
12-
if (file_exists(ResourceContext::getConfigurationFile())) {
13-
$loader->import(ResourceContext::getConfigurationFile());
14-
}

behat.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ default:
1010
Behat\Symfony2Extension:
1111
kernel:
1212
path: Tests/Resources/app/AppKernel.php
13+
env: behat
1314
bootstrap: vendor/symfony-cmf/testing/bootstrap/bootstrap.php
1415
Behat\WebApiExtension:
1516
base_url: http://localhost:8000/

0 commit comments

Comments
 (0)