1. Go to this page and download the library: Download soulcodex/laravel-behat 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/ */
soulcodex / laravel-behat example snippets
declare(strict_types=1);
namespace App\User\Test\Feature;
use App\User\Domain\UserRepository;
use Soulcodex\Behat\Addon\Context;
final class UserContext extends Context
{
public function __construct(private UserRepository $userRepository)
{
}
/**
* @Given I send a request to :url
*/
public function iSendARequestTo(string $url): void
{
$this->visitUrl($url); // Perform an action using the mink session
}
}
use Soulcodex\Behat\Addon\Context;
final class MyMarvelousContext extends Context
{
/**
* @Given I do a marvelous action in my application
*/
public function iDoAMarvelousActionInMyApp(): void
{
$this->doMarvelousThings();
}
}
$this->visitUrl($url); // Perform GET request to specific URI
$this->session(); // Access to the mink session to perform actions
$this->container(); // Get laravel application container access