Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- class MyTest extends PHPUnit_Extensions_Selenium2TestCase{
- function setUp(){
- $this->setBrowser("phantomjs");
- $this->setBrowserUrl('http://localhost');
- $this->setHost("127.0.0.1");
- $this->setPort(4444);
- }
- function testForm(){
- $this->url('/test.html');
- $form = $this->byId('login-form');
- $this->assertEquals('/post/login', $this->getRelativeFormAction($form));
- }
- function getRelativeFormAction($form){
- $action = $form->attribute('action');
- $action = str_replace($this->getBaseUrl(), '', $action);
- return $action;
- }
- function getBaseUrl(){
- $urlComponents = parse_url($this->url());
- $url = "{$urlComponents['scheme']}://{$urlComponents['host']}";
- return $url;
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement