function ElementInfoManagerTest::testGetInfoProperty

Same name and namespace in other branches
  1. 11.x core/tests/Drupal/Tests/Core/Render/ElementInfoManagerTest.php \Drupal\Tests\Core\Render\ElementInfoManagerTest::testGetInfoProperty()
  2. 10 core/tests/Drupal/Tests/Core/Render/ElementInfoManagerTest.php \Drupal\Tests\Core\Render\ElementInfoManagerTest::testGetInfoProperty()
  3. 9 core/tests/Drupal/Tests/Core/Render/ElementInfoManagerTest.php \Drupal\Tests\Core\Render\ElementInfoManagerTest::testGetInfoProperty()
  4. 8.9.x core/tests/Drupal/Tests/Core/Render/ElementInfoManagerTest.php \Drupal\Tests\Core\Render\ElementInfoManagerTest::testGetInfoProperty()

Tests get info property.

File

core/tests/Drupal/Tests/Core/Render/ElementInfoManagerTest.php, line 110

Class

ElementInfoManagerTest
Tests Drupal\Core\Render\ElementInfoManager.

Namespace

Drupal\Tests\Core\Render

Code

public function testGetInfoProperty() : void {
  $themeManager = $this->createStub(ThemeManagerInterface::class);
  $themeManager->method('getActiveTheme')
    ->willReturn(new ActiveTheme([
    'name' => 'test',
  ]));
  $element_info = new TestElementInfoManager(new \ArrayObject(), $this->createStub(CacheBackendInterface::class), $this->createStub(ThemeHandlerInterface::class), $this->createStub(ModuleHandlerInterface::class), $themeManager);
  $this->assertSame('baz', $element_info->getInfoProperty('foo', '#bar'));
  $this->assertNull($element_info->getInfoProperty('foo', '#non_existing_property'));
  $this->assertSame('qux', $element_info->getInfoProperty('foo', '#non_existing_property', 'qux'));
}

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.