mirror of
https://github.com/henrywhitaker3/Speedtest-Tracker.git
synced 2025-12-25 06:49:15 +01:00
Added unit tests for helpers and tests for commands
This commit is contained in:
59
tests/Unit/Helpers/SpeedtestHelper/CheckOutputTest.php
Normal file
59
tests/Unit/Helpers/SpeedtestHelper/CheckOutputTest.php
Normal 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));
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user