mirror of
https://gitlab.com/CIEFWorldwideSdnBhd/izyim-api.git
synced 2026-08-19 04:24:01 +00:00
completed the user intergration
This commit is contained in:
@@ -7,57 +7,35 @@ use Tests\TestCase;
|
||||
use Illuminate\Foundation\Testing\WithFaker;
|
||||
use Illuminate\Foundation\Testing\RefreshDatabase;
|
||||
use Illuminate\Foundation\Testing\WithoutMiddleware;
|
||||
use Artisan;
|
||||
use App\Deliveryinfo;
|
||||
|
||||
class DeliveryinfoTest extends TestCase
|
||||
{
|
||||
/**
|
||||
* A basic test example.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function testGET()
|
||||
{
|
||||
$response = $this->json('GET', '/api/company/deliveryinfo');
|
||||
protected $company;
|
||||
protected $user;
|
||||
|
||||
$response->assertStatus(200);
|
||||
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()
|
||||
public function testPUT()
|
||||
{
|
||||
$response = $this->json('POST', '/api/company/com_id/deliveryinfo', [
|
||||
|
||||
$response = $this->actingAs($this->company)
|
||||
->patchJson('/api/deliveryinfo', [
|
||||
|
||||
'branch' => 'Testing',
|
||||
'deli_info' => 'Testing',
|
||||
'address' => 'Testing',
|
||||
'city' => 'Testing',
|
||||
'postcode' => '12345',
|
||||
'state' => 'Testing',
|
||||
'country' => 'Testing',
|
||||
'contact_person' => 'Testing',
|
||||
'contact_person_no' => '12345',
|
||||
|
||||
]);
|
||||
|
||||
$response->assertStatus(201);
|
||||
}
|
||||
|
||||
public function testDELETE()
|
||||
{
|
||||
$response = $this->json('DELETE', '/api/company/4/deliveryinfo');
|
||||
|
||||
$response->assertStatus(204);
|
||||
}
|
||||
|
||||
public function testPUT()
|
||||
{
|
||||
|
||||
|
||||
$response = $this->json('PUT', '/api/company/1/deliveryinfo', [
|
||||
|
||||
//'id' => '1',
|
||||
'branch' => 'Ci',
|
||||
'deli_info' => 'Testing',
|
||||
'address' => 'Testing',
|
||||
'city' => 'Test',
|
||||
'postcode' => '12345',
|
||||
'state' => 'Testing',
|
||||
@@ -67,6 +45,15 @@ class DeliveryinfoTest extends TestCase
|
||||
|
||||
]);
|
||||
|
||||
$response->assertStatus(200);
|
||||
$response->assertStatus(200);
|
||||
}
|
||||
|
||||
public function testDELETE()
|
||||
{
|
||||
$response = $this->json('DELETE', '/api/company/1/deliveryinfo');
|
||||
|
||||
$response->assertStatus(204);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user