-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
BAU-3545 correct return type for AmountMoney/Pence classes (#36)
- Loading branch information
Showing
4 changed files
with
48 additions
and
6 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
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,40 @@ | ||
<?php | ||
declare(strict_types=1); | ||
|
||
namespace Assertis\Util; | ||
|
||
use PHPUnit\Framework\TestCase; | ||
|
||
/** | ||
* @author Rafał Orłowski <[email protected]> | ||
*/ | ||
class AmountMoneyTest extends TestCase | ||
{ | ||
|
||
/** | ||
* @return array | ||
*/ | ||
public function provideFromHumanReadableString(): array | ||
{ | ||
return [ | ||
['123.456', 12345], | ||
['123.45', 12345], | ||
['123.4', 12340], | ||
['123', 12300], | ||
['1,234.56', 123456], | ||
]; | ||
} | ||
|
||
/** | ||
* @dataProvider provideFromHumanReadableString | ||
* @param string $string | ||
* @param int $pence | ||
*/ | ||
public function testFromHumanReadableString(string $string, int $pence) | ||
{ | ||
$price = AmountMoney::fromHumanReadableString($string); | ||
self::assertInstanceOf(AmountMoney::class, $price); | ||
self::assertSame($pence, $price->getValue()); | ||
} | ||
|
||
} |
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