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