Skip to content

Commit

Permalink
Clean up testing
Browse files Browse the repository at this point in the history
  • Loading branch information
wouterj committed Dec 29, 2014
1 parent 61f22d7 commit 1d35e48
Showing 1 changed file with 14 additions and 5 deletions.
19 changes: 14 additions & 5 deletions src/Symfony/Component/DomCrawler/Tests/CrawlerTest.php
Expand Up @@ -844,13 +844,22 @@ public function getBaseTagData()
);
}

public function testBaseTagWithForm()
/**
* @dataProvider getBaseTagWithFormData
*/
public function testBaseTagWithForm($baseValue, $actionValue, $expectedUri, $currentUri = null, $description = null)
{
$crawler = new Crawler('<html><base href="/basepath"><form method="post" action="/registration"><button type="submit" name="submit"/></form></html>', 'http://example.com/registration');
$this->assertEquals('http://example.com/registration', $crawler->filterXPath('//button')->form()->getUri());
$crawler = new Crawler('<html><base href="'.$baseValue.'"><form method="post" action="'.$actionValue.'"><button type="submit" name="submit"/></form></html>', $currentUri);
$this->assertEquals($expectedUri, $crawler->filterXPath('//button')->form()->getUri(), $description);
}

$crawler = new Crawler('<html><base href="/basepath"><form method="post"><button type="submit" name="submit"/></form></html>', 'http://example.com/registration');
$this->assertEquals('http://example.com/registration', $crawler->filterXPath('//button')->form()->getUri());
public function getBaseTagWithFormData()
{
return array(
array('/basepath', '/registration', 'http://domain.com/registration', 'http://domain.com/registration', '<base> tag does work with a path and form action'),
array('/basepath', '', 'http://domain.com/registration', 'http://domain.com/registration', '<base> tag does work with a path and empty form action'),
array('http://base.com', '', 'http://domain.com/path/form', 'http://domain.com/path/form', '<base> tag does work with a URL and an empty form action'),
);
}

public function createTestCrawler($uri = null)
Expand Down

0 comments on commit 1d35e48

Please sign in to comment.