search company and id storing test

This commit is contained in:
Asif
2018-05-16 16:23:04 +08:00
184 changed files with 1828 additions and 186 deletions
+26
View File
@@ -0,0 +1,26 @@
<?php
namespace Tests\Feature;
use Tests\TestCase;
use Illuminate\Foundation\Testing\WithFaker;
use Illuminate\Foundation\Testing\RefreshDatabase;
class LoginTest extends TestCase
{
/**
* A basic test example.
*
* @return void
*/
public function testExample()
{
$response = $this->json('POST', '/api/login', ['phone' => '01234567899','password' => '123']);
$response
->assertStatus(201)
->assertJson([
'created' => true,
]);
}
}
+26
View File
@@ -0,0 +1,26 @@
<?php
namespace Tests\Feature;
use Tests\TestCase;
use Illuminate\Foundation\Testing\WithFaker;
use Illuminate\Foundation\Testing\RefreshDatabase;
class RegisterTest extends TestCase
{
/**
* A basic test example.
*
* @return void
*/
public function testRegister()
{
$response = $this->json('POST', '/api/register', ['name' => 'Sally']);
$response
->assertStatus(201)
->assertJson([
'created' => true,
]);
}
}
+8
View File
@@ -7,4 +7,12 @@ use Illuminate\Foundation\Testing\TestCase as BaseTestCase;
abstract class TestCase extends BaseTestCase
{
use CreatesApplication;
protected function headers($user = null)
{
$token = "eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJpc3MiOiJodHRwOlwvXC8xMjcuMC4wLjE6ODAwMFwvYXBpXC9sb2dpbiIsImlhdCI6MTUyNjQ1ODExMiwiZXhwIjoxNTI3NjY3NzEyLCJuYmYiOjE1MjY0NTgxMTIsImp0aSI6InVnOFJnellnbzlVNWxWQ1kiLCJzdWIiOjUsInBydiI6Ijg3ZTBhZjFlZjlmZDE1ODEyZmRlYzk3MTUzYTE0ZTBiMDQ3NTQ2YWEifQ.NosAWtXlIPzGVYYz46CoPhseo0WQPQZpuR1t9mCwvX0";
$headers = ['HTTP_Authorization' => 'Bearer '.$token];
return $headers;
}
}
+12 -101
View File
@@ -10,111 +10,22 @@ use Illuminate\Foundation\Testing\WithoutMiddleware;
class contactTest extends TestCase
{
/**
* A basic test example.
*
* @return void
*/
public function testBasicExample()
{
$response = $this->json('POST', '/api/contacts', ['ff_id' => '14']);
$response
->assertStatus(201);
// ->assertJson(
// [
// 'success' => true,
// 'message' => 'Success'
// //'response' => [
// // 'id' => $contacts->ff_id,
// // ]
// ]);
}
public function testGet()
// {
// $response = $this->json('GET', '/api/contacts');
//
// $response
// ->assertStatus(200);
//
// }
{
$response = $this->json('GET', '/api/company/search/cief');
$response
->assertStatus(200);
}
public function testStoreId()
{
$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 '
]);
$response = $this->json('POST', '/api/contacts', ['company_id' => '1'], $this->headers());
$response
->assertStatus(200);
// ->assertJson([
//
// ]
// );
->assertStatus(201);
}
}
+120
View File
@@ -0,0 +1,120 @@
<?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;
class warehouseTest extends TestCase
{
/**
* A basic test example.
*
* @return void
*/
public function testBasicExample()
{
$response = $this->json('POST', '/api/contacts', ['ff_id' => '14']);
$response
->assertStatus(201);
// ->assertJson(
// [
// 'success' => true,
// 'message' => 'Success'
// //'response' => [
// // 'id' => $contacts->ff_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 '
]);
$response
->assertStatus(200);
// ->assertJson([
//
// ]
// );
}
}