Browse Source

tests updated, config file updated

tags/0.8
Paul Rock 7 years ago
parent
commit
721676be70
  1. 26
      phpunit.xml
  2. 35
      tests/ClientTest.php
  3. 9
      tests/ConfigTest.php
  4. 1
      tests/QueryTest.php

26
phpunit.xml

@ -1,21 +1,19 @@
<?xml version="1.0" encoding="UTF-8"?>
<phpunit backupGlobals="false"
backupStaticAttributes="false"
bootstrap="vendor/autoload.php"
colors="true"
convertErrorsToExceptions="true"
convertNoticesToExceptions="true"
convertWarningsToExceptions="true"
processIsolation="false"
stopOnFailure="false">
<phpunit bootstrap="./vendor/autoload.php" colors="true">
<filter>
<whitelist processUncoveredFilesFromWhitelist="true">
<directory suffix=".php">./src</directory>
<exclude>
<directory suffix=".php">./tests</directory>
</exclude>
</whitelist>
</filter>
<logging>
<log type="coverage-text" target="php://stdout" showUncoveredFiles="false"/>
</logging>
<testsuites>
<testsuite name="RouterOS API on PHP tests">
<directory suffix=".php">./tests/</directory>
</testsuite>
</testsuites>
<filter>
<whitelist processUncoveredFilesFromWhitelist="true">
<directory suffix=".php">./src/</directory>
</whitelist>
</filter>
</phpunit>

35
tests/ClientTest.php

@ -10,7 +10,6 @@ use RouterOS\Exceptions\ClientException;
class ClientTest extends TestCase
{
public function test__construct()
{
try {
@ -25,6 +24,39 @@ class ClientTest extends TestCase
}
}
public function test__construct2()
{
try {
$config = new Config([
'user' => 'admin',
'pass' => 'admin',
'host' => '127.0.0.1'
]);
$obj = new Client($config);
$this->assertInternalType('object', $obj);
$socket = $obj->getSocket();
$this->assertInternalType('resource', $socket);
} catch (\Exception $e) {
$this->assertContains('Must be initialized ', $e->getMessage());
}
}
public function test__construct3()
{
try {
$obj = new Client([
'user' => 'admin',
'pass' => 'admin',
'host' => '127.0.0.1'
]);
$this->assertInternalType('object', $obj);
$socket = $obj->getSocket();
$this->assertInternalType('resource', $socket);
} catch (\Exception $e) {
$this->assertContains('Must be initialized ', $e->getMessage());
}
}
public function test__constructLegacy()
{
try {
@ -80,5 +112,4 @@ class ClientTest extends TestCase
$this->assertCount(3, $readTrap);
$this->assertEquals('!trap', $readTrap[0]);
}
}

9
tests/ConfigTest.php

@ -31,6 +31,15 @@ class ConfigTest extends TestCase
$this->assertEquals($params['delay'], 1);
}
public function testGetParameters2()
{
$obj = new Config(['timeout' => 100]);
$params = $obj->getParameters();
$this->assertCount(5, $params);
$this->assertEquals($params['timeout'], 100);
}
public function testSet()
{
$obj = new Config();

1
tests/QueryTest.php

@ -8,7 +8,6 @@ use RouterOS\Query;
class QueryTest extends TestCase
{
public function test__construct()
{
try {

Loading…
Cancel
Save