mirror of
https://gitlab.com/CIEFWorldwideSdnBhd/izyim-api.git
synced 2026-08-19 04:24:01 +00:00
58 lines
1.2 KiB
PHP
58 lines
1.2 KiB
PHP
<?php
|
|
|
|
namespace Tests\Unit\ContactTest;
|
|
|
|
use Tests\TestCase;
|
|
use Illuminate\Foundation\Testing\WithFaker;
|
|
use Illuminate\Foundation\Testing\RefreshDatabase;
|
|
use Illuminate\Foundation\Testing\WithoutMiddleware;
|
|
use Artisan;
|
|
use App\User;
|
|
use App\Company;
|
|
|
|
class ContactTest extends TestCase
|
|
{
|
|
protected $company;
|
|
protected $user;
|
|
|
|
public function setUp()
|
|
{
|
|
parent::setUp();
|
|
Artisan::call('db:seed');
|
|
|
|
$this->user = factory(User::class)->create();
|
|
$this->company = $this->user->each(function ($u) {
|
|
factory(Company::class)->create([
|
|
'user_id' => $u->id,
|
|
]);
|
|
});
|
|
}
|
|
|
|
public function testPost()
|
|
{
|
|
$response = $this->actingAs($this->user)
|
|
->postJson('/api/contact', [
|
|
|
|
'com_id' => '1',
|
|
]);
|
|
|
|
$response->assertStatus(200);
|
|
|
|
}
|
|
|
|
public function testApproved()
|
|
{
|
|
$response = $this->actingAs($this->user)
|
|
->postJson('/api/contact/1/', [
|
|
'user_id' => '1',
|
|
'com_id' => '1',
|
|
'status' => '1',
|
|
]);
|
|
|
|
$response->assertStatus(200);
|
|
|
|
}
|
|
|
|
|
|
}
|