You are here

function FeedAPIDeleteTestsCase::testFeedAPI_Feed_Delete_By_UI in FeedAPI 6

File

tests/feedapi_delete.test, line 21

Class

FeedAPIDeleteTestsCase
Class for testing FeedAPI feed deleting.

Code

function testFeedAPI_Feed_Delete_By_UI() {
  $parsers = $this
    ->get_parsers();
  foreach ($parsers as $parser) {
    $this
      ->create_type($parser);
    $this
      ->feedapi_user();
    $feed_url = $this
      ->testFileURL('test_feed.rss');
    $edit = array(
      'feedapi[feedapi_url]' => $feed_url,
    );
    $this
      ->drupalPost('node/add/' . $this->info->type, $edit, 'Save');
    $node = db_fetch_object(db_query("SELECT nid FROM {feedapi} WHERE url = '%s'", $feed_url));
    $this
      ->drupalPost("node/{$node->nid}/edit", $edit, t('Delete'));
    $this
      ->assertText(t('This action cannot be undone.'), 'The feed node can be deleted via the user interface.');
    $this
      ->drupalPost("node/{$node->nid}/delete", array(), t('Delete'));
    $nid = db_result(db_query("SELECT nid FROM {feedapi} WHERE url = '%s'", $feed_url));
    $this
      ->assertTrue(empty($nid), 'The feed node is deleted via the user interface.');
  }
}