public function EntityProcessorBaseTest::testCleanWithUnpublishAction in Feeds 8.3
@covers ::clean
File
- tests/
src/ Kernel/ Feeds/ Processor/ EntityProcessorBaseTest.php, line 154
Class
- EntityProcessorBaseTest
- @coversDefaultClass \Drupal\feeds\Feeds\Processor\EntityProcessorBase @group feeds
Namespace
Drupal\Tests\feeds\Kernel\Feeds\ProcessorCode
public function testCleanWithUnpublishAction() {
// Change configuration of processor.
$config = $this->processor
->getConfiguration();
$config['update_non_existent'] = 'entity:unpublish_action:node';
$this->processor
->setConfiguration($config);
// Add feeds_item field to article content type.
$this
->callProtectedMethod($this->processor, 'prepareFeedsItemField');
// Create an entity with a feeds item field.
$node = $this
->createNodeWithFeedsItem($this->feed);
// Assert that the node is published.
$this
->assertTrue($node
->isPublished());
// Clean.
$this->processor
->clean($this->feed, $node, new CleanState($this->feed
->id()));
// Reload node.
$node = $this->container
->get('entity_type.manager')
->getStorage('node')
->load($node
->id());
// Assert that the node is unpublished now.
$this
->assertFalse($node
->isPublished());
// Assert that the hash is now 'entity:unpublish_action:node'.
$this
->assertEquals('entity:unpublish_action:node', $node->feeds_item->hash);
}