Vendoring deprecated composer libs
This commit is contained in:
32
libs/jsonrpc/tests/Validator/HostValidatorTest.php
Normal file
32
libs/jsonrpc/tests/Validator/HostValidatorTest.php
Normal file
@@ -0,0 +1,32 @@
|
||||
<?php
|
||||
|
||||
use JsonRPC\Validator\HostValidator;
|
||||
|
||||
require_once __DIR__.'/../../../../vendor/autoload.php';
|
||||
|
||||
class HostValidatorTest extends PHPUnit_Framework_TestCase
|
||||
{
|
||||
public function testWithEmptyHosts()
|
||||
{
|
||||
$this->assertNull(HostValidator::validate(array(), '127.0.0.1', '127.0.0.1'));
|
||||
}
|
||||
|
||||
public function testWithValidHosts()
|
||||
{
|
||||
$this->assertNull(HostValidator::validate(array('127.0.0.1'), '127.0.0.1', '127.0.0.1'));
|
||||
}
|
||||
|
||||
public function testWithValidNetwork()
|
||||
{
|
||||
$this->assertNull(HostValidator::validate(array('192.168.10.1/24'), '192.168.10.1'),'test ip match');
|
||||
$this->assertNull(HostValidator::validate(array('192.168.10.1/24'), '192.168.10.250'),'test ip match');
|
||||
$this->setExpectedException('\JsonRPC\Exception\AccessDeniedException');
|
||||
HostValidator::validate(array('192.168.10.1/24'), '192.168.11.1');
|
||||
}
|
||||
|
||||
public function testWithNotAuthorizedHosts()
|
||||
{
|
||||
$this->setExpectedException('\JsonRPC\Exception\AccessDeniedException');
|
||||
HostValidator::validate(array('192.168.1.1'), '127.0.0.1', '127.0.0.1');
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user