You are here

public function GenericContentEntityProcessorTest::testOverridability in Feeds 8.3

Tests if the generic content entity processor can be overridden.

File

tests/src/Kernel/Plugin/Derivative/GenericContentEntityProcessorTest.php, line 27

Class

GenericContentEntityProcessorTest
Tests the generic entity processor deriver.

Namespace

Drupal\Tests\feeds\Kernel\Plugin\Derivative

Code

public function testOverridability() {

  // First, assert that the processor class for the entity_test entity type is
  // derived from the generic entity processor.
  $definitions = \Drupal::service('plugin.manager.feeds.processor')
    ->getDefinitions();
  $this
    ->assertEquals(GenericContentEntityProcessor::class, $definitions['entity:entity_test']['class']);
  $this
    ->assertEquals(GenericContentEntityProcessorDerivative::class, $definitions['entity:entity_test']['deriver']);

  // Now enable the feeds_test_plugin module, which contains a specific
  // processor for the entity_test entity type.
  $this
    ->installModule('feeds_test_plugin');
  $definitions = \Drupal::service('plugin.manager.feeds.processor')
    ->getDefinitions();
  $this
    ->assertEquals(EntityTestProcessor::class, $definitions['entity:entity_test']['class']);

  // Assert that this plugin does not use a deriver.
  $this
    ->assertArrayNotHasKey('deriver', $definitions['entity:entity_test']);
}