Used a mock ooklatester in tests

Speed up test suite
This commit is contained in:
Henry Whitaker
2021-04-11 08:46:01 +01:00
parent 91b7ec7fab
commit f809f816c1
12 changed files with 154 additions and 14 deletions

View File

@@ -2,6 +2,7 @@
namespace App\Helpers;
use App\Interfaces\SpeedtestProvider;
use App\Models\Speedtest;
use App\Utils\OoklaTester;
use Carbon\Carbon;
@@ -25,7 +26,7 @@ class SpeedtestHelper
*/
public static function runSpeedtest()
{
$tester = new OoklaTester();
$tester = app()->make(SpeedtestProvider::class);
return $tester->run();
}

View File

@@ -0,0 +1,37 @@
<?php
namespace App\Utils\InfluxDB;
use App\Interfaces\InfluxDBWrapperInterface;
use App\Models\Speedtest;
use InfluxDB2\Client;
class InfluxDBVersion2Wrapper implements InfluxDBWrapperInterface
{
private Client $client;
public function __construct(Client $client)
{
$this->client = $client;
}
public function testConnection(): bool
{
return $this->client->health()->getStatus() !== 'pass';
}
public function doesDatabaseExist(string $database): bool
{
return true;
}
public function createDatabase(string $database): bool
{
return true;
}
public function store(Speedtest $speedtest): bool
{
return true;
}
}