Added unit tests for helpers and tests for commands

This commit is contained in:
Henry Whitaker
2020-08-25 18:26:21 +01:00
parent b30ec477f4
commit 94e4919b44
21 changed files with 927 additions and 1 deletions

View File

@@ -0,0 +1,59 @@
<?php
namespace Tests\Unit\Helpers\SpeedtestHelper;
use App\Helpers\SpeedtestHelper;
use PHPUnit\Framework\TestCase;
class CheckOutputTest extends TestCase
{
/**
* A basic unit test example.
*
* @return void
*/
public function testGoodOutput()
{
$expected = [
'type' => 'result',
'download' => [ 'bandwidth' => '*' ],
'upload' => [ 'bandwidth' => '*' ],
'ping' => [ 'latency' => '*' ],
'server' => [
'id' => '*',
'name' => '*',
'host' => '*',
'port' => '*',
],
'result' => [
'url' => '*',
]
];
$this->assertTrue(SpeedtestHelper::checkOutputIsComplete($expected));
}
/**
* A basic unit test example.
*
* @return void
*/
public function testBadOutput()
{
$expected = [
'type' => 'result',
'download' => [ 'bandwidth' => '*' ],
'server' => [
'id' => '*',
'name' => '*',
'host' => '*',
'port' => '*',
],
'result' => [
'url' => '*',
]
];
$this->assertFalse(SpeedtestHelper::checkOutputIsComplete($expected));
}
}