2015-10-18 16:02:48 +02:00
|
|
|
<?php
|
|
|
|
|
|
|
|
/*
|
|
|
|
* This file is part of Respect/Validation.
|
|
|
|
*
|
|
|
|
* (c) Alexandre Gomes Gaigalas <alexandre@gaigalas.net>
|
|
|
|
*
|
2019-05-23 16:21:34 +02:00
|
|
|
* For the full copyright and license information, please view the LICENSE file
|
|
|
|
* that was distributed with this source code.
|
2015-10-18 16:02:48 +02:00
|
|
|
*/
|
|
|
|
|
2017-11-19 19:01:31 +01:00
|
|
|
declare(strict_types=1);
|
|
|
|
|
2015-10-18 16:02:48 +02:00
|
|
|
namespace Respect\Validation\Rules;
|
|
|
|
|
2018-01-07 14:12:55 +01:00
|
|
|
use Respect\Validation\Test\RuleTestCase;
|
|
|
|
|
2015-10-18 16:02:48 +02:00
|
|
|
/**
|
2018-06-16 16:55:15 +02:00
|
|
|
* @group rule
|
|
|
|
*
|
2017-02-04 14:01:14 +01:00
|
|
|
* @covers \Respect\Validation\Rules\CurrencyCode
|
2018-06-16 16:55:15 +02:00
|
|
|
*
|
|
|
|
* @author Henrique Moody <henriquemoody@gmail.com>
|
|
|
|
* @author Justin Hook <justinhook88@yahoo.co.uk>
|
|
|
|
* @author William Espindola <oi@williamespindola.com.br>
|
2015-10-18 16:02:48 +02:00
|
|
|
*/
|
2018-06-16 16:55:15 +02:00
|
|
|
final class CurrencyCodeTest extends RuleTestCase
|
2015-10-18 16:02:48 +02:00
|
|
|
{
|
2018-06-16 16:55:15 +02:00
|
|
|
/**
|
2019-04-05 14:33:00 +02:00
|
|
|
* {@inheritDoc}
|
2018-06-16 16:55:15 +02:00
|
|
|
*/
|
2018-01-07 14:12:55 +01:00
|
|
|
public function providerForValidInput(): array
|
2015-10-18 16:02:48 +02:00
|
|
|
{
|
|
|
|
return [
|
2021-02-06 14:24:44 +01:00
|
|
|
[new CurrencyCode(), 'EUR'],
|
|
|
|
[new CurrencyCode(), 'GBP'],
|
|
|
|
[new CurrencyCode(), 'XAU'],
|
|
|
|
[new CurrencyCode(CurrencyCode::ALPHA3), 'XBA'],
|
|
|
|
[new CurrencyCode(CurrencyCode::ALPHA3), 'XXX'],
|
|
|
|
[new CurrencyCode(CurrencyCode::NUMERIC), '784'],
|
|
|
|
[new CurrencyCode(CurrencyCode::NUMERIC), '971'],
|
|
|
|
[new CurrencyCode(CurrencyCode::NUMERIC), '008'],
|
2015-10-18 16:02:48 +02:00
|
|
|
];
|
|
|
|
}
|
|
|
|
|
2018-06-16 16:55:15 +02:00
|
|
|
/**
|
2019-04-05 14:33:00 +02:00
|
|
|
* {@inheritDoc}
|
2018-06-16 16:55:15 +02:00
|
|
|
*/
|
2018-01-07 14:12:55 +01:00
|
|
|
public function providerForInvalidInput(): array
|
2015-10-18 16:02:48 +02:00
|
|
|
{
|
|
|
|
return [
|
2021-02-06 14:24:44 +01:00
|
|
|
[new CurrencyCode(), 'BTC'],
|
|
|
|
[new CurrencyCode(), 'GGP'],
|
|
|
|
[new CurrencyCode(), 'USA'],
|
|
|
|
[new CurrencyCode(), 'xxx'],
|
2015-10-18 16:02:48 +02:00
|
|
|
];
|
|
|
|
}
|
|
|
|
}
|