OXIESEC PANEL
- Current Dir:
/
/
var
/
www
/
firebase
/
vendor
/
kreait
/
firebase-php
/
tests
/
Unit
/
Util
Server IP: 139.59.38.164
Upload:
Create Dir:
Name
Size
Modified
Perms
📁
..
-
08/12/2024 10:35:44 AM
rwxr-xr-x
📄
AuthError.php
982 bytes
08/12/2024 10:35:43 AM
rw-r--r--
📄
DTTest.php
2.67 KB
08/12/2024 10:35:43 AM
rw-r--r--
📄
JSONTest.php
1.31 KB
08/12/2024 10:35:44 AM
rw-r--r--
Editing: JSONTest.php
Close
<?php declare(strict_types=1); namespace Kreait\Firebase\Tests\Unit\Util; use Kreait\Firebase\Exception\InvalidArgumentException; use Kreait\Firebase\Tests\UnitTestCase; use Kreait\Firebase\Util\JSON; /** * @internal */ final class JSONTest extends UnitTestCase { public function testEncodeJson(): void { $this->assertSame(\json_encode(true), JSON::encode(true)); } public function testEncodeInvalidJson(): void { $this->expectException(InvalidArgumentException::class); JSON::encode(INF); } public function testDecodeJson(): void { $this->assertSame(\json_decode('true', false), JSON::decode('true', false)); $this->assertSame(\json_decode('true', true), JSON::decode('true', true)); } public function testDecodeInvalidJson(): void { $this->expectException(InvalidArgumentException::class); JSON::decode('{'); } public function testIsValid(): void { $this->assertTrue(JSON::isValid(\json_encode([]))); $this->assertFalse(JSON::isValid('<html></html>')); } public function testPrettyPrint(): void { $data = ['foo' => 'bar']; $this->assertSame(\json_encode($data, JSON_PRETTY_PRINT), JSON::prettyPrint($data)); } }