Namespace
Drupal\Tests\examples\Unit
File
-
tests/src/Unit/TraitsTest.php
View source
<?php
namespace Drupal\Tests\examples\Unit;
use Drupal\Tests\UnitTestCase;
class TraitsTest extends UnitTestCase {
use FilesTestTrait;
use RetrieveConfigFilesTrait;
use RetrieveRoutingFilesTrait;
public static function providerConfigFiles() : array {
$data = [];
$directory = self::projectPathname('tests/modules');
return self::retrieveFiles($directory, 'yml', self::configFilesCallback(...));
}
public static function providerRoutingFiles() : array {
$data = [];
$directory = self::projectPathname('tests/modules');
return self::retrieveFiles($directory, 'yml', self::routingFilesCallback(...));
}
public function testConfigFilesCallback(string $filename, string $path, string $pathname) : void {
$this->assertNotEquals('example_no_config_files_test.yml', $filename, "{$filename} is not in the right directory ({$path}) and should have not been retrieved.");
}
public function testRoutingFilesCallback(string $filename, $path, $pathname) : void {
$this->assertNotEquals('examples_no_module_test.routing.yml', $filename, "{$filename} is not a routing file used by a module because {$path} does not contain any .info.yml file.");
}
}
Classes
| Title |
Deprecated |
Summary |
| TraitsTest |
|
Tests for the traits defined in\Drupal\Tests\examples\Unit. |