public function FeedTest::testPostDeleteWithFeedTypeMissing in Feeds 8.3
@covers ::postDelete
File
- tests/
src/ Kernel/ Entity/ FeedTest.php, line 503
Class
- FeedTest
- @coversDefaultClass \Drupal\feeds\Entity\Feed @group feeds
Namespace
Drupal\Tests\feeds\Kernel\EntityCode
public function testPostDeleteWithFeedTypeMissing() {
$feed = $this
->createFeed($this->feedType
->id());
// Create variables that are expected later in the log message.
$feed_label = $feed
->label();
$feed_type_id = $this->feedType
->id();
// Add a logger.
$test_logger = new TestLogger();
$this->container
->get('logger.factory')
->addLogger($test_logger);
// Delete feed type and reload feed.
$this->feedType
->delete();
$feed = $this
->reloadEntity($feed);
$feed
->postDelete($this->container
->get('entity_type.manager')
->getStorage('feeds_feed'), [
$feed,
]);
$logs = $test_logger
->getMessages();
$expected_logs = [
'Could not perform some post cleanups for feed ' . $feed_label . ' because of the following error: The feed type "' . $feed_type_id . '" for feed 1 no longer exists.',
];
$this
->assertEquals($expected_logs, $logs);
}