You are here

public function EntityProcessorBaseTest::testCleanWithDeleteAction in Feeds 8.3

@covers ::clean

File

tests/src/Kernel/Feeds/Processor/EntityProcessorBaseTest.php, line 183

Class

EntityProcessorBaseTest
@coversDefaultClass \Drupal\feeds\Feeds\Processor\EntityProcessorBase @group feeds

Namespace

Drupal\Tests\feeds\Kernel\Feeds\Processor

Code

public function testCleanWithDeleteAction() {

  // Change configuration of processor.
  $config = $this->processor
    ->getConfiguration();
  $config['update_non_existent'] = EntityProcessorBase::DELETE_NON_EXISTENT;
  $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);
  $this
    ->assertNodeCount(1);

  // Clean.
  $this->processor
    ->clean($this->feed, $node, new CleanState($this->feed
    ->id()));

  // Assert that the node is deleted.
  $this
    ->assertNodeCount(0);
}