class DeprecatedModuleHandlerTest in Drupal 8
@coversDefaultClass \Drupal\Core\Extension\ModuleHandler @runTestsInSeparateProcesses
@group Extension @group legacy
Hierarchy
- class \Drupal\Tests\UnitTestCase extends \PHPUnit\Framework\TestCase uses PhpunitCompatibilityTrait
- class \Drupal\Tests\Core\Extension\DeprecatedModuleHandlerTest
Expanded class hierarchy of DeprecatedModuleHandlerTest
File
- core/
tests/ Drupal/ Tests/ Core/ Extension/ DeprecatedModuleHandlerTest.php, line 15
Namespace
Drupal\Tests\Core\ExtensionView source
class DeprecatedModuleHandlerTest extends UnitTestCase {
/**
* @dataProvider dependencyProvider
* @covers ::parseDependency
* @expectedDeprecation Drupal\Core\Extension\ModuleHandler::parseDependency is deprecated. Use \Drupal\Core\Extension\Dependency::createFromString() instead. See https://www.drupal.org/node/2756875
* @expectedDeprecation Array access to the Drupal\Core\Extension\Dependency original_version property is deprecated. Use Drupal\Core\Extension\Dependency::getConstraintString() instead. See https://www.drupal.org/node/2756875
* @expectedDeprecation Array access to the Drupal\Core\Extension\Dependency versions property is deprecated. See https://www.drupal.org/node/2756875
* @expectedDeprecation Drupal\Component\Version\Constraint::toArray() only exists to provide a backwards compatibility layer. See https://www.drupal.org/node/2756875
*/
public function testDependencyParsing($dependency, $expected) {
$version = ModuleHandler::parseDependency($dependency);
$this
->assertEquals($expected, $version);
}
/**
* Provider for testing dependency parsing.
*/
public function dependencyProvider() {
return [
[
'system',
[
'name' => 'system',
],
],
[
'taxonomy',
[
'name' => 'taxonomy',
],
],
[
'views',
[
'name' => 'views',
],
],
[
'views_ui(8.x-1.0)',
[
'name' => 'views_ui',
'original_version' => ' (8.x-1.0)',
'versions' => [
[
'op' => '=',
'version' => '1.0',
],
],
],
],
/* @todo Not supported? Fix this in
https://www.drupal.org/project/drupal/issues/3001344.
[
'views_ui(8.x-1.1-beta)',
[
'name' => 'views_ui',
'original_version' => ' (8.x-1.1-beta)',
'versions' => [['op' => '=', 'version' => '1.1-beta']],
],
],*/
[
'views_ui(8.x-1.1-alpha12)',
[
'name' => 'views_ui',
'original_version' => ' (8.x-1.1-alpha12)',
'versions' => [
[
'op' => '=',
'version' => '1.1-alpha12',
],
],
],
],
[
'views_ui(8.x-1.1-beta8)',
[
'name' => 'views_ui',
'original_version' => ' (8.x-1.1-beta8)',
'versions' => [
[
'op' => '=',
'version' => '1.1-beta8',
],
],
],
],
[
'views_ui(8.x-1.1-rc11)',
[
'name' => 'views_ui',
'original_version' => ' (8.x-1.1-rc11)',
'versions' => [
[
'op' => '=',
'version' => '1.1-rc11',
],
],
],
],
[
'views_ui(8.x-1.12)',
[
'name' => 'views_ui',
'original_version' => ' (8.x-1.12)',
'versions' => [
[
'op' => '=',
'version' => '1.12',
],
],
],
],
[
'views_ui(8.x-1.x)',
[
'name' => 'views_ui',
'original_version' => ' (8.x-1.x)',
'versions' => [
[
'op' => '<',
'version' => '2.x',
],
[
'op' => '>=',
'version' => '1.x',
],
],
],
],
[
'views_ui( <= 8.x-1.x)',
[
'name' => 'views_ui',
'original_version' => ' ( <= 8.x-1.x)',
'versions' => [
[
'op' => '<=',
'version' => '2.x',
],
],
],
],
[
'views_ui(<= 8.x-1.x)',
[
'name' => 'views_ui',
'original_version' => ' (<= 8.x-1.x)',
'versions' => [
[
'op' => '<=',
'version' => '2.x',
],
],
],
],
[
'views_ui( <=8.x-1.x)',
[
'name' => 'views_ui',
'original_version' => ' ( <=8.x-1.x)',
'versions' => [
[
'op' => '<=',
'version' => '2.x',
],
],
],
],
[
'views_ui(>8.x-1.x)',
[
'name' => 'views_ui',
'original_version' => ' (>8.x-1.x)',
'versions' => [
[
'op' => '>',
'version' => '2.x',
],
],
],
],
[
'drupal:views_ui(>8.x-1.x)',
[
'project' => 'drupal',
'name' => 'views_ui',
'original_version' => ' (>8.x-1.x)',
'versions' => [
[
'op' => '>',
'version' => '2.x',
],
],
],
],
];
}
}
Members
Name | Modifiers | Type | Description | Overrides |
---|---|---|---|---|
DeprecatedModuleHandlerTest:: |
public | function | Provider for testing dependency parsing. | |
DeprecatedModuleHandlerTest:: |
public | function | @dataProvider dependencyProvider @covers ::parseDependency @expectedDeprecation Drupal\Core\Extension\ModuleHandler::parseDependency is deprecated. Use \Drupal\Core\Extension\Dependency::createFromString() instead. See… | |
PhpunitCompatibilityTrait:: |
public | function | Returns a mock object for the specified class using the available method. | |
PhpunitCompatibilityTrait:: |
public | function | Compatibility layer for PHPUnit 6 to support PHPUnit 4 code. | |
UnitTestCase:: |
protected | property | The random generator. | |
UnitTestCase:: |
protected | property | The app root. | 1 |
UnitTestCase:: |
protected | function | Asserts if two arrays are equal by sorting them first. | |
UnitTestCase:: |
protected | function | Mocks a block with a block plugin. | 1 |
UnitTestCase:: |
protected | function | Returns a stub class resolver. | |
UnitTestCase:: |
public | function | Returns a stub config factory that behaves according to the passed array. | |
UnitTestCase:: |
public | function | Returns a stub config storage that returns the supplied configuration. | |
UnitTestCase:: |
protected | function | Sets up a container with a cache tags invalidator. | |
UnitTestCase:: |
protected | function | Gets the random generator for the utility methods. | |
UnitTestCase:: |
public | function | Returns a stub translation manager that just returns the passed string. | |
UnitTestCase:: |
public | function | Generates a unique random string containing letters and numbers. | |
UnitTestCase:: |
protected | function | 340 |