-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
zoranbogoevski
committed
Nov 17, 2023
1 parent
a48110f
commit 86c3818
Showing
1 changed file
with
49 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,49 @@ | ||
<?php | ||
|
||
namespace Kalimeromk\HalkbankPayment\tests\Feature; | ||
|
||
use Tests\TestCase; | ||
use Illuminate\Foundation\Testing\RefreshDatabase; | ||
use Illuminate\Foundation\Testing\WithFaker; | ||
|
||
class PaymentControllerTest extends TestCase | ||
{ | ||
use RefreshDatabase, WithFaker; | ||
|
||
/** @test */ | ||
public function it_shows_the_payment_form() | ||
{ | ||
$response = $this->get('payment/100'); | ||
|
||
$response->assertStatus(200); | ||
$response->assertViewIs('payment::payment'); | ||
} | ||
|
||
/** @test */ | ||
public function it_handles_payment_success() | ||
{ | ||
$mockData = [ | ||
'ReturnOid' => 'test-order-id12345' | ||
]; | ||
|
||
$response = $this->post('/payment/success', $mockData); | ||
|
||
$response->assertStatus(200); | ||
$response->assertViewIs('payment::success'); | ||
} | ||
|
||
/** @test */ | ||
public function it_handles_payment_failure() | ||
{ | ||
$mockData = [ | ||
'clientIp' => '127.0.0.1', | ||
'mdErrorMsg' => 'Test error message', | ||
'ErrMsg' => 'Test error description' | ||
]; | ||
|
||
$response = $this->post('/payment/fail', $mockData); | ||
|
||
$response->assertStatus(200); | ||
$response->assertViewIs('payment::fail'); | ||
} | ||
} |