mirror of
https://github.com/cerbero90/json-parser.git
synced 2025-01-17 21:18:41 +01:00
24 lines
808 B
PHP
24 lines
808 B
PHP
<?php
|
|
|
|
use Cerbero\JsonParser\Dataset;
|
|
use Cerbero\JsonParser\JsonParser;
|
|
|
|
use function Cerbero\JsonParser\parseJson;
|
|
|
|
|
|
it('parses JSON when instantiated', function (string $json, array $parsed) {
|
|
expect(new JsonParser($json))->toParseTo($parsed);
|
|
})->with(Dataset::forParsing());
|
|
|
|
it('parses JSON when instantiated statically', function (string $json, array $parsed) {
|
|
expect(JsonParser::parse($json))->toParseTo($parsed);
|
|
})->with(Dataset::forParsing());
|
|
|
|
it('parses JSON when calling the helper', function (string $json, array $parsed) {
|
|
expect(parseJson($json))->toParseTo($parsed);
|
|
})->with(Dataset::forParsing());
|
|
|
|
it('eager loads JSON into an array', function (string $json, array $parsed) {
|
|
expect(JsonParser::parse($json)->toArray())->toBe($parsed);
|
|
})->with(Dataset::forParsing());
|