mirror of
https://github.com/invoiceninja/invoiceninja.git
synced 2025-07-09 03:14:30 -04:00
Fixes for tests
This commit is contained in:
parent
2faff4eb05
commit
d53418f041
@ -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;
|
||||
}
|
||||
}
|
||||
|
17
database/factories/GatewayFactory.php
Normal file
17
database/factories/GatewayFactory.php
Normal 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,
|
||||
];
|
||||
});
|
@ -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
|
||||
|
Loading…
x
Reference in New Issue
Block a user