class FeedProcessorPluginTest
Same name and namespace in other branches
- 8.9.x core/modules/aggregator/tests/src/Functional/FeedProcessorPluginTest.php \Drupal\Tests\aggregator\Functional\FeedProcessorPluginTest
Tests the processor plugins functionality and discoverability.
@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\FeedProcessorPluginTest extends \Drupal\Tests\aggregator\Functional\AggregatorTestBase
- class \Drupal\Tests\aggregator\Functional\AggregatorTestBase extends \Drupal\Tests\BrowserTestBase
Expanded class hierarchy of FeedProcessorPluginTest
See also
\Drupal\aggregator_test\Plugin\aggregator\processor\TestProcessor.
File
-
core/
modules/ aggregator/ tests/ src/ Functional/ FeedProcessorPluginTest.php, line 16
Namespace
Drupal\Tests\aggregator\FunctionalView source
class FeedProcessorPluginTest extends AggregatorTestBase {
/**
* {@inheritdoc}
*/
protected $defaultTheme = 'stark';
/**
* {@inheritdoc}
*/
protected function setUp() : void {
parent::setUp();
// Enable test plugins.
$this->enableTestPlugins();
// Create some nodes.
$this->createSampleNodes();
}
/**
* Tests processing functionality.
*/
public function testProcess() {
$feed = $this->createFeed();
$this->updateFeedItems($feed);
foreach ($feed->items as $iid) {
$item = Item::load($iid);
$this->assertStringStartsWith('testProcessor', $item->label());
}
}
/**
* Tests deleting functionality.
*/
public function testDelete() {
$feed = $this->createFeed();
$description = $feed->description->value ?: '';
$this->updateAndDelete($feed, NULL);
// Make sure the feed title is changed.
$entities = \Drupal::entityTypeManager()->getStorage('aggregator_feed')
->loadByProperties([
'description' => $description,
]);
$this->assertEmpty($entities);
}
/**
* Tests post-processing functionality.
*/
public function testPostProcess() {
$feed = $this->createFeed(NULL, [
'refresh' => 1800,
]);
$this->updateFeedItems($feed);
$feed_id = $feed->id();
// Reset entity cache manually.
\Drupal::entityTypeManager()->getStorage('aggregator_feed')
->resetCache([
$feed_id,
]);
// Reload the feed to get new values.
$feed = Feed::load($feed_id);
// Make sure its refresh rate doubled.
$this->assertEquals(3600, $feed->getRefreshRate());
}
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.