class DeleteFeedTest
Same name and namespace in other branches
- 8.9.x core/modules/aggregator/tests/src/Functional/DeleteFeedTest.php \Drupal\Tests\aggregator\Functional\DeleteFeedTest
Delete feed test.
@group aggregator @group legacy
Hierarchy
- class \Drupal\Tests\BrowserTestBase uses \Drupal\Core\Test\FunctionalTestSetupTrait, \Drupal\Tests\UiHelperTrait, \Drupal\Core\Test\TestSetupTrait, \Drupal\Tests\block\Traits\BlockCreationTrait, \Drupal\FunctionalTests\AssertLegacyTrait, \Drupal\Tests\RandomGeneratorTrait, \Drupal\Tests\node\Traits\NodeCreationTrait, \Drupal\Tests\node\Traits\ContentTypeCreationTrait, \Drupal\Tests\ConfigTestTrait, \Drupal\Tests\TestRequirementsTrait, \Drupal\Tests\user\Traits\UserCreationTrait, \Drupal\Tests\XdebugRequestTrait, \Drupal\Tests\Traits\PhpUnitWarnings, \Drupal\Tests\PhpUnitCompatibilityTrait, \Symfony\Bridge\PhpUnit\ExpectDeprecationTrait, \Drupal\Tests\ExtensionListTestTrait extends \PHPUnit\Framework\TestCase
- class \Drupal\Tests\aggregator\Functional\AggregatorTestBase extends \Drupal\Tests\BrowserTestBase
- class \Drupal\Tests\aggregator\Functional\DeleteFeedTest extends \Drupal\Tests\aggregator\Functional\AggregatorTestBase
- class \Drupal\Tests\aggregator\Functional\AggregatorTestBase extends \Drupal\Tests\BrowserTestBase
Expanded class hierarchy of DeleteFeedTest
File
-
core/
modules/ aggregator/ tests/ src/ Functional/ DeleteFeedTest.php, line 11
Namespace
Drupal\Tests\aggregator\FunctionalView source
class DeleteFeedTest extends AggregatorTestBase {
/**
* Modules to install.
*
* @var array
*/
protected static $modules = [
'block',
];
/**
* {@inheritdoc}
*/
protected $defaultTheme = 'stark';
/**
* 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->assertSession()
->pageTextContains($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->assertEquals($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->assertSession()
->statusCodeEquals(404);
// Check database for feed.
$result = \Drupal::entityQuery('aggregator_feed')->accessCheck(FALSE)
->condition('title', $feed1->label())
->condition('url', $feed1->getUrl())
->count()
->execute();
$this->assertEquals(0, $result, 'Feed not found in database');
}
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.