friends-of-behat/mink-driver-testsuite
Fork of Mink DriverTestsuite updated for PHP >=7.4, Symfony >=4.4, and PHPUnit ^8.0. Use it to run Mink driver compliance tests with modern Symfony/PHP stacks. Documentation follows the original minkphp/driver-testsuite repo.
Installation Add the package via Composer:
composer require --dev friends-of-behat/mink-driver-testsuite
Ensure your phpunit.xml includes the test suite autoloader:
<autoload>
<classmap>
<dir>vendor/friends-of-behat/mink-driver-testsuite</dir>
</classmap>
</autoload>
First Use Case Use the test suite to validate a custom Mink driver (e.g., Selenium, Guzzle, or a headless browser like Playwright). Example:
use FriendsOfBehat\DriverTestSuite\TestSuite;
$testSuite = new TestSuite();
$testSuite->run(new \Mink\Driver\Selenium2Driver($capabilities));
Run via PHPUnit:
./vendor/bin/phpunit --testsuite DriverTestSuite
Driver Validation
use FriendsOfBehat\DriverTestSuite\TestSuite;
use FriendsOfBehat\DriverTestSuite\Tests\DriverTestCase;
class PlaywrightDriverTest extends DriverTestCase {
protected function createDriver() {
return new \Mink\Driver\PlaywrightDriver();
}
}
CI/CD Hooks
phpunit.xml to run tests on every git push:
<testsuites>
<testsuite name="Driver Tests">
<directory>./vendor/friends-of-behat/mink-driver-testsuite/tests</directory>
</testsuite>
</testsuites>
Custom Test Cases
DriverTestCase to add Laravel-specific assertions (e.g., CSRF token handling):
public function testCsrfTokenHandling() {
$this->getSession()->visit('/login');
$this->assertSession()->fieldEquals('csrf_token', csrf_token());
}
Symfony Dependency
HttpFoundation). If your project lacks them, install via:
composer require symfony/http-foundation
PHPUnit Version Mismatch
^8.0 is installed. Conflicts may arise with Laravel’s default PHPUnit version (e.g., ^9.0). Pin versions in composer.json:
"require-dev": {
"phpunit/phpunit": "^8.5"
}
Driver-Specific Quirks
README.md:
## Driver Setup
- Install ChromeDriver: `brew install chromedriver`
- Configure Selenium in `.env`:
MINK_DRIVER=selenium2
SELENIUM_BROWSER=chrome
-v to diagnose failures:
./vendor/bin/phpunit -v --testsuite DriverTestSuite
DriverTestCase methods to add Laravel-specific logic (e.g., auth checks).<phpunit parallel="true" />
How can I help you explore Laravel packages today?