mirror of
https://gitlab.com/CIEFWorldwideSdnBhd/izyim-api.git
synced 2026-08-19 04:24:01 +00:00
bug fixing
This commit is contained in:
+63
-101
@@ -1,120 +1,82 @@
|
||||
<?php
|
||||
|
||||
namespace Tests\Unit\warehouseTest;
|
||||
namespace Tests\API;
|
||||
|
||||
use Tests\TestCase;
|
||||
use Illuminate\Foundation\Testing\WithFaker;
|
||||
use Illuminate\Foundation\Testing\RefreshDatabase;
|
||||
use Illuminate\Foundation\Testing\WithoutMiddleware;
|
||||
use App\User;
|
||||
use App\Company;
|
||||
use Artisan;
|
||||
|
||||
class warehouseTest extends TestCase
|
||||
class WarehouseTest extends TestCase
|
||||
{
|
||||
/**
|
||||
* A basic test example.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function testBasicExample()
|
||||
{
|
||||
$response = $this->json('POST', '/api/contacts', ['ff_id' => '14']);
|
||||
protected $company;
|
||||
protected $user;
|
||||
|
||||
$response
|
||||
->assertStatus(201);
|
||||
// ->assertJson(
|
||||
// [
|
||||
// 'success' => true,
|
||||
// 'message' => 'Success'
|
||||
// //'response' => [
|
||||
// // 'id' => $contacts->ff_id,
|
||||
// // ]
|
||||
// ]);
|
||||
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 testGet()
|
||||
// {
|
||||
// $response = $this->json('GET', '/api/contacts');
|
||||
//
|
||||
// $response
|
||||
// ->assertStatus(200);
|
||||
//
|
||||
// }
|
||||
{
|
||||
$response = $this->get('/api/contacts');
|
||||
|
||||
$response->assertStatus(200);
|
||||
}
|
||||
|
||||
// public function testUPdate()
|
||||
// {
|
||||
//
|
||||
// $response = $this->json('PUT', '/api/warehouse/{war_id}' . $article->id, $payload, $headers)
|
||||
// ->assertStatus(200)
|
||||
// ->assertJson([
|
||||
// 'id' => 1,
|
||||
// 'title' => 'Lorem',
|
||||
// 'body' => 'Ipsum'
|
||||
// ]);
|
||||
// }
|
||||
|
||||
// public function testPostWarehouse()
|
||||
// {
|
||||
// $response = $this->json('POST', '/api/warehouse', [
|
||||
//
|
||||
// 'address'=> '2d',
|
||||
// 'city'=>'cj ',
|
||||
// 'zip'=>' 123',
|
||||
// 'state' =>' sl',
|
||||
// 'contact_person' =>'asif ',
|
||||
// 'contact_person_no' =>'1212122 ',
|
||||
// 'branch'=>'yap ',
|
||||
// 'country' =>' ba',
|
||||
// 'company_id' =>'1212 '
|
||||
//
|
||||
//
|
||||
//
|
||||
//
|
||||
//
|
||||
//
|
||||
// ]);
|
||||
//
|
||||
// $response
|
||||
// ->assertStatus(201);
|
||||
//// ->assertJson([
|
||||
//// 'created' => true,
|
||||
// // ]
|
||||
// //);
|
||||
// }
|
||||
|
||||
public function testPutWarehouse()
|
||||
{
|
||||
$response = $this->json('PUT', '/api/warehouse/6', [
|
||||
|
||||
'address'=> '2g',
|
||||
'city'=>'cj ',
|
||||
'zip'=>' 123',
|
||||
'state' =>' sl',
|
||||
'contact_person' =>'tuytguy',
|
||||
'contact_person_no' =>'1212122 ',
|
||||
'branch'=>'yap ',
|
||||
'country' =>' ba',
|
||||
'company_id' =>'1212 '
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
public function testPost()
|
||||
{
|
||||
$response = $this->actingAs($this->user)
|
||||
->postJson('/api/warehouse', [
|
||||
|
||||
'address'=> 'Testing',
|
||||
'city'=>'Testing ',
|
||||
'zip'=>' Testing',
|
||||
'state' =>'Testing',
|
||||
'contact_person' =>'Testing ',
|
||||
'contact_person_no' =>'12345 ',
|
||||
'branch'=>'Testing ',
|
||||
'country' =>' Testing',
|
||||
'com_id' =>'99'
|
||||
|
||||
]);
|
||||
|
||||
$response
|
||||
->assertStatus(200);
|
||||
// ->assertJson([
|
||||
//
|
||||
// ]
|
||||
// );
|
||||
$response->assertStatus(201);
|
||||
|
||||
}
|
||||
|
||||
public function testUpdate()
|
||||
{
|
||||
|
||||
$response = $this->actingAs($this->user)
|
||||
->patchJson('/api/warehouse', [
|
||||
|
||||
'address' => 'Changed Testing',
|
||||
'city' => 'Testing ',
|
||||
'zip' => ' Testing',
|
||||
'state' => 'Testing',
|
||||
'contact_person' => 'Testing ',
|
||||
'contact_person_no' => '12345 ',
|
||||
'branch' => 'Testing ',
|
||||
'country' => ' Testing',
|
||||
'com_id' => '99'
|
||||
|
||||
]);
|
||||
|
||||
$response->assertStatus(201);
|
||||
|
||||
}
|
||||
|
||||
public function testDelete()
|
||||
{
|
||||
$this->actingAs($this->user)
|
||||
->json('DELETE', '/api/so/99');
|
||||
|
||||
$response->assertStatus(204);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user