3 namespace Drupal\Tests\aggregator\Functional;
10 class DeleteFeedTest extends AggregatorTestBase {
17 public static $modules = ['block'];
20 * Deletes a feed and ensures that all of its services are deleted.
22 public function testDeleteFeed() {
23 $feed1 = $this->createFeed();
24 $feed2 = $this->createFeed();
26 // Place a block for both feeds.
27 $block = $this->drupalPlaceBlock('aggregator_feed_block');
28 $block->getPlugin()->setConfigurationValue('feed', $feed1->id());
30 $block2 = $this->drupalPlaceBlock('aggregator_feed_block');
31 $block2->getPlugin()->setConfigurationValue('feed', $feed2->id());
35 $this->deleteFeed($feed1);
36 $this->assertText($feed2->label());
37 $block_storage = $this->container->get('entity.manager')->getStorage('block');
38 $this->assertNull($block_storage->load($block->id()), 'Block for the deleted feed was deleted.');
39 $this->assertEqual($block2->id(), $block_storage->load($block2->id())->id(), 'Block for not deleted feed still exists.');
42 $this->drupalGet('aggregator/sources/' . $feed1->id());
43 $this->assertResponse(404, 'Deleted feed source does not exist.');
45 // Check database for feed.
46 $result = \Drupal::entityQuery('aggregator_feed')->condition('title', $feed1->label())->condition('url', $feed1->getUrl())->count()->execute();
47 $this->assertEquals(0, $result, 'Feed not found in database');