mirror of
https://gitlab.com/CIEFWorldwideSdnBhd/izyim-api.git
synced 2026-08-19 04:24:01 +00:00
updated docker to fix faker image error
updated on user phone verification, create a company profile removed company store function updated company with user relationship added company factory moved company routes into authenticated routes updated company test renamed "verify" routes to "verify-phone"
This commit is contained in:
@@ -7,40 +7,31 @@ use Illuminate\Foundation\Testing\WithFaker;
|
||||
use Illuminate\Foundation\Testing\RefreshDatabase;
|
||||
use Illuminate\Http\UploadedFile;
|
||||
use Illuminate\Support\Facades\Storage;
|
||||
use Artisan;
|
||||
use App\User;
|
||||
use App\Company;
|
||||
|
||||
class CompanyTest extends TestCase
|
||||
{
|
||||
/**
|
||||
* A basic test example.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function testExample()
|
||||
protected $company;
|
||||
protected $user;
|
||||
|
||||
public function setUp()
|
||||
{
|
||||
$this->assertTrue(true);
|
||||
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 testUpdateCompany()
|
||||
{
|
||||
$response = $this->json('POST', '/api/company', [
|
||||
'company_name'=>'testing',
|
||||
'registration_no'=>'testing',
|
||||
'tax_no'=>'testing',
|
||||
'tel_no'=>'12345',
|
||||
'fax'=>'12345',
|
||||
'address'=>'testing',
|
||||
'city'=>'testing',
|
||||
'postcode'=>'testing',
|
||||
'state'=>'testing',
|
||||
'country'=>'testing',
|
||||
'contact_person'=>'testing',
|
||||
]);
|
||||
$response->assertStatus(201);
|
||||
}
|
||||
|
||||
public function testPUT()
|
||||
{
|
||||
$response = $this->json('PUT', '/api/company/2', [
|
||||
$response = $this->actingAs($this->user)
|
||||
->patchJson('/api/company', [
|
||||
'company_name'=>'changed testing',
|
||||
'registration_no'=>'testing',
|
||||
'tax_no'=>'testing',
|
||||
@@ -52,29 +43,32 @@ class CompanyTest extends TestCase
|
||||
'state'=>'testing',
|
||||
'country'=>'testing',
|
||||
'contact_person'=>'testing',
|
||||
|
||||
]);
|
||||
$response->assertStatus(200);
|
||||
|
||||
}
|
||||
|
||||
public function testcompanyProfile()
|
||||
{
|
||||
public function testUploadCompanyProfile()
|
||||
{
|
||||
Storage::fake('company_profile');
|
||||
|
||||
$response = $this->json('POST', '/api/company/company_profile/2', [
|
||||
|
||||
$response = $this->actingAs($this->user)
|
||||
->json('POST', '/api/company/company_profile/', [
|
||||
'company_profile' => UploadedFile::fake()->image('comp.jpg')
|
||||
]);
|
||||
dd($response->getContent());
|
||||
// dd($response->getContent());
|
||||
$response->assertStatus(200);
|
||||
}
|
||||
|
||||
public function testregCert()
|
||||
public function testUploadRegCert()
|
||||
{
|
||||
Storage::fake('reg_cert');
|
||||
|
||||
$response = $this->json('POST', '/api/company/reg_cert/2', [
|
||||
$response = $this->actingAs($this->user)
|
||||
->json('POST', '/api/company/reg_cert/', [
|
||||
'reg_cert' => UploadedFile::fake()->create('document.pdf')//, $sizeInKilobytes)
|
||||
]);
|
||||
dd($response->getContent());
|
||||
$response->assertStatus(200);
|
||||
}
|
||||
}
|
||||
@@ -13,7 +13,7 @@ class LoginTest extends TestCase
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function testExample()
|
||||
public function testLogin()
|
||||
{
|
||||
$response = $this->json('POST', '/api/login', ['phone' => '0123456789','password' => 'secret']);
|
||||
$response
|
||||
|
||||
@@ -26,7 +26,7 @@ class RegisterTest extends TestCase
|
||||
'success' => true,
|
||||
]);
|
||||
|
||||
$response = $this->json('POST', '/api/verify', ['phone' => '0123456789', 'token' => '1234']);
|
||||
$response = $this->json('POST', '/api/verify-phone', ['phone' => '0123456789', 'token' => '1234']);
|
||||
$response
|
||||
->assertStatus(200)
|
||||
->assertJson([
|
||||
|
||||
@@ -1,19 +0,0 @@
|
||||
<?php
|
||||
|
||||
namespace Tests\Unit;
|
||||
|
||||
use Tests\TestCase;
|
||||
use Illuminate\Foundation\Testing\RefreshDatabase;
|
||||
|
||||
class ExampleTest extends TestCase
|
||||
{
|
||||
/**
|
||||
* A basic test example.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function testBasicTest()
|
||||
{
|
||||
$this->assertTrue(true);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user