Files
Speedtest-Tracker/tests/Unit/Helpers/SpeedtestHelper/CheckOutputTest.php
2020-08-25 18:26:21 +01:00

60 lines
1.3 KiB
PHP

<?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));
}
}