Fix test warnings due to usage of deprecated assertArraySubset()

Also changed app_id to strings where appropriate, in real apps they should be strings when read from environment, not ints.
This commit is contained in:
Francis Lavoie 2019-09-23 15:51:00 -04:00
parent e3c0cea77c
commit db5837831b
No known key found for this signature in database
GPG Key ID: B9E0E04A76AF4692
3 changed files with 10 additions and 6 deletions

View File

@ -46,7 +46,7 @@ class ConnectionTest extends TestCase
$this->pusherServer->onOpen($connection); $this->pusherServer->onOpen($connection);
$this->assertInstanceOf(App::class, $connection->app); $this->assertInstanceOf(App::class, $connection->app);
$this->assertSame(1234, $connection->app->id); $this->assertSame('1234', $connection->app->id);
$this->assertSame('TestKey', $connection->app->key); $this->assertSame('TestKey', $connection->app->key);
$this->assertSame('TestSecret', $connection->app->secret); $this->assertSame('TestSecret', $connection->app->secret);
$this->assertSame('Test App', $connection->app->name); $this->assertSame('Test App', $connection->app->name);

View File

@ -22,16 +22,20 @@ class WebSocketsStatisticsControllerTest extends TestCase
$this->assertCount(1, $entries); $this->assertCount(1, $entries);
$this->assertArraySubset($this->payload(), $entries->first()->attributesToArray()); $actual = $entries->first()->attributesToArray();
foreach ($this->payload() as $key => $value) {
$this->assertArrayHasKey($key, $actual);
$this->assertSame($value, $actual[$key]);
}
} }
protected function payload(): array protected function payload(): array
{ {
return [ return [
'app_id' => config('websockets.apps.0.id'), 'app_id' => config('websockets.apps.0.id'),
'peak_connection_count' => 1, 'peak_connection_count' => '1',
'websocket_message_count' => 2, 'websocket_message_count' => '2',
'api_message_count' => 3, 'api_message_count' => '3',
]; ];
} }
} }

View File

@ -46,7 +46,7 @@ abstract class TestCase extends \Orchestra\Testbench\TestCase
$app['config']->set('websockets.apps', [ $app['config']->set('websockets.apps', [
[ [
'name' => 'Test App', 'name' => 'Test App',
'id' => 1234, 'id' => '1234',
'key' => 'TestKey', 'key' => 'TestKey',
'secret' => 'TestSecret', 'secret' => 'TestSecret',
'host' => 'localhost', 'host' => 'localhost',