summaryrefslogtreecommitdiff
path: root/tests/units/Validator/CurrencyValidatorTest.php
diff options
context:
space:
mode:
Diffstat (limited to 'tests/units/Validator/CurrencyValidatorTest.php')
-rw-r--r--tests/units/Validator/CurrencyValidatorTest.php27
1 files changed, 27 insertions, 0 deletions
diff --git a/tests/units/Validator/CurrencyValidatorTest.php b/tests/units/Validator/CurrencyValidatorTest.php
new file mode 100644
index 00000000..39c06d44
--- /dev/null
+++ b/tests/units/Validator/CurrencyValidatorTest.php
@@ -0,0 +1,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]);
+ }
+}