function PerformanceTestTrait::getExpectationsFilename
Same name and namespace in other branches
- main core/tests/Drupal/Tests/PerformanceTestTrait.php \Drupal\Tests\PerformanceTestTrait::getExpectationsFilename()
Returns the filename for a given performance test assertions file.
Parameters
string $name: The base name of the file.
string $extension: The file extension.
Return value
string The full path to the file.
2 calls to PerformanceTestTrait::getExpectationsFilename()
- PerformanceTestTrait::assertMetricsByName in core/
tests/ Drupal/ Tests/ PerformanceTestTrait.php - Asserts metrics against the stored expectations.
- PerformanceTestTrait::assertQueriesByName in core/
tests/ Drupal/ Tests/ PerformanceTestTrait.php - Asserts queries against the stored expectations.
File
-
core/
tests/ Drupal/ Tests/ PerformanceTestTrait.php, line 836
Class
- PerformanceTestTrait
- Provides various methods to aid in collecting performance data during tests.
Namespace
Drupal\TestsCode
protected function getExpectationsFilename(string $name, string $extension) : string {
// Find the location of the test class and use it to calculate the directory
// for the assertions. __DIR__ points to the location of
// the trait.
$dir = str_replace('.php', 'Assertions', $this->classLoader
->findFile(static::class));
if (!is_dir($dir)) {
\Drupal::service(FileSystemInterface::class)->prepareDirectory($dir, FileSystemInterface::CREATE_DIRECTORY);
}
return $dir . '/' . $name . '.' . $extension;
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.