-
Notifications
You must be signed in to change notification settings - Fork 15
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
This is for https://phabricator.wikimedia.org/T127001
- Loading branch information
Showing
3 changed files
with
70 additions
and
1 deletion.
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
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,43 @@ | ||
<?php | ||
|
||
declare(strict_types = 1); | ||
|
||
namespace WMDE\Fundraising\Frontend\Tests\System\Routes; | ||
|
||
use WMDE\Fundraising\Frontend\Tests\System\WebRouteTestCase; | ||
use WMDE\Fundraising\Frontend\Domain\Model\PaymentType; | ||
|
||
/** | ||
* @licence GNU GPL v2+ | ||
* @author Gabriel Birke < gabriel.birke@wikimedia.de > | ||
*/ | ||
class ValidateAmountRouteTest extends WebRouteTestCase { | ||
|
||
public function testGivenValidAmount_successResponseIsReturned() { | ||
$client = $this->createClient(); | ||
|
||
$client->request( | ||
'POST', | ||
'/validate-amount', | ||
[ 'amount' => '23', 'paymentType' => PaymentType::BANK_TRANSFER ] | ||
); | ||
|
||
$this->assertJsonSuccessResponse( | ||
[ 'status' => 'OK' ], | ||
$client->getResponse() | ||
); | ||
} | ||
|
||
public function testGivenInvalidAmount_failureResponseIsReturned() { | ||
$client = $this->createClient(); | ||
|
||
$client->request( | ||
'POST', | ||
'/validate-amount', | ||
[ 'amount' => '-1', 'paymentType' => PaymentType::BANK_TRANSFER ] | ||
); | ||
|
||
$this->assertErrorJsonResponse( $client->getResponse() ); | ||
} | ||
|
||
} |