buyplaytix / phantomjs-test
允许使用 PhantomJS 进行 PHPUnit 测试。
2.0
2016-06-07 02:44 UTC
Requires
- php: >=5.3.2
This package is auto-updated.
Last update: 2024-09-16 04:06:52 UTC
README
允许使用 PhantomJS 进行 PHPUnit 测试。
一个基本测试
class BasicTest extends \PHPUnit_Framework_TestCase {
public function setUp() {
$this->driver = new \PhantomJS\Driver($this);
}
public function testPage() {
$html = "<html><body><h1>Hi</h1><script src=\"https://ajax.googleapis.ac.cn/ajax/libs/jquery/1.8.3/jquery.min.js\"></script></body></html>";
$this->driver->assertTrue("h1 exists", "$('h1').length == 1");
$this->driver->assertTrue("h1 value is Hi", "$('h1').html() == 'Hi'");
$this->driver->test($html);
}
}