Skip to content

Commit 1d35e48

Browse files
committed
Clean up testing
1 parent 61f22d7 commit 1d35e48

File tree

1 file changed

+14
-5
lines changed

1 file changed

+14
-5
lines changed

src/Symfony/Component/DomCrawler/Tests/CrawlerTest.php

Lines changed: 14 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -844,13 +844,22 @@ public function getBaseTagData()
844844
);
845845
}
846846

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

852-
$crawler = new Crawler('<html><base href="/basepath"><form method="post"><button type="submit" name="submit"/></form></html>', 'http://example.com/registration');
853-
$this->assertEquals('http://example.com/registration', $crawler->filterXPath('//button')->form()->getUri());
856+
public function getBaseTagWithFormData()
857+
{
858+
return array(
859+
array('/basepath', '/registration', 'http://domain.com/registration', 'http://domain.com/registration', '<base> tag does work with a path and form action'),
860+
array('/basepath', '', 'http://domain.com/registration', 'http://domain.com/registration', '<base> tag does work with a path and empty form action'),
861+
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'),
862+
);
854863
}
855864

856865
public function createTestCrawler($uri = null)

0 commit comments

Comments
 (0)