class YamlDiscoveryTest
Same name in this branch
- main core/tests/Drupal/Tests/Core/Plugin/Discovery/YamlDiscoveryTest.php \Drupal\Tests\Core\Plugin\Discovery\YamlDiscoveryTest
- main core/tests/Drupal/Tests/Component/Discovery/YamlDiscoveryTest.php \Drupal\Tests\Component\Discovery\YamlDiscoveryTest
Same name and namespace in other branches
- 11.x core/tests/Drupal/Tests/Core/Discovery/YamlDiscoveryTest.php \Drupal\Tests\Core\Discovery\YamlDiscoveryTest
- 11.x core/tests/Drupal/Tests/Core/Plugin/Discovery/YamlDiscoveryTest.php \Drupal\Tests\Core\Plugin\Discovery\YamlDiscoveryTest
- 11.x core/tests/Drupal/Tests/Component/Discovery/YamlDiscoveryTest.php \Drupal\Tests\Component\Discovery\YamlDiscoveryTest
- 10 core/tests/Drupal/Tests/Core/Discovery/YamlDiscoveryTest.php \Drupal\Tests\Core\Discovery\YamlDiscoveryTest
- 10 core/tests/Drupal/Tests/Core/Plugin/Discovery/YamlDiscoveryTest.php \Drupal\Tests\Core\Plugin\Discovery\YamlDiscoveryTest
- 10 core/tests/Drupal/Tests/Component/Discovery/YamlDiscoveryTest.php \Drupal\Tests\Component\Discovery\YamlDiscoveryTest
- 9 core/tests/Drupal/Tests/Core/Discovery/YamlDiscoveryTest.php \Drupal\Tests\Core\Discovery\YamlDiscoveryTest
- 9 core/tests/Drupal/Tests/Core/Plugin/Discovery/YamlDiscoveryTest.php \Drupal\Tests\Core\Plugin\Discovery\YamlDiscoveryTest
- 9 core/tests/Drupal/Tests/Component/Discovery/YamlDiscoveryTest.php \Drupal\Tests\Component\Discovery\YamlDiscoveryTest
- 8.9.x core/tests/Drupal/Tests/Core/Discovery/YamlDiscoveryTest.php \Drupal\Tests\Core\Discovery\YamlDiscoveryTest
- 8.9.x core/tests/Drupal/Tests/Core/Plugin/Discovery/YamlDiscoveryTest.php \Drupal\Tests\Core\Plugin\Discovery\YamlDiscoveryTest
- 8.9.x core/tests/Drupal/Tests/Component/Discovery/YamlDiscoveryTest.php \Drupal\Tests\Component\Discovery\YamlDiscoveryTest
YamlDiscovery component unit tests.
Attributes
#[Group('Discovery')]
Hierarchy
- class \Drupal\Tests\DrupalTestCase uses \Drupal\Tests\DrupalTestCaseTrait extends \PHPUnit\Framework\TestCase
- class \Drupal\Tests\UnitTestCase uses \Prophecy\PhpUnit\ProphecyTrait, \Drupal\Tests\RandomGeneratorTrait extends \Drupal\Tests\DrupalTestCase
- class \Drupal\Tests\Core\Discovery\YamlDiscoveryTest extends \Drupal\Tests\UnitTestCase
- class \Drupal\Tests\UnitTestCase uses \Prophecy\PhpUnit\ProphecyTrait, \Drupal\Tests\RandomGeneratorTrait extends \Drupal\Tests\DrupalTestCase
Expanded class hierarchy of YamlDiscoveryTest
File
-
core/
tests/ Drupal/ Tests/ Core/ Discovery/ YamlDiscoveryTest.php, line 19
Namespace
Drupal\Tests\Core\DiscoveryView source
class YamlDiscoveryTest extends UnitTestCase {
/**
* {@inheritdoc}
*/
protected function setUp() : void {
parent::setUp();
// Ensure that FileCacheFactory has a prefix.
FileCacheFactory::setPrefix('prefix');
}
/**
* Tests if filename is output for a broken YAML file.
*/
public function testFilenameForBrokenYml() : void {
vfsStreamWrapper::register();
$root = new vfsStreamDirectory('modules');
vfsStreamWrapper::setRoot($root);
$url = vfsStream::url('modules');
mkdir($url . '/test_broken');
file_put_contents($url . '/test_broken/test_broken.test.yml', "broken:\n:");
$this->expectException(InvalidDataTypeException::class);
$this->expectExceptionMessageIs('vfs://modules/test_broken/test_broken.test.yml: Unable to parse at line 2 (near ":").');
$directories = [
'test_broken' => $url . '/test_broken',
];
$discovery = new YamlDiscovery('test', $directories);
$discovery->findAll();
}
}
Members
| Title Sort descending | Modifiers | Object type | Summary |
|---|---|---|---|
| YamlDiscoveryTest::setUp | protected | function | |
| YamlDiscoveryTest::testFilenameForBrokenYml | public | function | Tests if filename is output for a broken YAML file. |
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.