PHP code example of silverstripe / behat-extension
1. Go to this page and download the library: Download silverstripe/behat-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/ */
silverstripe / behat-extension example snippets
namespace MyModule\Test\Behaviour;
use SilverStripe\BehatExtension\Context\SilverStripeContext;
class FeatureContext extends SilverStripeContext
{
}
use SilverStripe\TestSession\TestsessionEnvironment;
$env = Injector::inst()->get(TestSessionEnvironment::class);
$state = $env->getState();
if (isset($state->session['loggedInAs'])) {
$member = \Member::get()->byID($state->session['loggedInAs']);
} else {
$member = null;
}