diff --git a/config/install/replication.replication_settings.article.yml b/config/install/replication.replication_settings.article.yml index b6a07f0..94090a3 100644 --- a/config/install/replication.replication_settings.article.yml +++ b/config/install/replication.replication_settings.article.yml @@ -5,5 +5,4 @@ id: article label: Replicate only article entities filter_id: entity_type parameters: - entity_type_id: node - bundle: article + types: node.article diff --git a/config/install/replication.replication_settings.page.yml b/config/install/replication.replication_settings.page.yml index a0977a1..f63453d 100644 --- a/config/install/replication.replication_settings.page.yml +++ b/config/install/replication.replication_settings.page.yml @@ -5,5 +5,4 @@ id: page label: Replicate only page entities filter_id: entity_type parameters: - entity_type_id: node - bundle: page + types: node.page diff --git a/src/Changes/Changes.php b/src/Changes/Changes.php index 98ae886..1419d36 100644 --- a/src/Changes/Changes.php +++ b/src/Changes/Changes.php @@ -7,8 +7,6 @@ use Drupal\Core\Entity\EntityTypeManagerInterface; use Drupal\multiversion\Entity\Index\SequenceIndexInterface; use Drupal\multiversion\Entity\WorkspaceInterface; use Drupal\replication\Plugin\ReplicationFilterManagerInterface; -// @todo where is the ParameterBagInterface??? -use Symfony\Component\HttpFoundation\ParameterBag; use Symfony\Component\Serializer\SerializerInterface; /** @@ -45,7 +43,7 @@ class Changes implements ChangesInterface { protected $filterName; /** - * @var ParameterBag + * @var array * The parameters passed to the filter plugin. */ protected $parameters; @@ -88,7 +86,7 @@ class Changes implements ChangesInterface { /** * {@inheritdoc} */ - public function parameters(ParameterBag $parameters = NULL) { + public function parameters(array $parameters = NULL) { $this->parameters = $parameters; return $this; } @@ -118,15 +116,15 @@ class Changes implements ChangesInterface { ->getRange($this->lastSeq, NULL); // Setup filter plugin. - $parameters = ($this->parameters instanceof ParameterBag) ? $this->parameters : new ParameterBag(); + $parameters = is_array($this->parameters) ? $this->parameters : []; $filter = NULL; if (is_string($this->filterName) && $this->filterName) { - $filter = $this->filterManager->createInstance($this->filterName, $parameters->all()); + $filter = $this->filterManager->createInstance($this->filterName, $parameters); } // If UUIDs are sent as a parameter, but no filter is set, automatically // select the "uuid" filter. - elseif ($parameters->has('uuids')) { - $filter = $this->filterManager->createInstance('uuid', $parameters->all()); + elseif (isset($parameters['uuids'])) { + $filter = $this->filterManager->createInstance('uuid', $parameters); } // Format the result array. diff --git a/src/Changes/ChangesInterface.php b/src/Changes/ChangesInterface.php index c955845..5cc2006 100644 --- a/src/Changes/ChangesInterface.php +++ b/src/Changes/ChangesInterface.php @@ -2,8 +2,6 @@ namespace Drupal\replication\Changes; -use Symfony\Component\HttpFoundation\ParameterBag; - /** * Define and build a changeset for a Workspace. * @@ -29,13 +27,13 @@ interface ChangesInterface { /** * Set the parameters for the filter plugin. * - * @param ParameterBag $parameters + * @param array $parameters * The parameters passed to the filter plugin. * * @return \Drupal\replication\Changes\ChangesInterface * Returns $this. */ - public function parameters(ParameterBag $parameters = NULL); + public function parameters(array $parameters = NULL); /** * Set the flag for including entities in the changeset. diff --git a/src/Entity/ReplicationSettings.php b/src/Entity/ReplicationSettings.php index 5a03649..4d4ff0f 100644 --- a/src/Entity/ReplicationSettings.php +++ b/src/Entity/ReplicationSettings.php @@ -47,7 +47,7 @@ class ReplicationSettings extends ConfigEntityBase implements ReplicationSetting /** * The replication filter parameters. * - * @var string[string] + * @var array */ protected $parameters; diff --git a/src/Entity/ReplicationSettingsInterface.php b/src/Entity/ReplicationSettingsInterface.php index f046c9f..86defa4 100644 --- a/src/Entity/ReplicationSettingsInterface.php +++ b/src/Entity/ReplicationSettingsInterface.php @@ -19,7 +19,7 @@ interface ReplicationSettingsInterface extends ConfigEntityInterface { /** * Get the replication filter parameters. * - * @return string[string] + * @return array */ public function getParameters(); diff --git a/src/Plugin/ReplicationFilter/EntityTypeFilter.php b/src/Plugin/ReplicationFilter/EntityTypeFilter.php index 041847c..1be4820 100644 --- a/src/Plugin/ReplicationFilter/EntityTypeFilter.php +++ b/src/Plugin/ReplicationFilter/EntityTypeFilter.php @@ -8,9 +8,9 @@ use Drupal\replication\Plugin\ReplicationFilter\ReplicationFilterBase; /** * Provides a filter based on entity type. * - * Supported configuration: - * entity_type_id: a comma delimited list of entity type id's to include - * bundle: a comma delimited list of bundles matching the type ids + * Use the configuration "types" with values in the format + * "{entity_type_id}.{bundle}", for example, "node.article". This can also be a + * comma delimited list like "node.article,node.page". * * @ReplicationFilter( * id = "entity_type", @@ -24,19 +24,29 @@ class EntityTypeFilter extends ReplicationFilterBase { * {@inheritdoc} */ public function filter(EntityInterface $entity) { - $entity_type_ids = $this->getDelimitedConfigurationValue(',', 'entity_type_id'); - $bundles = $this->getDelimitedConfigurationValue(',', 'bundle'); + $configuration = $this->getConfiguration(); + $types = isset($configuration['types']) ? $configuration['types'] : ''; + $types = str_replace(' ', '', $types); + $types = explode(',', $types); + $types = array_filter($types); - // Ensure length of entity_type_ids and bundles are equal. - if (count($entity_type_ids) != count($bundles)) { - return FALSE; - } + foreach ($types as $type) { + // Handle cases like "node.". + $type = trim($type, '.'); + + $split = explode('.', $type); + + $entity_type_id = $split[0]; + $bundle = isset($split[1]) ? $split[1] : NULL; - $entity_type_id = $entity->getEntityTypeId(); - $bundle = $entity->bundle(); + // Filter for only the entity type id. + if ($bundle == NULL && $entity->getEntityTypeId() == $entity_type_id) { + return TRUE; + } - for ($i = 0; $i < count($entity_type_ids); $i++) { - if ($entity_type_ids[$i] == $entity_type_id && $bundles[$i] == $bundle) { + // Filter for both the entity type id and bundle. + if ($entity->getEntityTypeId() == $entity_type_id + && $entity->bundle() == $bundle) { return TRUE; } } diff --git a/src/Plugin/ReplicationFilter/PublishedFilter.php b/src/Plugin/ReplicationFilter/PublishedFilter.php index b20965a..b637da3 100644 --- a/src/Plugin/ReplicationFilter/PublishedFilter.php +++ b/src/Plugin/ReplicationFilter/PublishedFilter.php @@ -3,13 +3,18 @@ namespace Drupal\replication\Plugin\ReplicationFilter; use Drupal\Core\Entity\EntityInterface; -use Drupal\node\NodeInterface; +use Drupal\Core\Entity\EntityTypeManagerInterface; +use Drupal\Core\Plugin\ContainerFactoryPluginInterface; use Drupal\replication\Plugin\ReplicationFilter\ReplicationFilterBase; +use Symfony\Component\DependencyInjection\ContainerInterface; /** * Provides a filter for published entities. * - * Note: this filter will only work with NodeTypes. + * Use the configuration "include_unpublisheable_entities" to determine what + * happens to entities that do not have a "status" field, if set to TRUE they + * will be included by the filter, else excluded. + * with values in the format * * @ReplicationFilter( * id = "published", @@ -17,16 +22,63 @@ use Drupal\replication\Plugin\ReplicationFilter\ReplicationFilterBase; * description = @Translation("Replicate only nodes that are published.") * ) */ -class PublishedFilter extends ReplicationFilterBase { +class PublishedFilter extends ReplicationFilterBase implements ContainerFactoryPluginInterface { + + /** + * @var \Drupal\Core\Entity\EntityTypeManagerInterface + * The entity type manager to check for "status" entity key. + */ + protected $entityTypeManager; + + /** + * Constructs a new PublishedFilter. + * + * @param array $configuration + * A configuration array containing information about the plugin instance. + * @param string $plugin_id + * The plugin_id for the plugin instance. + * @param mixed $plugin_definition + * The plugin implementation definition. + * @param \Drupal\Core\Entity\EntityTypeManagerInterface $entity_type_manager + * The entity type manager. + */ + public function __construct(array $configuration, $plugin_id, $plugin_definition, EntityTypeManagerInterface $entity_type_manager) { + parent::__construct($configuration, $plugin_id, $plugin_definition); + $this->entityTypeManager = $entity_type_manager; + } + + /** + * {@inheritdoc} + */ + public static function create(ContainerInterface $container, array $configuration, $plugin_id, $plugin_definition) { + return new static($configuration, $plugin_id, $plugin_definition, $container->get('entity_type.manager')); + } + + /** + * {@inheritdoc} + */ + public function defaultConfiguration() { + return [ + 'include_unpublisheable_entities' => FALSE, + ]; + } /** * {@inheritdoc} */ public function filter(EntityInterface $entity) { - if (!$entity instanceof NodeInterface) { - return FALSE; + // @todo handle translations? + // @todo is there an easier way to tell if an entity is published? + $definition = $this->entityTypeManager->getDefinition($entity->getEntityTypeId()); + if ($definition->hasKey('status')) { + $field_name = $definition->getKey('status'); + $field_definition = $entity->getFieldDefinition($field_name); + $property = $field_definition->getFieldStorageDefinition()->getMainPropertyName(); + return (bool) $entity->get($field_name)->$property; } - return $entity->isPublished(); + // Determine what to do with entities without a 'status' field. + $configuration = $this->getConfiguration(); + return $configuration['include_unpublisheable_entities']; } } diff --git a/src/Plugin/ReplicationFilter/ReplicationFilterBase.php b/src/Plugin/ReplicationFilter/ReplicationFilterBase.php index c551bc2..bd82751 100644 --- a/src/Plugin/ReplicationFilter/ReplicationFilterBase.php +++ b/src/Plugin/ReplicationFilter/ReplicationFilterBase.php @@ -68,23 +68,4 @@ abstract class ReplicationFilterBase extends PluginBase implements ReplicationFi return array(); } - /** - * Parse a configuration as delimited values. - * - * @param string $delimiter - * The delimiter of each value. - * @param string $configuration_key - * The key of the configuration to get the values for. - * - * @return array - * The configuration parsed into an array of values. - */ - protected function getDelimitedConfigurationValue($delimiter, $configuration_key) { - $configuration = $this->getConfiguration(); - $values = (isset($configuration[$configuration_key])) ? $configuration[$configuration_key] : ''; - $values = explode($delimiter, $values); - $values = array_filter(array_map('trim', $values)); - return $values; - } - } diff --git a/src/Plugin/ReplicationFilter/UuidFilter.php b/src/Plugin/ReplicationFilter/UuidFilter.php index 0ee8fa6..47d841f 100644 --- a/src/Plugin/ReplicationFilter/UuidFilter.php +++ b/src/Plugin/ReplicationFilter/UuidFilter.php @@ -8,6 +8,8 @@ use Drupal\replication\Plugin\ReplicationFilter\ReplicationFilterBase; /** * Provides filtering by UUID. * + * Use the configuration "uuids" with comma delimited values, e.g. "101,102". + * * Note: if the entity a UUID refers to references another entity, that * referenced entity's UUID must also be included in order to maintain data * integrity. @@ -24,7 +26,10 @@ class UuidFilter extends ReplicationFilterBase { * {@inheritdoc} */ public function filter(EntityInterface $entity) { - $uuids = $this->getDelimitedConfigurationValue(',', 'uuids'); + $configuration = $this->getConfiguration(); + $uuids = isset($configuration['uuids']) ? $configuration['uuids'] : ''; + $uuids = explode(',', $uuids); + $uuids = array_map('trim', $uuids); return in_array($entity->uuid(), $uuids); } diff --git a/src/Plugin/ReplicationFilterInterface.php b/src/Plugin/ReplicationFilterInterface.php index 17c7fa9..c041c30 100644 --- a/src/Plugin/ReplicationFilterInterface.php +++ b/src/Plugin/ReplicationFilterInterface.php @@ -5,7 +5,6 @@ namespace Drupal\replication\Plugin; use Drupal\Component\Plugin\ConfigurablePluginInterface; use Drupal\Component\Plugin\PluginInspectionInterface; use Drupal\Core\Entity\EntityInterface; -use Symfony\Component\HttpFoundation\ParameterBag; /** * Defines a replication filter. @@ -34,8 +33,6 @@ interface ReplicationFilterInterface extends PluginInspectionInterface, Configur * * @param EntityInterface $entity * The entity to filter. - * @param ParameterBag $parameters - * The parameters passed to the filter function. * * @return bool * Return TRUE if it should be included, else FALSE. diff --git a/src/ReplicationTask/ReplicationTask.php b/src/ReplicationTask/ReplicationTask.php index 7b109e8..7653982 100644 --- a/src/ReplicationTask/ReplicationTask.php +++ b/src/ReplicationTask/ReplicationTask.php @@ -3,7 +3,6 @@ namespace Drupal\replication\ReplicationTask; use Drupal\replication\ReplicationTask\ReplicationTaskInterface; -use Symfony\Component\HttpFoundation\ParameterBag; /** * {@inheritdoc} @@ -17,19 +16,12 @@ class ReplicationTask implements ReplicationTaskInterface { protected $filterName; /** - * @var ParameterBag + * @var array * The parameters passed to the filter function. */ protected $parameters; /** - * ReplicationTask constructor. - */ - public function __construct() { - $this->parameters = new ParameterBag(); - } - - /** * {@inheritdoc} */ public function setFilter($filter_name = NULL) { @@ -47,7 +39,10 @@ class ReplicationTask implements ReplicationTaskInterface { /** * {@inheritdoc} */ - public function setParameters(ParameterBag $parameters) { + public function setParameters(array $parameters = NULL) { + if ($parameters == NULL) { + $parameters = []; + } $this->parameters = $parameters; return $this; } @@ -55,21 +50,9 @@ class ReplicationTask implements ReplicationTaskInterface { /** * {@inheritdoc} */ - public function setParametersByArray(array $parameters_array = NULL) { - if ($parameters_array == NULL) { - $parameters_array = []; - } - $parameters = new ParameterBag($parameters_array); - return $this->setParameters($parameters); - } - - /** - * {@inheritdoc} - */ public function setParameter($name, $value) { - if (!$this->parameters instanceof ParameterBag) { - $parameters = new ParameterBag(); - $this->setParameters($parameters); + if (!is_array($this->parameters)) { + $this->setParameters([]); } $this->parameters->set($name, $value); return $this; diff --git a/src/ReplicationTask/ReplicationTaskInterface.php b/src/ReplicationTask/ReplicationTaskInterface.php index a8f0146..1c9b2e4 100644 --- a/src/ReplicationTask/ReplicationTaskInterface.php +++ b/src/ReplicationTask/ReplicationTaskInterface.php @@ -2,8 +2,6 @@ namespace Drupal\replication\ReplicationTask; -use Symfony\Component\HttpFoundation\ParameterBag; - /** * The replication settings between source and target. * @@ -37,27 +35,13 @@ interface ReplicationTaskInterface { /** * Set the parameters for the filter plugin. * - * @param ParameterBag $parameters - * The parameters passed to the filter function. - * - * @return ReplicationTaskInterface - * Returns $this. - */ - public function setParameters(ParameterBag $parameters); - - /** - * Set the parameters for the filter plugin using an array. - * - * The array input is converted to a ParameterBag and then passed to - * setParameters. - * * @param array|NULL $parameters_array * An associative array of name-value parameters. * * @return ReplicationTaskInterface * Returns $this. */ - public function setParametersByArray(array $parameters_array = NULL); + public function setParameters(array $parameters = NULL); /** * Set a parameter for the filter plugin. @@ -77,7 +61,7 @@ interface ReplicationTaskInterface { /** * Get the parameters for the filter plugin. * - * @return ParameterBag + * @return array * The parameters passed to the filter plugin. */ public function getParameters(); diff --git a/tests/src/Functional/ReplicationFilterTest.php b/tests/src/Functional/ReplicationFilterTest.php index ef3f2db..08dd3ee 100644 --- a/tests/src/Functional/ReplicationFilterTest.php +++ b/tests/src/Functional/ReplicationFilterTest.php @@ -5,7 +5,6 @@ namespace Drupal\Tests\replication\Functional; use Drupal\multiversion\Entity\Workspace; use Drupal\node\Entity\Node; use Drupal\simpletest\WebTestBase; -use Symfony\Component\HttpFoundation\ParameterBag; /** * Tests replication filters. @@ -76,7 +75,7 @@ class ReplicationFilterTest extends WebTestBase { $entity2->workspace = $workspace; $entity2->save(); - $parameters = new ParameterBag(['uuids' => $entity1->uuid()]); + $parameters = ['uuids' => $entity1->uuid()]; $changes = $changes_factory->get($workspace)->filter('uuid')->parameters($parameters)->getNormal(); $this->assertEqual(1, count($changes), 'Expect there is 1 entity in the changeset.'); } @@ -143,7 +142,7 @@ class ReplicationFilterTest extends WebTestBase { $entity2->workspace = $workspace; $entity2->save(); - $parameters = new ParameterBag(['entity_type_id' => 'node', 'bundle' => 'article']); + $parameters = ['entity_type_id' => 'node', 'bundle' => 'article']; $changes = $changes_factory->get($workspace)->filter('entity_type')->parameters($parameters)->getNormal(); $this->assertEqual(1, count($changes), 'Expect there is 1 entity in the changeset.'); } diff --git a/tests/src/Kernel/Plugin/ReplicationFilter/PublishedFilterTest.php b/tests/src/Kernel/Plugin/ReplicationFilter/PublishedFilterTest.php new file mode 100644 index 0000000..944da25 --- /dev/null +++ b/tests/src/Kernel/Plugin/ReplicationFilter/PublishedFilterTest.php @@ -0,0 +1,134 @@ + 'test', + 'label' => 'Test', + ]); + $node_type->save(); + + $bundle_type = BlockContentType::create([ + 'id' => 'test', + 'label' => 'Test', + ]); + $bundle_type->save(); + } + + /** + * Test filtering published entities. + * + * @param bool $include_unpublisheable_entities + * The plugin configuration value for including unpublisheable entities. + * @param string $entity_class + * Fully qualified class name (FQCN) of the entity to create for testing. + * @param array $entity_values + * The values to pass to $class::create(). + * @param bool $expected + * The expected return value from the filter function. + * + * @dataProvider filterTestProvider + */ + public function testFilter($include_unpublisheable_entities, $entity_class, $entity_values, $expected) { + /** @var \Drupal\replication\Plugin\ReplicationFilterManagerInterface $filter_manager */ + $filter_manager = $this->container->get('plugin.manager.replication_filter'); + $configuration = [ + 'include_unpublisheable_entities' => $include_unpublisheable_entities, + ]; + $filter = $filter_manager->createInstance('published', $configuration); + $entity = call_user_func($entity_class . '::create', $entity_values); + + $value = $filter->filter($entity); + + $this->assertEquals($expected, $value); + } + + /** + * Test default configuration for published filter. + */ + public function testDefaultConfig($include_unpublisheable_entities, $entity_class, $entity_values, $expected) { + /** @var \Drupal\replication\Plugin\ReplicationFilterManagerInterface $filter_manager */ + $filter_manager = $this->container->get('plugin.manager.replication_filter'); + $filter = $filter_manager->createInstance('published'); + $entity = BlockContent::create([ + 'type' => 'test', + ]); + + $value = $filter->filter($entity); + + // By default entities with no status entity key are filtered out. + $this->assertFalse($value); + } + + /** + * Provide test cases for the "entity_type_id" and "bundle" parameters. + * + * Note: the only node bundle is 'test' and the only block content bundle is + * 'test'. + * + * @return array + * An array of arrays, each array being the arguments to filterTest(). + */ + public function filterTestProvider() { + $published_node = [ + 'type' => 'test', + 'status' => TRUE, + ]; + + $unpublished_node = [ + 'type' => 'test', + 'status' => FALSE, + ]; + + $block = [ + 'type' => 'test', + ]; + + return [ + [FALSE, Node::class, $published_node, TRUE], + [FALSE, Node::class, $unpublished_node, FALSE], + [TRUE, BlockContent::class, $block, TRUE], + [FALSE, BlockContent::class, $block, FALSE], + ]; + } + +} diff --git a/tests/src/Kernel/ReplicationSettingsTest.php b/tests/src/Kernel/ReplicationSettingsTest.php index 2adbb3d..cad3beb 100644 --- a/tests/src/Kernel/ReplicationSettingsTest.php +++ b/tests/src/Kernel/ReplicationSettingsTest.php @@ -40,7 +40,7 @@ class ReplicationSettingsTest extends KernelTestBase { 'filter_id' => 'entity_type', 'parameters' => ['entity_type_id' => 'node', 'bundle' => 'article'], ]); - $this->assertTrue($entity instanceof ReplicationSettings, 'Replication Settings entity was created.'); + $this->assertInstanceOf(ReplicationSettings::class, $entity, 'Replication Settings entity was created.'); $entity->save(); $entity = $entityTypeManager->getStorage('replication_settings')->load('test'); diff --git a/tests/src/Unit/Plugin/ReplicationFilter/EntityTypeFilterTest.php b/tests/src/Unit/Plugin/ReplicationFilter/EntityTypeFilterTest.php index 124579c..0141c60 100644 --- a/tests/src/Unit/Plugin/ReplicationFilter/EntityTypeFilterTest.php +++ b/tests/src/Unit/Plugin/ReplicationFilter/EntityTypeFilterTest.php @@ -4,7 +4,6 @@ namespace Drupal\Tests\replication\Unit\Plugin\ReplicationFilter; use Drupal\Core\Entity\EntityInterface; use Drupal\replication\Plugin\ReplicationFilter\EntityTypeFilter; -use Symfony\Component\HttpFoundation\ParameterBag; /** * Tests that the entity type filter parses parameters correctly. @@ -16,16 +15,14 @@ class EntityTypeFilterTest extends \PHPUnit_Framework_TestCase { /** * Test filtering entity types. * - * @param string $entity_type_id - * The entity type id filter parameter. - * @param string $bundle - * The bundle filter parameter. + * @param string $types + * The types filter parameter. * @param string $expected * The expected return value from the filter method. * * @dataProvider filterTestProvider */ - public function testFilter($entity_type_id, $bundle, $expected) { + public function testFilter($types, $expected) { // Use a mock builder for the class under test to eliminate the need to // mock all the dependencies. The method under test uses the $configuration // set by the constructor, but is retrieved via a get method we can stub. @@ -34,8 +31,7 @@ class EntityTypeFilterTest extends \PHPUnit_Framework_TestCase { ->setMethods(['getConfiguration']) ->getMock(); $configuration = [ - 'entity_type_id' => $entity_type_id, - 'bundle' => $bundle, + 'types' => $types, ]; $filter->method('getConfiguration') ->willReturn($configuration); @@ -56,21 +52,23 @@ class EntityTypeFilterTest extends \PHPUnit_Framework_TestCase { public function filterTestProvider() { return [ // Test singular parameter values. - ['node', 'article', TRUE], - ['node', 'page', FALSE], + ['node', TRUE], + ['node.article', TRUE], + ['node.page', FALSE], // Test multiple parameter values. - ['node,node', 'page,article', TRUE], - ['node,node', 'article,page', TRUE], - ['node,node', 'page,news', FALSE], - // Test mismatched multiple parameter values. - ['node', 'page,article', FALSE], - ['node,node', 'node', FALSE], + ['block,node', TRUE], + ['node.article,node.page', TRUE], + ['node.page,node.article', TRUE], + ['node.test,node.page', FALSE], // Test bad data that might be entered into the parameters: - ['', '', FALSE], - [NULL, NULL, FALSE], - [FALSE, FALSE, FALSE], - [TRUE, TRUE, FALSE], - [0, 0, FALSE], + ['', FALSE], + [',', FALSE], + [',node', TRUE], + ['..', FALSE], + [NULL, FALSE], + [FALSE, FALSE], + [TRUE, FALSE], + [0, FALSE], ]; } diff --git a/tests/src/Unit/Plugin/ReplicationFilter/UuidFilterTest.php b/tests/src/Unit/Plugin/ReplicationFilter/UuidFilterTest.php index 1e8f42b..50e59e1 100644 --- a/tests/src/Unit/Plugin/ReplicationFilter/UuidFilterTest.php +++ b/tests/src/Unit/Plugin/ReplicationFilter/UuidFilterTest.php @@ -4,7 +4,6 @@ namespace Drupal\Tests\replication\Unit\Plugin\ReplicationFilter; use Drupal\Core\Entity\EntityInterface; use Drupal\replication\Plugin\ReplicationFilter\UuidFilter; -use Symfony\Component\HttpFoundation\ParameterBag; /** * Tests that the uuid filter parses parameters correctly. @@ -73,7 +72,7 @@ class UuidFilterTest extends \PHPUnit_Framework_TestCase { $entity = $this->getMock(EntityInterface::class); $entity->method('uuid') ->willReturn('123'); - $parameters = new ParameterBag(); + $parameters = []; $value = $filter->filter($entity, $parameters);