mirror of
https://gitlab.com/CIEFWorldwideSdnBhd/izyim-api.git
synced 2026-08-19 12:34:06 +00:00
60 lines
1.4 KiB
PHP
60 lines
1.4 KiB
PHP
<?php
|
|
|
|
namespace Tests\Unit\Deliveryinfo;
|
|
namespace Test\API;
|
|
|
|
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
|
|
{
|
|
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 testPUT()
|
|
{
|
|
|
|
$response = $this->actingAs($this->company)
|
|
->patchJson('/api/deliveryinfo', [
|
|
|
|
'branch' => 'Testing',
|
|
'deli_info' => 'Testing',
|
|
'address' => 'Testing',
|
|
'city' => 'Test',
|
|
'postcode' => '12345',
|
|
'state' => 'Testing',
|
|
'country' => 'Testing',
|
|
'contact_person' => 'Testing',
|
|
'contact_person_no' => '12345'
|
|
|
|
]);
|
|
|
|
$response->assertStatus(200);
|
|
}
|
|
|
|
public function testDELETE()
|
|
{
|
|
$response = $this->json('DELETE', '/api/company/1/deliveryinfo');
|
|
|
|
$response->assertStatus(204);
|
|
}
|
|
|
|
|
|
}
|