Files
Jack Goh 5df307a165 make all test pass
updated seeder to be informative
fix seeder error on test
2018-08-01 15:30:19 +08:00

38 lines
819 B
PHP

<?php
namespace Tests\Feature;
use Tests\TestCase;
use Illuminate\Foundation\Testing\WithFaker;
use Illuminate\Foundation\Testing\RefreshDatabase;
use App\User;
use App\Role;
use Artisan;
class MarkingTest extends TestCase
{
protected $user;
public function setUp()
{
parent::setUp();
\DB::statement('SET FOREIGN_KEY_CHECKS=0');
Artisan::call('db:seed');
\DB::statement('SET FOREIGN_KEY_CHECKS=1');
$this->user = factory(User::class)->create();
$this->user->attachRole(Role::Where('name','admin')->first());
}
public function testCreate(){
$response =
$this->actingAs($this->user)
->postJson('/api/setting-marking/',[
'email' => 'user@example.com',
'marking' => 'markingcode123'
])
->assertStatus(201);
}
}