-
Notifications
You must be signed in to change notification settings - Fork 5
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
1 parent
9ff1775
commit 7640459
Showing
19 changed files
with
303 additions
and
51 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 |
---|---|---|
@@ -1,4 +1,5 @@ | ||
/.phpunit.cache | ||
/codeCoverage | ||
/node_modules | ||
/public/build | ||
/public/hot | ||
|
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
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
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
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
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
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
This file was deleted.
Oops, something went wrong.
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
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
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
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
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,38 @@ | ||
<?php | ||
|
||
declare(strict_types=1); | ||
|
||
namespace Tests\Integration\Http; | ||
|
||
use App\Repository\InvoiceRepositoryInterface; | ||
use Tests\Integration\IntegrationTest; | ||
|
||
class CreateInvoiceTest extends IntegrationTest | ||
{ | ||
/** | ||
* @test | ||
*/ | ||
public function it_should_fill_form_and_create_bitpay_invoice(): void | ||
{ | ||
$this->post('/invoices', [ | ||
'_token' => 'FsBmW4CMKpw8zjEBO9F3TQu9tGBbcTJkPQPKcGv7', | ||
'store' => 'store-1', | ||
'register' => '2', | ||
'reg_transaction_no' => 'test123', | ||
'price' => '23.54' | ||
]); | ||
|
||
/** @var InvoiceRepositoryInterface $invoiceRepository */ | ||
$invoiceRepository = $this->app->make(InvoiceRepositoryInterface::class); | ||
$invoice = $invoiceRepository->findOne(1); | ||
|
||
$this->assertNotNull($invoice); | ||
$this->assertNotNull($invoice->bitpay_id); | ||
$this->assertNotNull($invoice->bitpay_order_id); | ||
$this->assertEquals( | ||
'{"store":"store-1","register":"2","reg_transaction_no":"test123","price":"23.54"}', | ||
$invoice->pos_data_json | ||
); | ||
$this->assertEquals(23.54, $invoice->price); | ||
} | ||
} |
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,35 @@ | ||
<?php | ||
|
||
declare(strict_types=1); | ||
|
||
namespace Tests\Integration\Http; | ||
|
||
use Symfony\Component\HttpFoundation\Response; | ||
use Tests\ExampleInvoice; | ||
use Tests\Integration\IntegrationTest; | ||
|
||
class GetInvoiceViewControllerTest extends IntegrationTest | ||
{ | ||
/** | ||
* @test | ||
*/ | ||
public function it_should_show_invoice_view(): void | ||
{ | ||
$invoice = ExampleInvoice::createSaved(); | ||
|
||
$result = $this->get('/invoices/' . $invoice->id); | ||
$result->assertSeeText(ExampleInvoice::BITPAY_ID); | ||
$result->assertSeeText($invoice->price); | ||
$result->assertSeeText($invoice->item_description); | ||
$result->assertSeeText($invoice->status); | ||
} | ||
|
||
/** | ||
* @test | ||
*/ | ||
public function it_should_return_404_for_non_existing_invoice(): void | ||
{ | ||
$result = $this->get('/invoices/1'); | ||
$this->assertEquals(Response::HTTP_NOT_FOUND, $result->getStatusCode()); | ||
} | ||
} |
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,29 @@ | ||
<?php | ||
/** | ||
* | ||
* @copyright Copyright 2022 | ||
* @author Marcin Warzybok <[email protected]> | ||
*/ | ||
declare(strict_types=1); | ||
|
||
namespace Tests\Integration\Http; | ||
|
||
use Tests\ExampleInvoice; | ||
use Tests\Integration\IntegrationTest; | ||
|
||
class GetInvoicesControllerTest extends IntegrationTest | ||
{ | ||
/** | ||
* @test | ||
*/ | ||
public function it_should_show_invoices_on_grid(): void | ||
{ | ||
$invoice = ExampleInvoice::createSaved(); | ||
|
||
$result = $this->get('/invoices/'); | ||
$result->assertSeeText(ExampleInvoice::BITPAY_ID); | ||
$result->assertSeeText($invoice->price); | ||
$result->assertSeeText($invoice->item_description); | ||
$result->assertSeeText($invoice->status); | ||
} | ||
} |
Oops, something went wrong.