You are here

public function BlockStyleBaseTest::getProtectedProperty in Block Style Plugins 8

Get a protected property on the plugin via reflection.

Parameters

string $property: Property on instance.

Return value

mixed Return the value of the protected property.

1 call to BlockStyleBaseTest::getProtectedProperty()
BlockStyleBaseTest::testSetBlockContentBundle in tests/src/Unit/Plugin/BlockStyleBaseTest.php
Tests the setBlockContentBundle method.

File

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

Class

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

Namespace

Drupal\Tests\block_style_plugins\Unit\Plugin

Code

public function getProtectedProperty($property) {
  $reflection = new \ReflectionClass($this->plugin);
  $reflection_property = $reflection
    ->getProperty($property);
  $reflection_property
    ->setAccessible(TRUE);
  return $reflection_property
    ->getValue($this->plugin);
}