blob: 39c06d44d67b1298887312c4ac044d41fc14dad9 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
|
<?php
require_once __DIR__.'/../Base.php';
use Kanboard\Validator\CurrencyValidator;
class CurrencyValidatorTest extends Base
{
public function testValidation()
{
$validator = new CurrencyValidator($this->container);
$result = $validator->validateCreation(array());
$this->assertFalse($result[0]);
$result = $validator->validateCreation(array('currency' => 'EUR'));
$this->assertFalse($result[0]);
$result = $validator->validateCreation(array('rate' => 1.9));
$this->assertFalse($result[0]);
$result = $validator->validateCreation(array('currency' => 'EUR', 'rate' => 'foobar'));
$this->assertFalse($result[0]);
$result = $validator->validateCreation(array('currency' => 'EUR', 'rate' => 1.25));
$this->assertTrue($result[0]);
}
}
|