2019-09-18 14:43:37 +02:00
|
|
|
<?php
|
2020-09-14 13:11:46 +02:00
|
|
|
/**
|
|
|
|
* Invoice Ninja (https://invoiceninja.com).
|
|
|
|
*
|
|
|
|
* @link https://github.com/invoiceninja/invoiceninja source repository
|
|
|
|
*
|
2021-01-03 22:54:54 +01:00
|
|
|
* @copyright Copyright (c) 2021. Invoice Ninja LLC (https://invoiceninja.com)
|
2020-09-14 13:11:46 +02:00
|
|
|
*
|
|
|
|
* @license https://opensource.org/licenses/AAL
|
|
|
|
*/
|
2019-09-18 14:43:37 +02:00
|
|
|
namespace Tests\Feature;
|
|
|
|
|
|
|
|
use Illuminate\Foundation\Testing\DatabaseTransactions;
|
|
|
|
use Illuminate\Support\Facades\URL;
|
|
|
|
use Tests\MockAccountData;
|
|
|
|
use Tests\TestCase;
|
|
|
|
|
|
|
|
/**
|
|
|
|
* @test
|
|
|
|
* @covers App\Models\Client
|
|
|
|
*/
|
|
|
|
class ClientModelTest extends TestCase
|
|
|
|
{
|
2020-03-21 06:37:30 +01:00
|
|
|
use MockAccountData;
|
2019-09-18 14:43:37 +02:00
|
|
|
use DatabaseTransactions;
|
|
|
|
|
|
|
|
public function setUp() :void
|
|
|
|
{
|
2020-03-21 06:37:30 +01:00
|
|
|
parent::setUp();
|
2020-09-06 11:38:10 +02:00
|
|
|
|
2020-03-21 06:37:30 +01:00
|
|
|
$this->makeTestData();
|
2019-09-18 14:43:37 +02:00
|
|
|
|
2020-03-21 06:37:30 +01:00
|
|
|
if (config('ninja.testvars.travis') !== false) {
|
2019-10-07 08:43:19 +02:00
|
|
|
$this->markTestSkipped('Skip test for Travis');
|
2020-03-21 06:37:30 +01:00
|
|
|
}
|
2019-12-17 11:50:45 +01:00
|
|
|
|
2020-09-06 11:38:10 +02:00
|
|
|
if (! config('ninja.testvars.stripe')) {
|
2019-12-17 11:50:45 +01:00
|
|
|
$this->markTestSkipped('Skip test no company gateways installed');
|
2020-03-21 06:37:30 +01:00
|
|
|
}
|
|
|
|
}
|
2019-09-18 14:43:37 +02:00
|
|
|
|
2021-01-27 02:06:25 +01:00
|
|
|
public function testPaymentMethodsWithCreditsEnforced()
|
2020-03-21 06:37:30 +01:00
|
|
|
{
|
|
|
|
$amount = 40;
|
2019-09-18 14:43:37 +02:00
|
|
|
|
2021-01-27 02:06:25 +01:00
|
|
|
$payment_methods = $this->client->service()->getPaymentMethods(40);
|
2019-09-18 14:43:37 +02:00
|
|
|
|
2021-01-27 02:06:25 +01:00
|
|
|
$this->assertEquals(1, count($payment_methods));
|
2020-09-06 11:38:10 +02:00
|
|
|
|
2020-03-21 06:37:30 +01:00
|
|
|
}
|
2021-01-27 02:06:25 +01:00
|
|
|
|
2019-09-18 14:43:37 +02:00
|
|
|
}
|