OXIESEC PANEL
- Current Dir:
/
/
var
/
www
/
firebase
/
vendor
/
kreait
/
firebase-php
/
tests
/
Unit
/
Messaging
Server IP: 139.59.38.164
Upload:
Create Dir:
Name
Size
Modified
Perms
π
..
-
08/12/2024 10:35:44 AM
rwxr-xr-x
π
AndroidConfigTest.php
2.15 KB
08/12/2024 10:35:42 AM
rw-r--r--
π
ApiClientTest.php
3.47 KB
08/12/2024 10:35:42 AM
rw-r--r--
π
ApnsConfigTest.php
2.67 KB
08/12/2024 10:35:42 AM
rw-r--r--
π
CloudMessageTest.php
5.79 KB
08/12/2024 10:35:42 AM
rw-r--r--
π
ConditionTest.php
1.79 KB
08/12/2024 10:35:42 AM
rw-r--r--
π
MessageDataTest.php
2.81 KB
08/12/2024 10:35:42 AM
rw-r--r--
π
MessageTargetTest.php
486 bytes
08/12/2024 10:35:42 AM
rw-r--r--
π
NotificationTest.php
2.27 KB
08/12/2024 10:35:42 AM
rw-r--r--
π
RegistrationTokenTest.php
805 bytes
08/12/2024 10:35:42 AM
rw-r--r--
π
RegistrationTokensTest.php
1.96 KB
08/12/2024 10:35:42 AM
rw-r--r--
π
TopicTest.php
1.32 KB
08/12/2024 10:35:42 AM
rw-r--r--
π
WebPushConfigTest.php
1.89 KB
08/12/2024 10:35:42 AM
rw-r--r--
Editing: MessageDataTest.php
Close
<?php declare(strict_types=1); namespace Kreait\Firebase\Tests\Unit\Messaging; use InvalidArgumentException; use Kreait\Firebase\Messaging\MessageData; use PHPUnit\Framework\TestCase; /** * @internal */ final class MessageDataTest extends TestCase { /** * @dataProvider validData * * @param array<string, mixed> $data */ public function testItAcceptsValidData(array $data): void { MessageData::fromArray($data); $this->addToAssertionCount(1); } /** * @dataProvider invalidData * * @param array<string, mixed> $data */ public function testItRejectsInvalidData(array $data): void { $this->expectException(InvalidArgumentException::class); MessageData::fromArray($data); } /** * @return array<string, array<int, array<string, mixed>>> */ public function validData(): array { return [ 'integer' => [ ['key' => 1], ], 'float' => [ ['key' => 1.23], ], 'true' => [ ['key' => true], ], 'false' => [ ['key' => false], ], 'null' => [ ['key' => null], ], 'object with __toString()' => [ ['key' => new class() { public function __toString() { return 'value'; } }], ], 'UTF-8 string' => [ ['key' => 'JΓ©rΓ΄me'], ], ]; } /** * @return array<string, array<int, array<string, mixed>>> */ public function invalidData(): array { return [ 'nested array' => [ ['key' => ['sub_key' => 'sub_value']], ], // @see https://github.com/kreait/firebase-php/issues/441 'binary data' => [ ['key' => \hex2bin('81612bcffb')], // generated with \openssl_random_pseudo_bytes(5) ], 'reserved_key_from' => [ ['from' => 'any'], ], // // According to the docs, "notification" is reserved, but it's still accepted Β―\_(γ)_/Β― /* 'reserved_key_notification' => [ ['notification' => 'any'], ], */ 'reserved_key_message_type' => [ ['message_type' => 'any'], ], 'reserved_key_prefix_google' => [ ['google_is_reserved' => 'any'], ], 'reserved_key_prefix_gcm' => [ ['gcm_is_reserved' => 'any'], ], ]; } }