mirror of
https://gitlab.com/omair-personal/exchange.git
synced 2026-08-19 04:24:08 +00:00
Add test for settingcredit and rate
This commit is contained in:
@@ -1,6 +1,6 @@
|
||||
<?php
|
||||
|
||||
namespace Tests\Unit\BookingTest;
|
||||
namespace Tests\Feature;
|
||||
|
||||
use Tests\TestCase;
|
||||
use Illuminate\Foundation\Testing\WithoutMiddleware;
|
||||
@@ -15,6 +15,7 @@ use Artisan;
|
||||
use App\User;
|
||||
use App\Booking;
|
||||
use App\UserBankSlip;
|
||||
use App\Role;
|
||||
|
||||
class BookingTest extends TestCase
|
||||
{
|
||||
@@ -26,6 +27,7 @@ class BookingTest extends TestCase
|
||||
{
|
||||
parent::setUp();
|
||||
Artisan::call('db:seed');
|
||||
|
||||
$this->user = factory(User::class)->create();
|
||||
$this->booking = factory(Booking::class)->create([
|
||||
'user_id' => $this->user->id
|
||||
@@ -33,6 +35,7 @@ class BookingTest extends TestCase
|
||||
$this->userBankSlip = factory(UserBankSlip::class)->create([
|
||||
'booking_id' => $this->booking->id
|
||||
]);
|
||||
$this->user->attachRole(Role::Where('name','member')->first());
|
||||
}
|
||||
|
||||
public function testPost()
|
||||
|
||||
@@ -0,0 +1,61 @@
|
||||
<?php
|
||||
|
||||
namespace Tests\Feature;
|
||||
|
||||
use Tests\TestCase;
|
||||
use Illuminate\Foundation\Testing\WithFaker;
|
||||
use Illuminate\Foundation\Testing\RefreshDatabase;
|
||||
use App\Role;
|
||||
use Artisan;
|
||||
use App\User;
|
||||
use App\Rate;
|
||||
|
||||
class RateTest extends TestCase
|
||||
{
|
||||
/**
|
||||
* A basic test example.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
|
||||
protected $user;
|
||||
protected $rate;
|
||||
|
||||
public function setUp()
|
||||
{
|
||||
parent::setUp();
|
||||
Artisan::call('db:seed');
|
||||
|
||||
$this->user = factory(User::class)->create();
|
||||
$this->rate = factory(Rate::class)->create();
|
||||
$this->user->attachRole(Role::Where('name','admin')->first());
|
||||
}
|
||||
|
||||
public function testStore(){
|
||||
$response =
|
||||
$this->actingAs($this->user)
|
||||
->postJson('/api/update-rate/',[
|
||||
'x1_cash' => '1.2',
|
||||
'x1_cheque' => '1.2',
|
||||
'x1_ba' => '1.2',
|
||||
'x2_cash' => '1.2',
|
||||
'x2_cheque' => '1.2',
|
||||
'x2_ba' => '1.2'
|
||||
])
|
||||
->assertStatus(201);
|
||||
}
|
||||
|
||||
public function testUpdate(){
|
||||
$response =
|
||||
$this->actingAs($this->user)
|
||||
->json('PUT','/api/update-rate/' . $this->rate->id,[
|
||||
'x1_cash' => '1.2',
|
||||
'x1_cheque' => '1.2',
|
||||
'x1_ba' => '1.2',
|
||||
'x2_cash' => '1.2',
|
||||
'x2_cheque' => '1.2',
|
||||
'x2_ba' => '1.2'
|
||||
])
|
||||
->assertStatus(200);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,35 @@
|
||||
<?php
|
||||
|
||||
namespace Tests\Feature;
|
||||
|
||||
use Tests\TestCase;
|
||||
use Illuminate\Foundation\Testing\WithFaker;
|
||||
use Illuminate\Foundation\Testing\RefreshDatabase;
|
||||
use App\User;
|
||||
use App\SettingCredit;
|
||||
use App\Role;
|
||||
use Artisan;
|
||||
|
||||
class SettingCreditTest extends TestCase
|
||||
{
|
||||
protected $user;
|
||||
|
||||
public function setUp()
|
||||
{
|
||||
parent::setUp();
|
||||
Artisan::call('db:seed');
|
||||
|
||||
$this->user = factory(User::class)->create();
|
||||
$this->user->attachRole(Role::Where('name','admin')->first());
|
||||
}
|
||||
|
||||
public function testStore(){
|
||||
$this->actingAs($this->user)
|
||||
->postJson('/api/setting-credit/', [
|
||||
'rmb_credit_limit' => '5000',
|
||||
'usd_credit_limit' => '2000'
|
||||
])
|
||||
->assertStatus(201);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -4,6 +4,7 @@ namespace Tests\Feature;
|
||||
|
||||
use App\User;
|
||||
use Tests\TestCase;
|
||||
use App\Role;
|
||||
use Illuminate\Support\Facades\Hash;
|
||||
|
||||
class SettingsTest extends TestCase
|
||||
@@ -48,4 +49,5 @@ class SettingsTest extends TestCase
|
||||
|
||||
$this->assertTrue(Hash::check('updated', $this->user->password));
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user