Fixes for tests

This commit is contained in:
David Bomba 2020-08-15 20:44:05 +10:00
parent 2faff4eb05
commit d53418f041
3 changed files with 23 additions and 27 deletions

View File

@ -20,7 +20,6 @@ class CompanyGatewayFactory
$company_gateway = new CompanyGateway;
$company_gateway->company_id = $company_id;
$company_gateway->user_id = $user_id;
return $company_gateway;
}
}

View File

@ -0,0 +1,17 @@
<?php
use Faker\Generator as Faker;
$factory->define(App\Models\Gateway::class, function (Faker $faker) {
return [
'key' => '3b6621f970ab18887c4f6dca78d3f8bb',
'visible' => true,
'sort_order' =>1,
'name' => 'demo',
'provider' => 'test',
'is_offsite' => true,
'is_secure' => true,
'fields' => '',
'default_gateway_type_id' => 1,
];
});

View File

@ -21,6 +21,7 @@ use Illuminate\Support\Facades\Log;
use Illuminate\Support\Facades\Session;
use Tests\MockAccountData;
use Tests\TestCase;
use PaymentLibrariesSeeder;
/**
* @test
@ -48,6 +49,7 @@ class CompanyGatewayApiTest extends TestCase
public function testCompanyGatewayEndPoints()
{
$data = [
'config' => 'random config',
'gateway_key' => '3b6621f970ab18887c4f6dca78d3f8bb',
@ -67,55 +69,31 @@ class CompanyGatewayApiTest extends TestCase
$response->assertStatus(200);
/* GET */
$response = $this->withHeaders([
'X-API-SECRET' => config('ninja.api_secret'),
'X-API-TOKEN' => $this->token
])->get("/api/v1/company_gateways/{$cg_id}");
$response->assertStatus(200);
/* GET CREATE */
$response = $this->withHeaders([
'X-API-SECRET' => config('ninja.api_secret'),
'X-API-TOKEN' => $this->token
])->get('/api/v1/company_gateways/create');
$response->assertStatus(200);
/* PUT */
$data = [
'config' => 'changed',
];
$response = $this->withHeaders([
'X-API-SECRET' => config('ninja.api_secret'),
'X-API-TOKEN' => $this->token
])->put("/api/v1/company_gateways/".$cg_id, $data);
$response->assertStatus(200);
$response = $this->withHeaders([
'X-API-SECRET' => config('ninja.api_secret'),
'X-API-TOKEN' => $this->token
])->delete("/api/v1/company_gateways/{$cg_id}", $data);
$response->assertStatus(200);
}
public function testCompanyGatewayFeesAndLimitsSuccess()
{
$fee = new FeesAndLimits;
$fee = (array)$fee;
@ -164,6 +142,7 @@ class CompanyGatewayApiTest extends TestCase
public function testCompanyGatewayFeesAndLimitsFails()
{
$fee_and_limit['bank_transfer'] = new FeesAndLimits;
$fee_and_limit['bank_transfer']->adjust_fee_percent = 10;
@ -186,6 +165,7 @@ class CompanyGatewayApiTest extends TestCase
public function testCompanyGatewayArrayBuilder()
{
$arr = [
'min_limit' => 1,
'max_limit' => 2