Allow non-numeric app ids

This commit is contained in:
Marcel Pociot 2018-12-03 10:06:40 +01:00
parent 9e328d33e5
commit 775861ab88
5 changed files with 13 additions and 15 deletions

View File

@ -21,7 +21,7 @@ class App
/** @var bool */
public $clientMessagesEnabled = false;
public static function findById(int $appId)
public static function findById($appId)
{
return app(AppProvider::class)->findById($appId);
}
@ -33,10 +33,6 @@ class App
public function __construct($appId, string $appKey, string $appSecret)
{
if (!is_numeric($appId)) {
throw InvalidApp::appIdIsNotNumeric($appId);
}
if ($appKey === '') {
throw InvalidApp::valueIsRequired('appKey', $appId);
}

View File

@ -7,7 +7,7 @@ interface AppProvider
/** @return array[BeyondCode\LaravelWebSockets\AppProviders\App] */
public function all(): array;
public function findById(int $appId): ?App;
public function findById($appId): ?App;
public function findByKey(string $appKey): ?App;
}

View File

@ -24,7 +24,7 @@ class ConfigAppProvider implements AppProvider
->toArray();
}
public function findById(int $appId): ?App
public function findById($appId): ?App
{
$appAttributes = $this
->apps

View File

@ -31,12 +31,4 @@ class AppTest extends TestCase
new App(1, 'appKey', '', 'new');
}
/** @test */
public function it_will_not_accept_an_non_numeric_appId()
{
$this->expectException(InvalidApp::class);
new App('appId', 'appKey', '', 'new');
}
}

View File

@ -0,0 +1,10 @@
<?php
namespace BeyondCode\LaravelWebsockets\Tests\HttpApi;
class FetchChannelTest
{
}