function InfoWriterTrait::writeInfoFile
Same name in other branches
- 11.x core/tests/Drupal/TestTools/Extension/InfoWriterTrait.php \Drupal\TestTools\Extension\InfoWriterTrait::writeInfoFile()
Writes the info file and ensures the mtime changes.
Parameters
string $file_path: The info file path.
array $info: The info array.
Return value
void
3 calls to InfoWriterTrait::writeInfoFile()
- ModulesListFormWebTest::testInstalledIncompatibleModule in core/
modules/ system/ tests/ src/ Functional/ Form/ ModulesListFormWebTest.php - Tests that incompatible modules message is shown.
- ThemeUiTest::testInstalledIncompatibleTheme in core/
modules/ system/ tests/ src/ Functional/ Theme/ ThemeUiTest.php - Tests that incompatible themes message is shown.
- UpdateScriptTest::testExtensionCompatibilityChange in core/
modules/ system/ tests/ src/ Functional/ UpdateSystem/ UpdateScriptTest.php - Tests that extension compatibility changes are handled correctly.
File
-
core/
tests/ Drupal/ TestTools/ Extension/ InfoWriterTrait.php, line 27
Class
- InfoWriterTrait
- Writes the info file and ensures the mtime changes.
Namespace
Drupal\TestTools\ExtensionCode
private function writeInfoFile(string $file_path, array $info) : void {
$mtime = file_exists($file_path) ? filemtime($file_path) : FALSE;
file_put_contents($file_path, Yaml::encode($info));
// Ensure mtime changes.
if ($mtime === filemtime($file_path)) {
touch($file_path, max($mtime + 1, time()));
}
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.