mirror of
https://github.com/henrywhitaker3/Speedtest-Tracker.git
synced 2025-12-24 06:28:27 +01:00
Added more tests and fixed changelog
This commit is contained in:
43
tests/Unit/Controllers/SpeedtestController/FailTest.php
Normal file
43
tests/Unit/Controllers/SpeedtestController/FailTest.php
Normal file
@@ -0,0 +1,43 @@
|
||||
<?php
|
||||
|
||||
namespace Tests\Unit\Controllers\SpeedtestController;
|
||||
|
||||
use App\Http\Controllers\SpeedtestController;
|
||||
use Illuminate\Foundation\Testing\RefreshDatabase;
|
||||
use Tests\TestCase;
|
||||
|
||||
class FailTest extends TestCase
|
||||
{
|
||||
use RefreshDatabase;
|
||||
|
||||
/**
|
||||
* SpeedtestController
|
||||
*
|
||||
* @var SpeedtestController
|
||||
*/
|
||||
private $controller;
|
||||
|
||||
public function setUp() : void
|
||||
{
|
||||
parent::setUp();
|
||||
|
||||
$this->controller = new SpeedtestController();
|
||||
}
|
||||
|
||||
public function testFail()
|
||||
{
|
||||
$resp = $this->controller->fail(5)->original;
|
||||
|
||||
$this->assertArrayHasKey('method', $resp);
|
||||
$this->assertArrayHasKey('data', $resp);
|
||||
$this->assertArrayHasKey('days', $resp);
|
||||
}
|
||||
|
||||
public function testFailInvalidInput()
|
||||
{
|
||||
$resp = $this->controller->fail('test')->original;
|
||||
|
||||
$this->assertArrayHasKey('method', $resp);
|
||||
$this->assertArrayHasKey('error', $resp);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user