Skip to content
Snippets Groups Projects
Commit 98149aab authored by Tibo's avatar Tibo
Browse files

migrate test to browser kit

parent 96f1f574
No related branches found
No related tags found
No related merge requests found
Pipeline #14027 passed
This diff is collapsed.
......@@ -16,10 +16,10 @@ class ExampleTest extends TestCase
public function testBasicTest()
{
$this->get('/')->assertStatus(200);
$this->get('/')->assertResponseOk();
}
public function testRecord()
public function testPing()
{
$organization = new Organization();
$organization->name = "TEST";
......@@ -29,12 +29,12 @@ class ExampleTest extends TestCase
$server->name = "srv01";
$organization->servers()->save($server);
$this->post('/api/record/' . $server->id, [])->assertStatus(403);
$this->post('/api/record/' . $server->id, ["token" => "abc123"])->assertStatus(403);
$this->post('/api/record/' . $server->id, [])->assertResponseStatus(403);
$this->post('/api/record/' . $server->id, ["token" => "abc123"])->assertResponseStatus(403);
$data = json_decode(file_get_contents(__DIR__ . "/ping.json"), true);
$data["token"] = $server->token;
$this->post('/api/record/' . $server->id, $data)->assertStatus(200);
$this->post('/api/record/' . $server->id, $data)->assertResponseOk();
}
}
......@@ -2,9 +2,11 @@
namespace Tests;
use Illuminate\Foundation\Testing\TestCase as BaseTestCase;
use Laravel\BrowserKitTesting\TestCase as BaseTestCase;
abstract class TestCase extends BaseTestCase
{
use CreatesApplication;
public $baseUrl = 'http://localhost:8000';
}
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment