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: RegistrationTokensTest.php
Close
<?php declare(strict_types=1); namespace Kreait\Firebase\Tests\Unit\Messaging; use InvalidArgumentException; use Kreait\Firebase\Messaging\RegistrationToken; use Kreait\Firebase\Messaging\RegistrationTokens; use PHPUnit\Framework\TestCase; use stdClass; /** * @internal */ final class RegistrationTokensTest extends TestCase { /** * @dataProvider validValuesWithExpectedCounts * * @param mixed $value */ public function testItCanBeCreatedFromValues(int $expectedCount, $value): void { $tokens = RegistrationTokens::fromValue($value); $this->assertCount($expectedCount, $tokens); $this->assertSame(!$expectedCount, $tokens->isEmpty()); } /** * @dataProvider invalidValues * * @param mixed $value */ public function testItRejectsInvalidValues($value): void { $this->expectException(InvalidArgumentException::class); RegistrationTokens::fromValue($value); } public function testItReturnsStrings(): void { $token = RegistrationToken::fromValue('foo'); $tokens = RegistrationTokens::fromValue([$token, $token]); $this->assertEquals(['foo', 'foo'], $tokens->asStrings()); } /** * @return array<string, array<int, int|mixed>> */ public function validValuesWithExpectedCounts(): array { $foo = RegistrationToken::fromValue('foo'); return [ 'string' => [1, 'foo'], 'token object' => [1, $foo], 'collection' => [2, new RegistrationTokens($foo, $foo)], 'array with mixed values' => [2, [$foo, 'bar']], 'array with an invalid value' => [2, [$foo, new stdClass(), 'bar']], ]; } /** * @return array<string, array<int, mixed>> */ public function invalidValues(): array { return [ 'invalid object' => [new stdClass()], ]; } }