function ExtensionAvailableConstraintValidatorTest::dataProvider
Data provider using yield statements.
File
-
core/
tests/ Drupal/ KernelTests/ Core/ Extension/ ExtensionAvailableConstraintValidatorTest.php, line 108
Class
- ExtensionAvailableConstraintValidatorTest
- Tests the ExtensionAvailable constraint validator.
Namespace
Drupal\KernelTests\Core\ExtensionCode
public static function dataProvider() : \Generator {
yield 'default profile: testing module is not available outside testing' => [
'new_config' => [
'module' => [
'system' => 0,
'sqlite' => 0,
'testing' => 0,
],
'theme' => [],
'profile' => 'minimal',
],
'initial_config' => [],
'expected_violations' => [
"Module 'testing' is not available.",
"The keys of the sequence do not match the given constraints.",
],
'testing_environment' => FALSE,
];
yield 'default profile: can set profile to minimal' => [
'new_config' => [
'module' => [
'system' => 0,
'sqlite' => 0,
'contact' => 0,
],
'theme' => [],
'profile' => 'minimal',
],
'initial_config' => [],
'expected_violations' => [],
'testing_environment' => FALSE,
];
yield 'null profile to invalid profile' => [
'new_config' => [
'module' => [
'system' => 0,
'sqlite' => 0,
],
'theme' => [],
'profile' => 'invalid_profile',
],
'initial_config' => [
'profile' => NULL,
],
'expected_violations' => [
"Profile 'invalid_profile' could not be loaded to check if the extension 'system' is available.",
"Profile 'invalid_profile' could not be loaded to check if the extension 'sqlite' is available.",
"The keys of the sequence do not match the given constraints.",
"Profile 'invalid_profile' is not available.",
],
'testing_environment' => FALSE,
];
yield 'null profile to valid profile' => [
'new_config' => [
'module' => [
'system' => 0,
'sqlite' => 0,
],
'theme' => [],
'profile' => 'standard',
],
'initial_config' => [
'profile' => NULL,
],
'expected_violations' => [],
'testing_environment' => FALSE,
];
yield 'unset profile: to valid profile' => [
'new_config' => [
'module' => [
'system' => 0,
'sqlite' => 0,
],
'theme' => [],
'profile' => 'minimal',
],
'initial_config' => [
'profile' => '__UNSET__',
],
'expected_violations' => [],
'testing_environment' => FALSE,
];
yield 'unset profile: to invalid profile' => [
'new_config' => [
'module' => [
'system' => 0,
],
'theme' => [],
'profile' => 'invalid_profile',
],
'initial_config' => [
'profile' => '__UNSET__',
],
'expected_violations' => [
"Profile 'invalid_profile' could not be loaded to check if the extension 'system' is available.",
"The keys of the sequence do not match the given constraints.",
"Profile 'invalid_profile' is not available.",
],
'testing_environment' => FALSE,
];
yield 'unset profile: module does not exist' => [
'new_config' => [
'module' => [
'system' => 0,
'sqlite' => 0,
'testing' => 0,
],
'theme' => [],
],
'initial_config' => [
'profile' => '__UNSET__',
],
'expected_violations' => [
"Module 'testing' is not available.",
"The keys of the sequence do not match the given constraints.",
],
'testing_environment' => FALSE,
];
yield 'unset profile: module does exist' => [
'new_config' => [
'module' => [
'system' => 0,
'sqlite' => 0,
'testing' => 0,
],
'theme' => [],
],
'initial_config' => [
'profile' => '__UNSET__',
],
'expected_violations' => [
"Module 'testing' is not available.",
"The keys of the sequence do not match the given constraints.",
],
'testing_environment' => FALSE,
];
yield 'unset profile: testing module does exist if it is same name as a profile' => [
'new_config' => [
'module' => [
'system' => 0,
'sqlite' => 0,
'testing' => 0,
],
'theme' => [],
'profile' => 'testing',
],
'initial_config' => [
'profile' => '__UNSET__',
],
'expected_violations' => [],
'testing_environment' => TRUE,
];
yield 'minimal profile: testing module does exist if it is same name as a profile' => [
'new_config' => [
'module' => [
'system' => 0,
'sqlite' => 0,
'testing' => 0,
],
'theme' => [],
'profile' => 'testing',
],
'initial_config' => [
'profile' => 'minimal',
],
'expected_violations' => [],
'testing_environment' => TRUE,
];
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.