1 |
41cc1b08
|
Assos Assos
|
<?php
|
2 |
|
|
|
3 |
|
|
/**
|
4 |
|
|
* @file
|
5 |
|
|
* Contains FeedsFileHTTPTestCase.
|
6 |
|
|
*/
|
7 |
|
|
|
8 |
|
|
/**
|
9 |
|
|
* HTTP fetcher test class.
|
10 |
|
|
*/
|
11 |
|
|
class FeedsFileHTTPTestCase extends FeedsWebTestCase {
|
12 |
|
|
public static function getInfo() {
|
13 |
|
|
return array(
|
14 |
|
|
'name' => 'Fetcher: HTTP',
|
15 |
|
|
'description' => 'Tests for file http fetcher plugin.',
|
16 |
|
|
'group' => 'Feeds',
|
17 |
|
|
);
|
18 |
|
|
}
|
19 |
|
|
|
20 |
|
|
/**
|
21 |
|
|
* Test the Feed URL form.
|
22 |
|
|
*/
|
23 |
|
|
public function testFormValidation() {
|
24 |
|
|
// Set up an importer.
|
25 |
|
|
$id = drupal_strtolower($this->randomName());
|
26 |
|
|
$this->createImporterConfiguration($this->randomString(), $id);
|
27 |
|
|
|
28 |
|
|
// Check that by default, we add http:// to the front of the URL.
|
29 |
|
|
$edit = array(
|
30 |
|
|
'feeds[FeedsHTTPFetcher][source]' => 'example.com',
|
31 |
|
|
);
|
32 |
|
|
$this->drupalPost('import/' . $id, $edit, t('Import'));
|
33 |
|
|
$this->assertText(t('There are no new nodes.'));
|
34 |
|
|
$this->assertFieldByName('feeds[FeedsHTTPFetcher][source]', 'http://example.com');
|
35 |
|
|
|
36 |
|
|
$this->setSettings($id, 'FeedsHTTPFetcher', array('auto_scheme' => 'feed'));
|
37 |
|
|
$this->drupalPost('import/' . $id, $edit, t('Import'));
|
38 |
|
|
$this->assertText(t('There are no new nodes.'));
|
39 |
|
|
$this->assertFieldByName('feeds[FeedsHTTPFetcher][source]', 'feed://example.com');
|
40 |
|
|
|
41 |
|
|
$this->setSettings($id, 'FeedsHTTPFetcher', array('auto_scheme' => ''));
|
42 |
|
|
$this->drupalPost('import/' . $id, $edit, t('Import'));
|
43 |
|
|
$this->assertText(t('The URL example.com is invalid.'));
|
44 |
|
|
$this->assertFieldByName('feeds[FeedsHTTPFetcher][source]', 'example.com');
|
45 |
|
|
}
|
46 |
|
|
|
47 |
|
|
} |