function ComponentMetadataTest::testMetadata

Same name in this branch
  1. 11.x core/modules/sdc/tests/src/Unit/ComponentMetadataTest.php \Drupal\Tests\sdc\Unit\ComponentMetadataTest::testMetadata()
Same name in other branches
  1. 10 core/modules/sdc/tests/src/Unit/ComponentMetadataTest.php \Drupal\Tests\sdc\Unit\ComponentMetadataTest::testMetadata()
  2. 10 core/tests/Drupal/Tests/Core/Theme/Component/ComponentMetadataTest.php \Drupal\Tests\Core\Theme\Component\ComponentMetadataTest::testMetadata()

Tests that the correct data is returned for each property.

@dataProvider dataProviderMetadata

File

core/tests/Drupal/Tests/Core/Theme/Component/ComponentMetadataTest.php, line 24

Class

ComponentMetadataTest
Unit tests for the component metadata class.

Namespace

Drupal\Tests\Core\Theme\Component

Code

public function testMetadata(array $metadata_info, array $expectations) : void {
    $metadata = new ComponentMetadata($metadata_info, 'foo/', FALSE);
    $this->assertSame($expectations['path'], $metadata->path);
    $this->assertSame($expectations['status'], $metadata->status);
    $this->assertSame($expectations['thumbnail'], $metadata->getThumbnailPath());
    $this->assertEquals($expectations['props'], $metadata->schema);
}

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