You are here

protected function FeedsReflectionTrait::setProtectedProperty in Feeds 8.3

Sets a protected property.

Parameters

object $object: The object on which to set a protected property.

string $property_name: The property to set.

mixed $value: The value that the property should get.

1 call to FeedsReflectionTrait::setProtectedProperty()
EntityProcessorBaseTest::testMapWithEmptySource in tests/src/Kernel/Feeds/Processor/EntityProcessorBaseTest.php
@covers ::map

File

tests/src/Traits/FeedsReflectionTrait.php, line 41

Class

FeedsReflectionTrait
Trait for using reflection in tests.

Namespace

Drupal\Tests\feeds\Traits

Code

protected function setProtectedProperty($object, $property_name, $value) {
  $ref_object = new ReflectionObject($object);
  $property = $ref_object
    ->getProperty($property_name);
  $property
    ->setAccessible(TRUE);
  $property
    ->setValue($object, $value);
}