public function FeedsEnclosureTest::testUrlParseError in Feeds 7.2
Tests getting content from an URL that failed to parse.
See also
::getUrlParseErrorDataProvider()
File
- tests/
FeedsEnclosureTest.test, line 25
Class
- FeedsEnclosureTest
- @coversDefaultClass FeedsEnclosure @group feeds
Code
public function testUrlParseError() {
foreach ($this
->getUrlParseErrorDataProvider() as $testdata) {
$e = NULL;
$vars = $testdata['vars'] + array(
'@url' => $testdata['url'],
);
// Create a new enclosure.
$enclosure = new FeedsEnclosure($testdata['url'], 'text/plain');
try {
// The enclosure will try to download the content via HTTP.
$enclosure
->getContent();
} catch (Exception $e) {
$this
->pass(format_string("Exception thrown on url '@url'.", $vars));
$this
->assertEqual(format_string($testdata['error'], $vars), $e
->getMessage());
}
if (!isset($e)) {
$this
->fail(format_string("Exception thrown on url '@url'.", $vars));
}
}
}