buyplaytix / phantomjs-test
Allows PHPUnit to test using PhantomJS.
Installs: 1 468
Dependents: 0
Suggesters: 0
Security: 0
Stars: 8
Watchers: 4
Forks: 0
Open Issues: 0
Requires
- php: >=5.3.2
This package is auto-updated.
Last update: 2024-11-16 04:27:46 UTC
README
Allows PHPUnit to test using PhantomJS.
A Basic Test
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.com/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);
}
}