summaryrefslogtreecommitdiff
path: root/libs/jsonrpc/tests/Validator/UserValidatorTest.php
blob: e514c105a28b63d25dcb7d757cd6ff492eaf205e (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
<?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');
    }
}