我正在尝试使用PHPUnit和Mink运行集成测试的基本示例
<?php
use aik099\PHPUnit\BrowserTestCase;
class GeneralTest extends BrowserTestCase
{
public static $browsers = array(
array(
'driver' => 'selenium2',
'host' => 'localhost',
'port' => 4444,
'browserName' => 'firefox',
'baseUrl' => 'http://www.google.com',
),
);
public function testUsingSession()
{
// This is Mink's Session.
$session = $this->getSession();
// Go to a page.
$session->visit('http://www.google.com');
// Validate text presence on a page.
$this->assertTrue($session->getPage()->hasContent('Google'));
}
}
这是我的作曲家配置
{
"require": {
"aik099/phpunit-mink": "~2.0"
},
"require-dev": {
"phpunit/phpunit": "^5"
}
}
我正在使用PHP 7.0。
我运行测试时失败。该断言是错误的。这是控制台的输出:
Warning: Declaration of aik099\PHPUnit\BrowserTestCase::onNotSuccessfulTest(Exception $e) should be compatible with PHPUnit_Framework_TestCase::onNotSuccessfulTest($e) in
C:\wamp64\www\app\vendor\aik099\phpunit-mink\library\aik099\PHPUnit\BrowserTestCase.php on line 33
PHPUnit 5.7.27 by Sebastian Bergmann and contributors.
1 / 1 (100%)
Time: 13.78 seconds, Memory: 6.00MB
There were 1 failure:
1) GeneralTest::testUsingSession
Failed asserting that false is true.
我已经浏览了页面的内容:$ session-> getPage()-> getText(),它是空的。
知道我在做什么错吗?
谢谢!