function ModuleBuilderModuleGenerationTestCase::assertInfoLine in Module Builder 8.3
Assert a string contains a .info file property declaration.
Parameters
$string: The text to check.
$property: The property name, e.g. 'core'.
$value: The value to check, e.g., '7.x'.
$message = NULL: The assertion message.
1 call to ModuleBuilderModuleGenerationTestCase::assertInfoLine()
- ModuleBuilderModuleGenerationTestCase::testModuleGeneration in tests/
module_builder.test - Test generating module code.
File
- tests/
module_builder.test, line 356 - Contains tests for the Module builder module.
Class
- ModuleBuilderModuleGenerationTestCase
- Test case for Module Builder module generation.
Code
function assertInfoLine($string, $property, $value, $message = NULL) {
// Quote the value, as strings may contain regex characters.
$value = preg_quote($value);
$expected_regex = "^{$property} = {$value}\$";
$match = preg_match("[{$expected_regex}]m", $string);
$this
->assertTrue($match, $message);
}