protected function JsonTrait::writeJson in Automatic Updates 8.2
Writes an array of data to a file as JSON.
Parameters
string $path: The path of the file to write.
array $data: The data to be written.
3 calls to JsonTrait::writeJson()
- LocalPackagesTrait::alterPackage in tests/
src/ Traits/ LocalPackagesTrait.php - Alters a package's composer.json file.
- LocalPackagesTrait::getLocalPackageRepositories in tests/
src/ Traits/ LocalPackagesTrait.php - Generates local path repositories for a set of installed packages.
- UpdateTestBase::createTestSite in tests/
src/ Build/ UpdateTestBase.php - Uses our already-installed dependencies to build a test site to update.
File
- tests/
src/ Traits/ JsonTrait.php, line 36
Class
- JsonTrait
- Provides assertive methods to read and write JSON data in files.
Namespace
Drupal\Tests\automatic_updates\TraitsCode
protected function writeJson(string $path, array $data) : void {
Assert::assertIsWritable(file_exists($path) ? $path : dirname($path));
file_put_contents($path, Json::encode($data));
}