summaryrefslogtreecommitdiff
path: root/libs/jsonrpc/tests/Validator/UserValidatorTest.php
diff options
context:
space:
mode:
authorFrédéric Guillot <fred@kanboard.net>2018-06-21 14:13:41 -0700
committerFrédéric Guillot <fred@kanboard.net>2018-06-21 14:13:41 -0700
commita491348d442ab8e6cd2fa403d4365cdad78e52ce (patch)
treea00f575d82afb2c9051bad95398b4250f4a3d44d /libs/jsonrpc/tests/Validator/UserValidatorTest.php
parentc73ac5f1f818b6b21083f6785b4b2f6d778a6496 (diff)
Vendoring deprecated composer libs
Diffstat (limited to 'libs/jsonrpc/tests/Validator/UserValidatorTest.php')
-rw-r--r--libs/jsonrpc/tests/Validator/UserValidatorTest.php24
1 files changed, 24 insertions, 0 deletions
diff --git a/libs/jsonrpc/tests/Validator/UserValidatorTest.php b/libs/jsonrpc/tests/Validator/UserValidatorTest.php
new file mode 100644
index 00000000..e514c105
--- /dev/null
+++ b/libs/jsonrpc/tests/Validator/UserValidatorTest.php
@@ -0,0 +1,24 @@
+<?php
+
+use JsonRPC\Validator\UserValidator;
+
+require_once __DIR__.'/../../../../vendor/autoload.php';
+
+class UserValidatorTest extends PHPUnit_Framework_TestCase
+{
+ public function testWithEmptyHosts()
+ {
+ $this->assertNull(UserValidator::validate(array(), 'user', 'pass'));
+ }
+
+ public function testWithValidHosts()
+ {
+ $this->assertNull(UserValidator::validate(array('user' => 'pass'), 'user', 'pass'));
+ }
+
+ public function testWithNotAuthorizedHosts()
+ {
+ $this->setExpectedException('\JsonRPC\Exception\AuthenticationFailureException');
+ UserValidator::validate(array('user' => 'pass'), 'user', 'wrong password');
+ }
+}