Skip to content
Snippets Groups Projects
Select Git revision
  • 408c540ccf24e71daf6ea02a878b5869abc2f926
  • 11.x default protected
  • 10.5.x protected
  • 10.6.x protected
  • 11.2.x protected
  • 11.1.x protected
  • 10.4.x protected
  • 11.0.x protected
  • 10.3.x protected
  • 7.x protected
  • 10.2.x protected
  • 10.1.x protected
  • 9.5.x protected
  • 10.0.x protected
  • 9.4.x protected
  • 9.3.x protected
  • 9.2.x protected
  • 9.1.x protected
  • 8.9.x protected
  • 9.0.x protected
  • 8.8.x protected
  • 10.5.1 protected
  • 11.2.2 protected
  • 11.2.1 protected
  • 11.2.0 protected
  • 10.5.0 protected
  • 11.2.0-rc2 protected
  • 10.5.0-rc1 protected
  • 11.2.0-rc1 protected
  • 10.4.8 protected
  • 11.1.8 protected
  • 10.5.0-beta1 protected
  • 11.2.0-beta1 protected
  • 11.2.0-alpha1 protected
  • 10.4.7 protected
  • 11.1.7 protected
  • 10.4.6 protected
  • 11.1.6 protected
  • 10.3.14 protected
  • 10.4.5 protected
  • 11.0.13 protected
41 results

DeleteFeedTest.php

Blame
  • Alex Pott's avatar
    Issue #2886622 by Berdir, martin107, Mile23, tim.plunkett, mikelutz,...
    Alex Pott authored
    Issue #2886622 by Berdir, martin107, Mile23, tim.plunkett, mikelutz, jonathan1055: Deprecate all EntityManager methods with E_USER_DEPRECATED
    408c540c
    History
    Code owners
    Assign users and groups as approvers for specific file changes. Learn more.
    DeleteFeedTest.php 1.57 KiB
    <?php
    
    namespace Drupal\Tests\aggregator\Functional;
    
    /**
     * Delete feed test.
     *
     * @group aggregator
     */
    class DeleteFeedTest extends AggregatorTestBase {
    
      /**
       * Modules to install.
       *
       * @var array
       */
      public static $modules = ['block'];
    
      /**
       * Deletes a feed and ensures that all of its services are deleted.
       */
      public function testDeleteFeed() {
        $feed1 = $this->createFeed();
        $feed2 = $this->createFeed();
    
        // Place a block for both feeds.
        $block = $this->drupalPlaceBlock('aggregator_feed_block');
        $block->getPlugin()->setConfigurationValue('feed', $feed1->id());
        $block->save();
        $block2 = $this->drupalPlaceBlock('aggregator_feed_block');
        $block2->getPlugin()->setConfigurationValue('feed', $feed2->id());
        $block2->save();
    
        // Delete feed.
        $this->deleteFeed($feed1);
        $this->assertText($feed2->label());
        $block_storage = $this->container->get('entity_type.manager')->getStorage('block');
        $this->assertNull($block_storage->load($block->id()), 'Block for the deleted feed was deleted.');
        $this->assertEqual($block2->id(), $block_storage->load($block2->id())->id(), 'Block for not deleted feed still exists.');
    
        // Check feed source.
        $this->drupalGet('aggregator/sources/' . $feed1->id());
        $this->assertResponse(404, 'Deleted feed source does not exist.');
    
        // Check database for feed.
        $result = \Drupal::entityQuery('aggregator_feed')->condition('title', $feed1->label())->condition('url', $feed1->getUrl())->count()->execute();
        $this->assertEquals(0, $result, 'Feed not found in database');
      }
    
    }