예제 #1
0
 public function testGoodMaxSize()
 {
     $testCase = new Size();
     $testCase->init(null, 10);
     $response = new MockUp();
     $response->setBody('<body>');
     $testCase->test($response, Symfony::create(new Uri('http://www.example.com/')));
 }
예제 #2
0
 public function testTextNotFound()
 {
     $testCase = new TextNotPresent();
     $testCase->init('abc');
     $response = new MockUp();
     $response->setBody('bcdefg');
     $testCase->test($response, Symfony::create(new Uri('http://www.example.com/')));
 }
예제 #3
0
 public function testTextNotFound()
 {
     $testCase = new TextPresent();
     $testCase->init('abc');
     $response = new MockUp();
     $response->setBody('bcdefg');
     $this->setExpectedException('LiveTest\\TestCase\\Exception');
     $testCase->test($response, Symfony::create(new Uri('http://www.example.com/')));
 }
예제 #4
0
 public function testInvalidValidatorReponseRaisesException()
 {
     $testCase = new ValidMarkup();
     $testCase->init();
     $response = new MockUp();
     $response->setBody("no valid validator reponse at all");
     $this->setExpectedException('LiveTest\\TestCase\\Exception');
     $testCase->test($response, Symfony::create(new Uri('http://www.example.com/')));
 }
예제 #5
0
 public function testXPathInvalidXPath()
 {
     $testCase = new XPath();
     $testCase->init('\\bla', '/^titleBla$/');
     $response = new MockUp();
     $response->setBody('<html><head><title>titleBla</title></head></html>');
     $this->setExpectedException('LiveTest\\TestCase\\Exception');
     $testCase->test($response, Symfony::create(new Uri('http://www.example.com/')));
 }
예제 #6
0
 public function testCaseTest()
 {
     $stub = $this->getMockForAbstractClass('\\LiveTest\\TestCase\\General\\Html\\TestCase');
     $stub->expects($this->any())->method('runTest')->will($this->returnValue(TRUE));
     $response = new MockUp();
     $response->setBody('<html></html>');
     $request = Symfony::create(new Uri('http://www.example.com/'), 'get', array());
     $stub->test($response, $request);
     $this->assertEquals($request->getUri(), $stub->getRequest()->getUri());
 }
 public function testHandleResultLogStatuses()
 {
     $this->listener->init(__DIR__ . DIRECTORY_SEPARATOR . $this->logPath, array(Result::STATUS_SUCCESS));
     $test = new Test('', '');
     $response = new MockUp();
     $response->setStatus(200);
     $response->setBody('<body></body>');
     $result = new Result($test, Result::STATUS_FAILED, '', Request::create(new Uri('http://www.example.com')), new MockUp(), 'mySession');
     $this->listener->handleResult($result, $response);
     $this->assertFalse(file_exists($this->logPath . '/' . $this->createdFile));
 }
예제 #8
0
 public function testAnOtherRegExNotFound()
 {
     $testCase = new RegExNotPresent();
     $testCase->init('@^database.*error$@');
     $response = new MockUp();
     $response->setBody('database connection error');
     $this->setExpectedException('LiveTest\\TestCase\\Exception');
     $testCase->test($response, Symfony::create(new Uri('http://www.example.com/')));
     $response->setBody('database connection established');
     $testCase->test($response, Symfony::create(new Uri('http://www.example.com/')));
 }