Skip to content

Commit

Permalink
Fixed backward compatibility
Browse files Browse the repository at this point in the history
  • Loading branch information
Andrey Helldar committed Aug 8, 2021
1 parent d73a651 commit 508816b
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 18 deletions.
25 changes: 13 additions & 12 deletions tests/Jobs/JobsTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
use Helldar\Cashier\Services\Jobs;
use Helldar\Support\Facades\Http\Url;
use Illuminate\Foundation\Testing\RefreshDatabase;
use Illuminate\Support\Facades\DB;
use Tests\Fixtures\Factories\Payment;
use Tests\Fixtures\Models\RequestPayment;
use Tests\TestCase;
Expand All @@ -19,17 +20,17 @@ class JobsTest extends TestCase

public function testStart()
{
$this->assertDatabaseCount('payments', 0);
$this->assertDatabaseCount('cashier_details', 0);
$this->assertSame(0, DB::table('payments')->count());
$this->assertSame(0, DB::table('cashier_details')->count());

$payment = $this->payment();

Jobs::make($payment)->start();

$payment->refresh();

$this->assertDatabaseCount('payments', 1);
$this->assertDatabaseCount('cashier_details', 1);
$this->assertSame(1, DB::table('payments')->count());
$this->assertSame(1, DB::table('cashier_details')->count());

$this->assertIsString($payment->cashier->external_id);
$this->assertMatchesRegularExpression('/^(\d+)$/', $payment->cashier->external_id);
Expand All @@ -46,8 +47,8 @@ public function testStart()

public function testCheck()
{
$this->assertDatabaseCount('payments', 0);
$this->assertDatabaseCount('cashier_details', 0);
$this->assertSame(0, DB::table('payments')->count());
$this->assertSame(0, DB::table('cashier_details')->count());

$payment = $this->payment();

Expand All @@ -56,8 +57,8 @@ public function testCheck()

$payment->refresh();

$this->assertDatabaseCount('payments', 1);
$this->assertDatabaseCount('cashier_details', 1);
$this->assertSame(1, DB::table('payments')->count());
$this->assertSame(1, DB::table('cashier_details')->count());

$this->assertIsString($payment->cashier->external_id);
$this->assertMatchesRegularExpression('/^(\d+)$/', $payment->cashier->external_id);
Expand All @@ -74,8 +75,8 @@ public function testCheck()

public function testRefund()
{
$this->assertDatabaseCount('payments', 0);
$this->assertDatabaseCount('cashier_details', 0);
$this->assertSame(0, DB::table('payments')->count());
$this->assertSame(0, DB::table('cashier_details')->count());

$payment = $this->payment();

Expand All @@ -89,8 +90,8 @@ public function testRefund()

$payment->refresh();

$this->assertDatabaseCount('payments', 1);
$this->assertDatabaseCount('cashier_details', 1);
$this->assertSame(1, DB::table('payments')->count());
$this->assertSame(1, DB::table('cashier_details')->count());

$this->assertIsString($payment->cashier->external_id);
$this->assertMatchesRegularExpression('/^(\d+)$/', $payment->cashier->external_id);
Expand Down
13 changes: 7 additions & 6 deletions tests/Observers/ObserverTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
use Helldar\Cashier\Providers\ServiceProvider;
use Helldar\Support\Facades\Http\Url;
use Illuminate\Foundation\Testing\RefreshDatabase;
use Illuminate\Support\Facades\DB;
use Tests\Fixtures\Factories\Payment;
use Tests\Fixtures\Models\RequestPayment;
use Tests\TestCase;
Expand All @@ -20,15 +21,15 @@ class ObserverTest extends TestCase

public function testCreate(): RequestPayment
{
$this->assertDatabaseCount('payments', 0);
$this->assertDatabaseCount('cashier_details', 0);
$this->assertSame(0, DB::table('payments')->count());
$this->assertSame(0, DB::table('cashier_details')->count());

$payment = $this->payment();

$payment->refresh();

$this->assertDatabaseCount('payments', 1);
$this->assertDatabaseCount('cashier_details', 1);
$this->assertSame(1, DB::table('payments')->count());
$this->assertSame(1, DB::table('cashier_details')->count());

$this->assertIsString($payment->cashier->external_id);
$this->assertMatchesRegularExpression('/^(\d+)$/', $payment->cashier->external_id);
Expand All @@ -55,8 +56,8 @@ public function testUpdate()

$payment->refresh();

$this->assertDatabaseCount('payments', 1);
$this->assertDatabaseCount('cashier_details', 1);
$this->assertSame(1, DB::table('payments')->count());
$this->assertSame(1, DB::table('cashier_details')->count());

$this->assertIsString($payment->cashier->external_id);
$this->assertMatchesRegularExpression('/^(\d+)$/', $payment->cashier->external_id);
Expand Down

0 comments on commit 508816b

Please sign in to comment.