Skip to content

Commit 04dff7d

Browse files
committed
Updated unit tests against RouterOS 6.1;
Minor CS fixes.
1 parent 8b0b8fd commit 04dff7d

16 files changed

+84
-78
lines changed

examples/callback-and-loop.php

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,4 +31,3 @@ function responseHandler($response)
3131
arp1 is done.
3232
arp2 is done.
3333
*/
34-
?>

examples/loop-and-extract.php

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,4 +32,3 @@
3232
OK with arp1
3333
OK with arp2
3434
*/
35-
?>

examples/send-and-complete.php

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,4 +30,3 @@
3030
}
3131

3232
echo 'OK';
33-
?>

examples/send-and-forget.php

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,4 +16,3 @@
1616
$addRequest->setArgument('mac-address', '00:00:00:00:00:02');
1717
$addRequest->setTag('arp2');
1818
$client->sendAsync($addRequest);
19-
?>

examples/sync-request-arguments.php

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,4 +20,3 @@
2020
}
2121

2222
echo 'OK';
23-
?>

examples/sync-request-simple.php

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,4 +19,3 @@
1919
IP: 192.168.0.100 MAC: 00:00:00:00:00:01
2020
IP: 192.168.0.101 MAC: 00:00:00:00:00:02
2121
*/
22-
?>

src/PEAR2/Net/RouterOS/Util.php

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -297,11 +297,11 @@ public function find()
297297
{
298298
if (func_num_args() === 0) {
299299
if (null === $this->idCache) {
300-
$idCache = $this->client->sendSync(
301-
new Request($this->menu . '/find')
302-
)->getArgument('ret');
303-
$this->idCache = explode(',', $idCache);
304-
return $idCache;
300+
$idCache = $this->client->sendSync(
301+
new Request($this->menu . '/find')
302+
)->getArgument('ret');
303+
$this->idCache = explode(',', $idCache);
304+
return $idCache;
305305
}
306306
return implode(',', $this->idCache);
307307
}

stub.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@
3434
$phar = new Phar(__FILE__);
3535
$sig = $phar->getSignature();
3636
echo "{$sig['hash_type']} hash: {$sig['hash']}\n\n";
37-
} catch(Exception $e) {
37+
} catch (Exception $e) {
3838
echo <<<HEREDOC
3939
The PHAR extension is available, but was unable to read this PHAR file's hash.
4040
Regardless, you should not be having any trouble using the package by directly

tests/ClientFeaturesTest.php

Lines changed: 18 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -534,6 +534,7 @@ function ($response, $client) use (&$repliesCount) {
534534
$repliesCount++;
535535
}
536536
);
537+
sleep(1);
537538

538539

539540
$arpPrint = new Request('/ip/arp/print');
@@ -736,7 +737,7 @@ public function testStreamEquality()
736737
$request = new Request('/queue/simple/print');
737738

738739
$request->setQuery(
739-
Query::where('target-addresses', HOSTNAME_INVALID . '/32')
740+
Query::where('target', HOSTNAME_INVALID . '/32')
740741
);
741742

742743
$list = $this->object->sendSync($request);
@@ -778,7 +779,7 @@ public function testSendSyncWithQueryEquals()
778779
$request = new Request('/queue/simple/print');
779780

