Subiendo proyecto completo sin restricciones de git ignore
This commit is contained in:
35
vendor/sebacarrasco93/laravel-payku/tests/Feature/CanGetRoutesTest.php
vendored
Normal file
35
vendor/sebacarrasco93/laravel-payku/tests/Feature/CanGetRoutesTest.php
vendored
Normal file
@@ -0,0 +1,35 @@
|
||||
<?php
|
||||
|
||||
namespace SebaCarrasco93\LaravelPayku\Tests\Feature;
|
||||
|
||||
use SebaCarrasco93\LaravelPayku\Tests\TestCase;
|
||||
|
||||
class CanGetRoutesTest extends TestCase
|
||||
{
|
||||
public function setUp() : void
|
||||
{
|
||||
parent::setUp();
|
||||
|
||||
$this->fillApiKeys();
|
||||
}
|
||||
|
||||
/** @test */
|
||||
function it_can_create_an_order() {
|
||||
$this->markTestIncomplete();
|
||||
$this->withoutExceptionHanpdling();
|
||||
|
||||
$order = [
|
||||
'email' => 'seba@sextanet.cl',
|
||||
'order' => 'AAA',
|
||||
'subject' => 'Test',
|
||||
'amount' => '1000',
|
||||
'payment' => '1',
|
||||
'urlreturn' => route('payku.return', 'AAA'),
|
||||
'urlnotify' => route('payku.notify', 'AAA'),
|
||||
];
|
||||
|
||||
$this->post(route('payku.create', $order))->getContent();
|
||||
|
||||
$this->post(route('payku.create', $order))->assertSuccessful();
|
||||
}
|
||||
}
|
||||
61
vendor/sebacarrasco93/laravel-payku/tests/Feature/CanHandleAPIResponsesTest.php
vendored
Normal file
61
vendor/sebacarrasco93/laravel-payku/tests/Feature/CanHandleAPIResponsesTest.php
vendored
Normal file
@@ -0,0 +1,61 @@
|
||||
<?php
|
||||
|
||||
namespace SebaCarrasco93\LaravelPayku\Tests\Feature;
|
||||
|
||||
use SebaCarrasco93\LaravelPayku\LaravelPayku;
|
||||
use SebaCarrasco93\LaravelPayku\Tests\SimulateResponses;
|
||||
use SebaCarrasco93\LaravelPayku\Tests\TestCase;
|
||||
|
||||
class CanHandleAPIResponsesTest extends TestCase
|
||||
{
|
||||
use SimulateResponses;
|
||||
|
||||
public function setUp() : void
|
||||
{
|
||||
parent::setUp();
|
||||
|
||||
$this->fillApiKeys();
|
||||
|
||||
$this->laravelPayku = new LaravelPayku();
|
||||
}
|
||||
|
||||
/** @test */
|
||||
function it_can_handle_when_it_has_register_status() {
|
||||
$response = $this->registerResponse();
|
||||
|
||||
$this->laravelPayku->handleAPIResponse($response);
|
||||
$this->assertEquals('register', $this->laravelPayku->status);
|
||||
}
|
||||
|
||||
/** @test */
|
||||
function it_can_handle_when_it_has_pending_status() {
|
||||
$response = $this->pendingResponse();
|
||||
|
||||
$this->laravelPayku->handleAPIResponse($response);
|
||||
$this->assertEquals('pending', $this->laravelPayku->status);
|
||||
}
|
||||
|
||||
/** @test */
|
||||
function it_can_handle_when_it_has_failed_status() {
|
||||
$response = $this->failedResponse();
|
||||
|
||||
$this->laravelPayku->handleAPIResponse($response);
|
||||
$this->assertEquals('failed', $this->laravelPayku->status);
|
||||
}
|
||||
|
||||
/** @test */
|
||||
function it_can_handle_when_it_has_success_status() {
|
||||
$response = $this->successResponse();
|
||||
|
||||
$this->laravelPayku->handleAPIResponse($response);
|
||||
$this->assertEquals('success', $this->laravelPayku->status);
|
||||
}
|
||||
|
||||
/** @test */
|
||||
function it_can_handle_an_error_when_it_has_an_invalid_status() {
|
||||
$this->expectException(\Exception::class);
|
||||
$response = $this->invalidResponse();
|
||||
|
||||
$this->laravelPayku->handleAPIResponse($response);
|
||||
}
|
||||
}
|
||||
59
vendor/sebacarrasco93/laravel-payku/tests/Feature/CanSaveAPIResponsesTest.php
vendored
Normal file
59
vendor/sebacarrasco93/laravel-payku/tests/Feature/CanSaveAPIResponsesTest.php
vendored
Normal file
@@ -0,0 +1,59 @@
|
||||
<?php
|
||||
|
||||
namespace SebaCarrasco93\LaravelPayku\Tests\Feature;
|
||||
|
||||
use Illuminate\Foundation\Testing\RefreshDatabase;
|
||||
use SebaCarrasco93\LaravelPayku\LaravelPayku;
|
||||
use SebaCarrasco93\LaravelPayku\Models\PaykuTransaction;
|
||||
use SebaCarrasco93\LaravelPayku\Tests\SimulateResponses;
|
||||
use SebaCarrasco93\LaravelPayku\Tests\TestCase;
|
||||
|
||||
class CanSaveAPIResponsesTest extends TestCase
|
||||
{
|
||||
use RefreshDatabase;
|
||||
use SimulateResponses;
|
||||
|
||||
public function setUp() : void
|
||||
{
|
||||
parent::setUp();
|
||||
|
||||
$this->fillApiKeys();
|
||||
|
||||
$this->laravelPayku = new LaravelPayku();
|
||||
}
|
||||
|
||||
/** @test */
|
||||
function it_can_save_when_it_has_register_status() {
|
||||
$this->laravelPayku->saveAPIResponse($this->registerResponse());
|
||||
|
||||
$registerStatusTransaction = PaykuTransaction::first();
|
||||
|
||||
$this->assertNotNull($registerStatusTransaction->id);
|
||||
$this->assertNotNull($registerStatusTransaction->status);
|
||||
$this->assertNotNull($registerStatusTransaction->url);
|
||||
}
|
||||
|
||||
/** @test */
|
||||
function it_can_save_when_it_has_register_status_and_passes_to_success_status() {
|
||||
$this->laravelPayku->saveAPIResponse($this->registerResponse());
|
||||
$registerStatusTransaction = PaykuTransaction::first();
|
||||
|
||||
$this->assertNull($registerStatusTransaction->order);
|
||||
$this->assertNull($registerStatusTransaction->email);
|
||||
$this->assertNull($registerStatusTransaction->subject);
|
||||
$this->assertNull($registerStatusTransaction->amount);
|
||||
|
||||
$this->laravelPayku->saveAPIResponse($this->successResponse());
|
||||
$registerStatusTransaction = PaykuTransaction::first();
|
||||
|
||||
$this->assertCount(1, PaykuTransaction::get());
|
||||
|
||||
$this->assertNotNull($registerStatusTransaction->id);
|
||||
$this->assertNotNull($registerStatusTransaction->status);
|
||||
$this->assertNotNull($registerStatusTransaction->order);
|
||||
$this->assertNotNull($registerStatusTransaction->email);
|
||||
$this->assertNotNull($registerStatusTransaction->subject);
|
||||
$this->assertNotNull($registerStatusTransaction->url);
|
||||
$this->assertNotNull($registerStatusTransaction->amount);
|
||||
}
|
||||
}
|
||||
85
vendor/sebacarrasco93/laravel-payku/tests/Feature/WorkWithValidOrInvalidResponsesTest.php
vendored
Normal file
85
vendor/sebacarrasco93/laravel-payku/tests/Feature/WorkWithValidOrInvalidResponsesTest.php
vendored
Normal file
@@ -0,0 +1,85 @@
|
||||
<?php
|
||||
|
||||
namespace SebaCarrasco93\LaravelPayku\Tests\Feature;
|
||||
|
||||
use Illuminate\Foundation\Testing\RefreshDatabase;
|
||||
use SebaCarrasco93\LaravelPayku\LaravelPayku;
|
||||
use SebaCarrasco93\LaravelPayku\Models\PaykuPayment;
|
||||
use SebaCarrasco93\LaravelPayku\Models\PaykuTransaction;
|
||||
use SebaCarrasco93\LaravelPayku\Tests\SimulateResponses;
|
||||
use SebaCarrasco93\LaravelPayku\Tests\TestCase;
|
||||
|
||||
class WorkWithValidOrInvalidResponsesTest extends TestCase
|
||||
{
|
||||
use SimulateResponses;
|
||||
use RefreshDatabase;
|
||||
|
||||
public function setUp() : void
|
||||
{
|
||||
parent::setUp();
|
||||
|
||||
$this->fillApiKeys();
|
||||
|
||||
$this->laravelPayku = new LaravelPayku();
|
||||
}
|
||||
|
||||
/** @test */
|
||||
function it_knows_when_it_has_an_valid_api_response() {
|
||||
$response = $this->successResponse();
|
||||
|
||||
$this->laravelPayku->handleAPIResponse($response);
|
||||
$this->assertTrue($this->laravelPayku->hasValidResponse);
|
||||
}
|
||||
|
||||
/** @test */
|
||||
function it_knows_when_it_does_not_have_an_valid_api_response() {
|
||||
$this->expectException(\Exception::class);
|
||||
|
||||
$response = $this->invalidResponse();
|
||||
|
||||
$this->laravelPayku->handleAPIResponse($response);
|
||||
$this->assertFalse($this->laravelPayku->hasValidResponse);
|
||||
}
|
||||
|
||||
/** @test */
|
||||
function it_can_create_the_pending_response_in_transactions() {
|
||||
$response = $this->pendingResponse();
|
||||
|
||||
$this->laravelPayku->saveAPIResponse($response);
|
||||
|
||||
$this->assertCount(1, PaykuTransaction::get());
|
||||
$this->assertCount(0, PaykuPayment::get());
|
||||
}
|
||||
|
||||
/** @test */
|
||||
function it_cannot_create_the_failed_response_in_transactions() {
|
||||
$this->expectException(\Exception::class);
|
||||
|
||||
$response = $this->failedResponse();
|
||||
|
||||
$this->laravelPayku->saveAPIResponse($response);
|
||||
|
||||
$this->assertCount(0, PaykuTransaction::get());
|
||||
$this->assertCount(0, PaykuPayment::get());
|
||||
}
|
||||
|
||||
/** @test */
|
||||
function it_can_create_the_register_response_in_transactions() {
|
||||
$response = $this->registerResponse();
|
||||
|
||||
$this->laravelPayku->saveAPIResponse($response);
|
||||
|
||||
$this->assertCount(1, PaykuTransaction::get());
|
||||
$this->assertCount(0, PaykuPayment::get());
|
||||
}
|
||||
|
||||
/** @test */
|
||||
function it_can_create_the_success_response_in_transactions() {
|
||||
$response = $this->successResponse();
|
||||
|
||||
$this->laravelPayku->saveAPIResponse($response);
|
||||
|
||||
$this->assertCount(1, PaykuTransaction::get());
|
||||
$this->assertCount(1, PaykuPayment::get());
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user