/** * 默认的进行脚本的测试 */ public function testCasperNormal() { foreach ($this->steps as $script) { if (0 !== OpCasper::test($script)) { throw new Exception("找不到casper脚本,路径:{$script}\n"); } } }
public function testOne() { // 不存在的脚本 $casper_return1 = OpCasper::test('tests/not.js'); $this->assertEquals(1, $casper_return1); // 有断言错误的脚本 $casper_return2 = OpCasper::test('tests/error.js'); $this->assertEquals(1, $casper_return2); // 有断言正确的脚本 $casper_return3 = OpCasper::test('tests/ok.js'); $this->assertEquals(0, $casper_return3); }