laravel-websockets/tests/TestCase.php

48 lines
1.2 KiB
PHP
Raw Normal View History

2018-11-25 22:43:43 +00:00
<?php
namespace BeyondCode\LaravelWebSockets\Tests;
2018-11-27 20:56:25 +00:00
use BeyondCode\LaravelWebSockets\WebSockets\WebSocketHandler;
2018-11-25 22:43:43 +00:00
use GuzzleHttp\Psr7\Request;
use BeyondCode\LaravelWebSockets\Tests\Mocks\Connection;
2018-11-25 23:40:32 +00:00
use BeyondCode\LaravelWebSockets\WebSocketsServiceProvider;
2018-11-25 22:43:43 +00:00
abstract class TestCase extends \Orchestra\Testbench\TestCase
{
2018-11-27 20:56:25 +00:00
/** @var \BeyondCode\LaravelWebSockets\WebSockets\WebSocketHandler */
protected $pusherServer;
public function setUp()
{
parent::setUp();
$this->pusherServer = app(WebSocketHandler::class);
}
2018-11-25 22:43:43 +00:00
protected function getPackageProviders($app)
{
2018-11-25 23:40:32 +00:00
return [WebSocketsServiceProvider::class];
2018-11-25 22:43:43 +00:00
}
protected function getEnvironmentSetUp($app)
{
$app['config']->set('websockets.clients', [
[
'name' => 'Test Client',
'app_id' => 1234,
'app_key' => 'TestKey',
'app_secret' => 'TestSecret'
]
]);
}
2018-11-25 23:14:50 +00:00
protected function getWebSocketConnection(string $url = '/?appKey=TestKey'): Connection
2018-11-25 22:43:43 +00:00
{
$connection = new Connection();
$connection->httpRequest = new Request('GET', $url);
return $connection;
}
}