PHP code example of filipgolonka / symfony-behat-debug-bundle
1. Go to this page and download the library: Download filipgolonka/symfony-behat-debug-bundle library. Choose the download type require. 2. Extract the ZIP file and open the index.php. 3. Add this code to the index.php.
<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
filipgolonka / symfony-behat-debug-bundle example snippets
// app/AppKernel.php
class AppKernel extends Kernel
{
public function registerBundles()
{
if ($this->getEnvironment == 'test') {
$bundles = array(
// ...
new FilipGolonka\SymfonyBehatDebugBundle\FilipGolonkaSymfonyBehatDebugBundle(),
);
// ...
}
}
}
namespace AppBundle;
use Behat\Symfony2Extension\Context\KernelAwareContext;
use Behat\Symfony2Extension\Context\KernelDictionary;
class DataContext implements KernelAwareContext
{
use KernelDictionary;
/**
* @Then test difference formatting
*/
public function testDifferenceFormatting()
{
$expectedContent = ['foo' => 'bar'];
$actualContent = ['baz' => 'bat'];
if ($expectedContent != $actualContent) {
throw new \Exception(
$this->getContainer()->get('behat_debug.formatter')->format(
$this->getContainer()->get('behat_debug.differ')->compare($expectedContent, $actualContent)
)
);
}
}
}