Allow non-numeric app ids
This commit is contained in:
parent
9e328d33e5
commit
775861ab88
|
|
@ -21,7 +21,7 @@ class App
|
||||||
/** @var bool */
|
/** @var bool */
|
||||||
public $clientMessagesEnabled = false;
|
public $clientMessagesEnabled = false;
|
||||||
|
|
||||||
public static function findById(int $appId)
|
public static function findById($appId)
|
||||||
{
|
{
|
||||||
return app(AppProvider::class)->findById($appId);
|
return app(AppProvider::class)->findById($appId);
|
||||||
}
|
}
|
||||||
|
|
@ -33,10 +33,6 @@ class App
|
||||||
|
|
||||||
public function __construct($appId, string $appKey, string $appSecret)
|
public function __construct($appId, string $appKey, string $appSecret)
|
||||||
{
|
{
|
||||||
if (!is_numeric($appId)) {
|
|
||||||
throw InvalidApp::appIdIsNotNumeric($appId);
|
|
||||||
}
|
|
||||||
|
|
||||||
if ($appKey === '') {
|
if ($appKey === '') {
|
||||||
throw InvalidApp::valueIsRequired('appKey', $appId);
|
throw InvalidApp::valueIsRequired('appKey', $appId);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -7,7 +7,7 @@ interface AppProvider
|
||||||
/** @return array[BeyondCode\LaravelWebSockets\AppProviders\App] */
|
/** @return array[BeyondCode\LaravelWebSockets\AppProviders\App] */
|
||||||
public function all(): array;
|
public function all(): array;
|
||||||
|
|
||||||
public function findById(int $appId): ?App;
|
public function findById($appId): ?App;
|
||||||
|
|
||||||
public function findByKey(string $appKey): ?App;
|
public function findByKey(string $appKey): ?App;
|
||||||
}
|
}
|
||||||
|
|
@ -24,7 +24,7 @@ class ConfigAppProvider implements AppProvider
|
||||||
->toArray();
|
->toArray();
|
||||||
}
|
}
|
||||||
|
|
||||||
public function findById(int $appId): ?App
|
public function findById($appId): ?App
|
||||||
{
|
{
|
||||||
$appAttributes = $this
|
$appAttributes = $this
|
||||||
->apps
|
->apps
|
||||||
|
|
|
||||||
|
|
@ -31,12 +31,4 @@ class AppTest extends TestCase
|
||||||
|
|
||||||
new App(1, 'appKey', '', 'new');
|
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');
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
@ -0,0 +1,10 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
|
||||||
|
namespace BeyondCode\LaravelWebsockets\Tests\HttpApi;
|
||||||
|
|
||||||
|
|
||||||
|
class FetchChannelTest
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
Loading…
Reference in New Issue