780781
$request->setQuery(
781-
Query::where('target-addresses', HOSTNAME_INVALID . '/32')
782+
Query::where('target', HOSTNAME_INVALID . '/32')
782783
);
783784
$list = $this->object->sendSync($request);
784785
$this->assertInstanceOf(
@@ -794,7 +795,7 @@ public function testSendSyncWithQueryEquals()
794795

795796
$request->setQuery(
796797
Query::where(
797-
'target-addresses',
798+
'target',
798799
HOSTNAME_INVALID . '/32',
799800
Query::ACTION_EQUALS
800801
)
@@ -816,7 +817,7 @@ public function testSendSyncWithQueryEquals()
816817
rewind($invalidAddressStream);
817818

818819
$request->setQuery(
819-
Query::where('target-addresses', $invalidAddressStream)
820+
Query::where('target', $invalidAddressStream)
820821
);
821822
$list = $this->object->sendSync($request);
822823
$this->assertInstanceOf(
@@ -832,7 +833,7 @@ public function testSendSyncWithQueryEquals()
832833

833834
$request->setQuery(
834835
Query::where(
835-
'target-addresses',
836+
'target',
836837
$invalidAddressStream,
837838
Query::ACTION_EQUALS
838839
)
@@ -856,7 +857,7 @@ public function testSendSyncWithQueryEqualsNot()
856857
$fullList = $this->object->sendSync($request);
857858

858859
$request->setQuery(
859-
Query::where('target-addresses', HOSTNAME_INVALID . '/32')->not()
860+
Query::where('target', HOSTNAME_INVALID . '/32')->not()
860861
);
861862
$list = $this->object->sendSync($request);
862863
$this->assertInstanceOf(
@@ -877,7 +878,7 @@ public function testSendSyncWithQueryEqualsNot()
877878

878879
$request->setQuery(
879880
Query::where(
880-
'target-addresses',
881+
'target',
881882
HOSTNAME_INVALID . '/32',
882883
Query::ACTION_EQUALS
883884
)->not()
@@ -904,7 +905,7 @@ public function testSendSyncWithQueryEqualsNot()
904905
rewind($invalidAddressStream);
905906

906907
$request->setQuery(
907-
Query::where('target-addresses', $invalidAddressStream)->not()
908+
Query::where('target', $invalidAddressStream)->not()
908909
);
909910
$list = $this->object->sendSync($request);
910911
$this->assertInstanceOf(
@@ -925,7 +926,7 @@ public function testSendSyncWithQueryEqualsNot()
925926

926927
$request->setQuery(
927928
Query::where(
928-
'target-addresses',
929+
'target',
929930
$invalidAddressStream,
930931
Query::ACTION_EQUALS
931932
)->not()
@@ -954,8 +955,8 @@ public function testSendSyncWithQueryEnum()
954955
$fullList = $this->object->sendSync($request);
955956

956957
$request->setQuery(
957-
Query::where('target-addresses', HOSTNAME_SILENT . '/32')
958-
->orWhere('target-addresses', HOSTNAME_INVALID . '/32')
958+
Query::where('target', HOSTNAME_SILENT . '/32')
959+
->orWhere('target', HOSTNAME_INVALID . '/32')
959960
);
960961
$list = $this->object->sendSync($request);
961962
$this->assertInstanceOf(
@@ -979,8 +980,8 @@ public function testSendSyncWithQueryEnum()
979980
rewind($silentAddressStream);
980981

981982
$request->setQuery(
982-
Query::where('target-addresses', $silentAddressStream)
983-
->orWhere('target-addresses', $invalidAddressStream)
983+
Query::where('target', $silentAddressStream)
984+
->orWhere('target', $invalidAddressStream)
984985
);
985986
$list = $this->object->sendSync($request);
986987
$this->assertInstanceOf(
@@ -1002,8 +1003,8 @@ public function testSendSyncWithQueryEnumNot()
10021003
$fullList = $this->object->sendSync($request);
10031004

10041005
$request->setQuery(
1005-
Query::where('target-addresses', HOSTNAME_SILENT . '/32')
1006-
->orWhere('target-addresses', HOSTNAME_INVALID . '/32')
1006+
Query::where('target', HOSTNAME_SILENT . '/32')
1007+
->orWhere('target', HOSTNAME_INVALID . '/32')
10071008
->not()
10081009
);
10091010
$list = $this->object->sendSync($request);
@@ -1032,8 +1033,8 @@ public function testSendSyncWithQueryEnumNot()
10321033
rewind($silentAddressStream);
10331034

10341035
$request->setQuery(
1035-
Query::where('target-addresses', $silentAddressStream)
1036-
->orWhere('target-addresses', $invalidAddressStream)
1036+
Query::where('target', $silentAddressStream)
1037+
->orWhere('target', $invalidAddressStream)
10371038
->not()
10381039
);
10391040
$list = $this->object->sendSync($request);

tests/ClientStateAlteringFeaturesTest.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -309,14 +309,14 @@ public function testResponseCollectionGetArgumentMap()
309309
&& $responses->getLast()->getType() === Response::TYPE_FINAL
310310
) {
311311
$printRequest = new Request('/queue/simple/print');
312-
$printRequest->setArgument('.proplist', 'name,target-addresses');
312+
$printRequest->setArgument('.proplist', 'name,target');
313313
$printRequest->setQuery(
314314
Query::where('name', TEST_QUEUE_NAME)
315-
->orWhere('target-addresses', HOSTNAME_INVALID . '/32')
315+
->orWhere('target', HOSTNAME_INVALID . '/32')
316316
);
317317
$responses = $this->object->sendSync($printRequest);
318318
$this->assertEquals(
319-
array('name' => array(0, 1), 'target-addresses' => array(0)),
319+
array('name' => array(0, 1), 'target' => array(0)),
320320
$responses->getArgumentMap(),
321321
'Improper format of the returned array'
322322
);

0 commit comments

Comments
 (0)