You are here

public function BlockStyleBaseTest::setProtectedProperty in Block Style Plugins 8

Sets a protected property on the plugin via reflection.

Parameters

string $property: Property on instance being modified.

mixed $value: New value of the property being modified.

3 calls to BlockStyleBaseTest::setProtectedProperty()
BlockStyleBaseTest::testExclude in tests/src/Unit/Plugin/BlockStyleBaseTest.php
Tests the exclude method.
BlockStyleBaseTest::testIncludeOnly in tests/src/Unit/Plugin/BlockStyleBaseTest.php
Tests the includeOnly method.
BlockStyleBaseTest::testSetBlockContentBundle in tests/src/Unit/Plugin/BlockStyleBaseTest.php
Tests the setBlockContentBundle method.

File

tests/src/Unit/Plugin/BlockStyleBaseTest.php, line 483

Class

BlockStyleBaseTest
@coversDefaultClass \Drupal\block_style_plugins\Plugin\BlockStyleBase @group block_style_plugins

Namespace

Drupal\Tests\block_style_plugins\Unit\Plugin

Code

public function setProtectedProperty($property, $value) {
  $reflection = new \ReflectionClass($this->plugin);
  $reflection_property = $reflection
    ->getProperty($property);
  $reflection_property
    ->setAccessible(TRUE);
  $reflection_property
    ->setValue($this->plugin, $value);
}