phpunit / phpunit-mink-trait
Trait that provides minimal integration layer for using Mink in PHPUnit test cases
Installs: 20 846
Dependents: 0
Suggesters: 0
Security: 0
Stars: 12
Watchers: 2
Forks: 2
Open Issues: 0
Requires
- php: ^7.1
- behat/mink: ^1.7
- behat/mink-goutte-driver: ^1.2
- phpunit/phpunit: ^6.0
This package is not auto-updated.
Last update: 2020-01-24 15:37:33 UTC
README
Trait that provides a minimal integration layer for using Mink (with the Goutte driver) in PHPUnit test cases.
The main goal of this project is to demonstrate how PHPUnit can be extended through traits.
Installation
You can add this library as a local, per-project dependency to your project using Composer:
composer require phpunit/phpunit-mink-trait
If you only need this library during development, for instance to run your project's test suite, then you should add it as a development-time dependency:
composer require --dev phpunit/phpunit-mink-trait
Usage
<?php use PHPUnit\Framework\TestCase; class ExampleTest extends TestCase { use phpunit\mink\TestCaseTrait; public function testHasCorrectTitle() { $page = $this->visit('http://example.com/'); $this->assertContains( 'Example Domain', $page->find('css', 'title')->getHtml() ); } public function testMoreInformationCanBeAccessed() { $page = $this->visit('http://example.com/'); $page->clickLink('More information...'); $this->assertContains( 'IANA', $page->find('css', 'title')->getHtml() ); } }