Fix some tests

This commit is contained in:
Henry Whitaker
2021-03-07 14:05:41 +00:00
parent ac4fd6cb20
commit a71356f197
6 changed files with 29 additions and 17 deletions

View File

@@ -2,11 +2,18 @@
namespace Tests\Unit\Helpers\SpeedtestHelper;
use App\Helpers\SpeedtestHelper;
use App\Utils\OoklaTester;
use PHPUnit\Framework\TestCase;
class CheckOutputTest extends TestCase
{
private OoklaTester $speedtestProvider;
public function __construct()
{
$this->speedtestProvider = new OoklaTester();
}
/**
* A basic unit test example.
*
@@ -16,9 +23,9 @@ class CheckOutputTest extends TestCase
{
$expected = [
'type' => 'result',
'download' => [ 'bandwidth' => '*' ],
'upload' => [ 'bandwidth' => '*' ],
'ping' => [ 'latency' => '*' ],
'download' => ['bandwidth' => '*'],
'upload' => ['bandwidth' => '*'],
'ping' => ['latency' => '*'],
'server' => [
'id' => '*',
'name' => '*',
@@ -30,7 +37,7 @@ class CheckOutputTest extends TestCase
]
];
$this->assertTrue(SpeedtestHelper::checkOutputIsComplete($expected));
$this->assertTrue($this->speedtestProvider->isOutputComplete($expected));
}
/**
@@ -42,7 +49,7 @@ class CheckOutputTest extends TestCase
{
$expected = [
'type' => 'result',
'download' => [ 'bandwidth' => '*' ],
'download' => ['bandwidth' => '*'],
'server' => [
'id' => '*',
'name' => '*',
@@ -54,6 +61,6 @@ class CheckOutputTest extends TestCase
]
];
$this->assertFalse(SpeedtestHelper::checkOutputIsComplete($expected));
$this->assertFalse($this->speedtestProvider->isOutputComplete($expected));
}
}