Files
izyim-api/tests/Unit/DeliveryinfoTest.php
T
2018-06-12 09:49:24 +08:00

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);
}
}