Revert "Fixed mc"
This reverts commit54a20aec46, reversing changes made toa84f143087.
This commit is contained in:
parent
54a20aec46
commit
f27b6901cb
|
|
@ -1,17 +0,0 @@
|
||||||
<?php
|
|
||||||
|
|
||||||
namespace BeyondCode\LaravelWebSockets\Statistics\Http\Middleware;
|
|
||||||
|
|
||||||
use BeyondCode\LaravelWebSockets\Apps\App;
|
|
||||||
|
|
||||||
class Authorize
|
|
||||||
{
|
|
||||||
public function handle($request, $next)
|
|
||||||
{
|
|
||||||
$app = App::findByKey($request->key);
|
|
||||||
|
|
||||||
return is_null($app) || $app->secret !== $request->secret
|
|
||||||
? abort(403)
|
|
||||||
: $next($request);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
@ -1,38 +0,0 @@
|
||||||
<?php
|
|
||||||
|
|
||||||
namespace BeyondCode\LaravelWebSockets\Tests\Statistics\Controllers;
|
|
||||||
|
|
||||||
use BeyondCode\LaravelWebSockets\Statistics\Http\Controllers\WebSocketStatisticsEntriesController;
|
|
||||||
use BeyondCode\LaravelWebSockets\Statistics\Models\WebSocketsStatisticsEntry;
|
|
||||||
use BeyondCode\LaravelWebSockets\Tests\TestCase;
|
|
||||||
|
|
||||||
class WebSocketsStatisticsControllerTest extends TestCase
|
|
||||||
{
|
|
||||||
/** @test */
|
|
||||||
public function it_can_store_statistics()
|
|
||||||
{
|
|
||||||
$this->post(
|
|
||||||
action([WebSocketStatisticsEntriesController::class, 'store']),
|
|
||||||
array_merge($this->payload(), [
|
|
||||||
'key' => config('websockets.apps.0.key'),
|
|
||||||
'secret' => config('websockets.apps.0.secret'),
|
|
||||||
])
|
|
||||||
);
|
|
||||||
|
|
||||||
$entries = WebSocketsStatisticsEntry::get();
|
|
||||||
|
|
||||||
$this->assertCount(1, $entries);
|
|
||||||
|
|
||||||
$this->assertArrayHasKey('app_id', $entries->first()->attributesToArray());
|
|
||||||
}
|
|
||||||
|
|
||||||
protected function payload(): array
|
|
||||||
{
|
|
||||||
return [
|
|
||||||
'app_id' => config('websockets.apps.0.id'),
|
|
||||||
'peak_connection_count' => 1,
|
|
||||||
'websocket_message_count' => 2,
|
|
||||||
'api_message_count' => 3,
|
|
||||||
];
|
|
||||||
}
|
|
||||||
}
|
|
||||||
Loading…
Reference in New Issue