1. Go to this page and download the library: Download yoanm/behat-utils-extension 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/ */
yoanm / behat-utils-extension example snippets
namespace Functional\Yoanm\BehatUtilsExtension\Context;
use Behat\Behat\Context\Context;
use Psr\Log\LoggerInterface;
use Yoanm\BehatUtilsExtension\Context\LoggerAwareInterface;
class FeatureContext implements Context, LoggerAwareInterface
{
/** @var LoggerInterface */
private $logger;
/**
* {@inheritdoc}
*/
public function setBehatLogger(LoggerInterface $logger)
{
$this->logger = $logger;
}
/**
* @When my step
*/
public function myStep()
{
$this->logger->info('Executing my step');
}
}
namespace Functional\Yoanm\BehatUtilsExtension\Context;
use Behat\Behat\Context\Context;
use Behat\Behat\EventDispatcher\Event\ExampleTested;
use Behat\Behat\EventDispatcher\Event\GherkinNodeTested;
use Behat\Behat\EventDispatcher\Event\ScenarioTested;
use Yoanm\BehatUtilsExtension\Context\BehatContextSubscriberInterface;
class FeatureContext implements Context, BehatContextSubscriberInterface
{
/**
* @param GherkinNodeTested $event
*/
public function reset(GherkinNodeTested $event)
{
/**
* Reset here your data before a scenario or example is started
*/
}
/**
* {@inheritdoc}
*/
public static function getSubscribedEvents()
{
return [
ScenarioTested::BEFORE => ['reset'],
ExampleTested::BEFORE => ['reset'],
//Or
// ScenarioTested::BEFORE => ['reset', ListenerPriority::HIGH_PRIORITY],
];
}
}
Loading please wait ...
Before you can download the PHP files, the dependencies should be resolved. This can take some minutes. Please be patient.