phpunit / phpunit-mink-trait
此包已被放弃,不再维护。未建议替代包。
为在PHPUnit测试用例中使用Mink提供最小集成层的Trait
2.0.0
2017-10-12 05:58 UTC
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提供最小集成层,用于在PHPUnit测试用例中使用Mink(使用Goutte驱动程序)。
此项目的主要目标是展示如何通过Trait扩展PHPUnit。
安装
您可以使用Composer将此库添加为本地、项目特定的依赖项到您的项目中
composer require phpunit/phpunit-mink-trait
如果您只需要在开发期间使用此库,例如运行项目的测试套件,那么您应该将其添加为开发时间依赖项
composer require --dev phpunit/phpunit-mink-trait
使用方法
<?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() ); } }