Révision 5587145e
Ajouté par Assos Assos il y a presque 7 ans
drupal7/modules/aggregator/aggregator.test | ||
---|---|---|
418 | 418 |
} |
419 | 419 |
|
420 | 420 |
/** |
421 |
* Creates a feed and makes sure you can add more than one category to it.
|
|
421 |
* Creates a feed and makes sure you can add/delete categories to it.
|
|
422 | 422 |
*/ |
423 | 423 |
function testCategorizeFeed() { |
424 | 424 |
|
... | ... | |
448 | 448 |
// Assert the feed has two categories. |
449 | 449 |
$this->getFeedCategories($db_feed); |
450 | 450 |
$this->assertEqual(count($db_feed->categories), 2, 'Feed has 2 categories'); |
451 |
|
|
452 |
// Use aggregator_save_feed() to delete a category. |
|
453 |
$category = reset($categories); |
|
454 |
aggregator_save_category(array('cid' => $category->cid)); |
|
455 |
|
|
456 |
// Assert that category is deleted. |
|
457 |
$db_category = db_query("SELECT COUNT(*) FROM {aggregator_category} WHERE cid = :cid", array(':cid' => $category->cid))->fetchField(); |
|
458 |
$this->assertFalse($db_category, format_string('The category %title has been deleted.', array('%title' => $category->title))); |
|
459 |
|
|
460 |
// Assert that category has been removed from feed. |
|
461 |
$categorized_feeds = db_query("SELECT COUNT(*) FROM {aggregator_category_feed} WHERE cid = :cid", array(':cid' => $category->cid))->fetchField(); |
|
462 |
$this->assertFalse($categorized_feeds, format_string('The category %title has been removed from feed %feed_title.', array('%title' => $category->title, '%feed_title' => $feed['title']))); |
|
463 |
|
|
464 |
// Assert that no broken links (associated with the deleted category) |
|
465 |
// appear on one of the other category pages. |
|
466 |
$this->createSampleNodes(); |
|
467 |
$this->drupalGet('admin/config/services/aggregator'); |
|
468 |
$this->clickLink('update items'); |
|
469 |
$categories = $this->getCategories(); |
|
470 |
$category = reset($categories); |
|
471 |
$this->drupalGet('aggregator/categories/' . $category->cid); |
|
472 |
global $base_path; |
|
473 |
$this->assertNoRaw('<a href="' . $base_path . 'aggregator/categories/"></a>,'); |
|
451 | 474 |
} |
475 |
|
|
452 | 476 |
} |
453 | 477 |
|
454 | 478 |
/** |
... | ... | |
685 | 709 |
} |
686 | 710 |
} |
687 | 711 |
|
712 |
// Delete category from feed items when category is deleted. |
|
713 |
$cid = reset($feed->categories); |
|
714 |
$categories = $this->getCategories(); |
|
715 |
$category_title = $categories[$cid]->title; |
|
716 |
|
|
717 |
// Delete category. |
|
718 |
aggregator_save_category(array('cid' => $cid)); |
|
719 |
|
|
720 |
// Assert category has been removed from feed items. |
|
721 |
$categorized_count = db_query("SELECT COUNT(*) FROM {aggregator_category_item} WHERE cid = :cid", array(':cid' => $cid))->fetchField(); |
|
722 |
$this->assertFalse($categorized_count, format_string('The category %title has been removed from feed items.', array('%title' => $category_title))); |
|
688 | 723 |
// Delete feed. |
689 | 724 |
$this->deleteFeed($feed); |
690 | 725 |
} |
726 |
|
|
691 | 727 |
} |
692 | 728 |
|
693 | 729 |
/** |
Formats disponibles : Unified diff
Update to 7.56