Stripping CVS keywords
[project/feeds.git] / feeds_fast_news / feeds_fast_news.test
1 <?php
2
3 /**
4 * @file
5 * Tests for feeds_fast_news feature.
6 */
7
8 // Require FeedsWebTestCase class definition.
9 require_once(dirname(__FILE__) .'/../tests/feeds.test.inc');
10
11 /**
12 * Test Feed fast configuration.
13 */
14 class FeedsExamplesFastFeedTestCase extends FeedsWebTestCase {
15
16 /**
17 * Set up test.
18 */
19 public function setUp() {
20 parent::setUp('feeds', 'feeds_ui', 'ctools', 'job_scheduler', 'features', 'feeds_fast_news', 'data', 'data_ui', 'views', 'views_ui');
21
22 $this->drupalLogin(
23 $this->drupalCreateUser(
24 array(
25 'administer feeds', 'administer nodes', 'administer data tables',
26 )
27 )
28 );
29 }
30
31 /**
32 * Describe this test.
33 */
34 public function getInfo() {
35 return array(
36 'name' => t('Feature: Fast feed'),
37 'description' => t('Test "Fast feed" default configuration <strong>Requires Data, Features and Views.</strong>'),
38 'group' => t('Feeds'),
39 );
40 }
41
42 /**
43 * Run tests.
44 */
45 public function test() {
46
47 // Enable configuration and assert status.
48 $this->drupalGet('admin/build/data');
49 $this->assertText('feeds_data_feed_fast');
50 $this->drupalGet('admin/content/data/view/feeds_data_feed_fast');
51 $this->assertText('Fast feed');
52 $this->assertText('There is no data in this table.');
53
54 // Create feed node.
55 $nid = $this->createFeedNode('feed_fast', NULL, '', 'feed_fast');
56 $this->assertText('Created 10 items.');
57
58 // Verify presence of aggregated items.
59 $this->drupalGet('admin/content/data/view/feeds_data_feed_fast');
60 $this->assertText('Open Atrium Translation Workflow: Two Way Translation Updates');
61 $this->assertText('n a word, nothing. There has been a major improvement on this front. Now your translation');
62 $this->assertLink('http://developmentseed.org/blog/2009/oct/06/open-atrium-translation-workflow-two-way-updating');
63
64 // Delete and re import.
65 $this->drupalPost('node/'. $nid .'/delete-items', array(), 'Delete');
66 $this->assertText('All items have been deleted.');
67 $count = db_result(db_query("SELECT COUNT(*) FROM {feeds_data_feed_fast}"));
68 $this->assertEqual($count, 0, 'Found correct number of items.');
69
70 $this->drupalPost('node/'. $nid .'/delete-items', array(), 'Delete');
71 $this->assertText('There were no items to delete.');
72 $count = db_result(db_query("SELECT COUNT(*) FROM {feeds_data_feed_fast}"));
73 $this->assertEqual($count, 0, 'Found correct number of items.');
74
75 $this->drupalPost('node/'. $nid .'/import', array(), 'Import');
76 $this->assertText('Created 10 items.');
77 $count = db_result(db_query("SELECT COUNT(*) FROM {feeds_data_feed_fast}"));
78 $this->assertEqual($count, 10, 'Found correct number of items.');
79
80 $this->drupalPost('node/'. $nid .'/import', array(), 'Import');
81 $this->assertText('There are no new items.');
82 $count = db_result(db_query("SELECT COUNT(*) FROM {feeds_data_feed_fast}"));
83 $this->assertEqual($count, 10, 'Found correct number of items.');
84 }
85 }