Projet

Général

Profil

Paste
Télécharger (1,49 ko) Statistiques
| Branche: | Révision:

root / drupal7 / sites / all / modules / feeds / tests / feeds_parser_syndication.test @ 74f6bef0

1
<?php
2

    
3
/**
4
 * @file
5
 * Tests for plugins/FeedsSyndicationParser.inc.
6
 */
7

    
8
/**
9
 * Test single feeds.
10
 */
11
class FeedsSyndicationParserTestCase extends FeedsWebTestCase {
12
  public static function getInfo() {
13
    return array(
14
      'name' => 'Syndication parsers',
15
      'description' => 'Regression tests for syndication parsers Common syndication and SimplePie. Tests parsers against a set of feeds in the context of Feeds module. <strong>Requires SimplePie parser to be configured correctly.</strong>',
16
      'group' => 'Feeds',
17
      'dependencies' => array('libraries'),
18
    );
19
  }
20

    
21
  /**
22
   * Set up test.
23
   */
24
  public function setUp() {
25
    parent::setUp(array('libraries'));
26
  }
27

    
28
  /**
29
   * Run tests.
30
   */
31
  public function test() {
32
    $this->createImporterConfiguration('Syndication', 'syndication');
33

    
34
    foreach (array('FeedsSyndicationParser', 'FeedsSimplePieParser') as $parser) {
35
      $this->setPlugin('syndication', $parser);
36
      foreach ($this->feedUrls() as $url => $assertions) {
37
        $this->createFeedNode('syndication', $url);
38
        $this->assertText('Created ' . $assertions['item_count'] . ' nodes');
39
      }
40
    }
41
  }
42

    
43
  /**
44
   * Return an array of test feeds.
45
   */
46
  protected function feedUrls() {
47
    $path = $GLOBALS['base_url'] . '/' . drupal_get_path('module', 'feeds') . '/tests/feeds/';
48
    return array(
49
      "{$path}developmentseed.rss2" => array(
50
        'item_count' => 10,
51
      ),
52
      "{$path}feed_without_guid.rss2" => array(
53
        'item_count' => 10,
54
      ),
55
    );
56
  }
57
}