function YamlDiscoveryTest::testGetDefinitions
Same name and namespace in other branches
- 9 core/tests/Drupal/Tests/Core/Plugin/Discovery/YamlDiscoveryTest.php \Drupal\Tests\Core\Plugin\Discovery\YamlDiscoveryTest::testGetDefinitions()
- 8.9.x core/tests/Drupal/Tests/Core/Plugin/Discovery/YamlDiscoveryTest.php \Drupal\Tests\Core\Plugin\Discovery\YamlDiscoveryTest::testGetDefinitions()
- 11.x core/tests/Drupal/Tests/Core/Plugin/Discovery/YamlDiscoveryTest.php \Drupal\Tests\Core\Plugin\Discovery\YamlDiscoveryTest::testGetDefinitions()
Tests the getDefinitions() method.
File
-
core/
tests/ Drupal/ Tests/ Core/ Plugin/ Discovery/ YamlDiscoveryTest.php, line 56
Class
- YamlDiscoveryTest
- @coversDefaultClass <a href="/api/drupal/core%21lib%21Drupal%21Core%21Plugin%21Discovery%21YamlDiscovery.php/class/YamlDiscovery/10" title="Allows YAML files to define plugin definitions." class="local">\Drupal\Core\Plugin\Discovery\YamlDiscovery</a> @group Plugin
Namespace
Drupal\Tests\Core\Plugin\DiscoveryCode
public function testGetDefinitions() {
$definitions = $this->discovery
->getDefinitions();
$this->assertIsArray($definitions);
$this->assertCount(4, $definitions);
foreach ($this->expectedKeys as $expected_key) {
$this->assertArrayHasKey($expected_key, $definitions);
}
foreach ($definitions as $id => $definition) {
foreach ([
'name',
'id',
'provider',
] as $key) {
$this->assertArrayHasKey($key, $definition);
}
$this->assertEquals($id, $definition['id']);
$this->assertEquals(array_search($id, $this->expectedKeys), $definition['provider']);
}
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.