Skip to content

Commit

Permalink
Ajout des bundles dynamiques pour les kernel de test
Browse files Browse the repository at this point in the history
  • Loading branch information
Guillaume DUBOST committed Jan 15, 2019
1 parent fbe28ca commit 264063e
Showing 1 changed file with 28 additions and 3 deletions.
31 changes: 28 additions & 3 deletions src/SymfonyTestKernelContext.php
Original file line number Diff line number Diff line change
Expand Up @@ -27,8 +27,33 @@ class SymfonyTestKernelContext extends BaseContext
*/
public function __construct($bundles = [])
{
$this->test_kernel = null;
$this->bundles = $bundles;
$this->test_kernel = null;
$this->bundles = $bundles;
$this->bundles_to_add = $bundles;
}

/**
* Pour les prochains steps on considerera qu'on ajoute ces bundles
*
* @Given j'utilise les bundles
*/
public function jUtiliseLesBundles(\Behat\Gherkin\Node\PyStringNode $bundles)
{
$bundles = json_decode($bundles->getRaw(), true);
if (null === $bundles) {
throw new \Exception("json_decode error");
}
$this->bundles_to_add = $bundles;
}

/**
* On remet les bundles par défaut
*
* @Given je remet les bundles par défaut
*/
public function jeRemetLesBundlesParDefaut()
{
$this->bundles_to_add = $this->bundles;
}

/**
Expand Down Expand Up @@ -75,7 +100,7 @@ public function shutdown() {
parent::shutdown();
}
};
$this->test_kernel::$additional_bundles = $this->bundles;
$this->test_kernel::$additional_bundles = $this->bundles_to_add;
}

/**
Expand Down

0 comments on commit 264063e

Please sign in to comment.