protected function JsonTrait::readJson in Automatic Updates 8.2
Reads JSON data from a file and returns it as an array.
Parameters
string $path: The path of the file to read.
Return value
mixed[] The parsed data in the file.
3 calls to JsonTrait::readJson()
- LocalPackagesTrait::alterPackage in tests/
src/ Traits/ LocalPackagesTrait.php - Alters a package's composer.json file.
- LocalPackagesTrait::getPackagesFromLockFile in tests/
src/ Traits/ LocalPackagesTrait.php - Reads all package information from a composer.lock file.
- 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 22
Class
- JsonTrait
- Provides assertive methods to read and write JSON data in files.
Namespace
Drupal\Tests\automatic_updates\TraitsCode
protected function readJson(string $path) : array {
Assert::assertIsReadable($path);
$data = file_get_contents($path);
return Json::decode($data);
}