Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Swapped the second and third argument at Request;

Made Query::where() use static instead of self.
  • Loading branch information...
commit f5401443a6953db9b8b09d1c6743627b92dbc64a 1 parent d5cbb5c
@boenrobot boenrobot authored
View
2  src/PEAR2/Net/RouterOS/Query.php
@@ -111,7 +111,7 @@ protected static function sanitizeAction($action)
public static function where(
$name, $value = null, $action = self::ACTION_EXIST
) {
- $query = new self;
+ $query = new static;
return $query->addWhere($name, $value, $action);
}
View
6 src/PEAR2/Net/RouterOS/Request.php
@@ -47,15 +47,15 @@ class Request extends Message
*
* @param string $command The command to send. Can also contain arguments
* expressed in a shell-like syntax.
- * @param string $tag The tag for the request.
* @param Query $query A query to associate with the request.
+ * @param string $tag The tag for the request.
*
* @see setCommand()
* @see setArgument()
* @see setTag()
* @see setQuery()
*/
- public function __construct($command, $tag = null, Query $query = null)
+ public function __construct($command, Query $query = null, $tag = null)
{
if (false !== ($firstEquals = strpos($command, '='))
&& false !== ($spaceBeforeEquals = strrpos(
@@ -66,8 +66,8 @@ public function __construct($command, $tag = null, Query $query = null)
$command = rtrim(substr($command, 0, $spaceBeforeEquals));
}
$this->setCommand($command);
- $this->setTag($tag);
$this->setQuery($query);
+ $this->setTag($tag);
}
/**
View
8 tests/ClientFeaturesTest.php
@@ -45,7 +45,7 @@ public function testSendSyncReturningCollection()
);
$this->assertEquals(Response::TYPE_DATA, $list1->current()->getType());
- $list2 = $this->object->sendSync(new Request('/ip/arp/print', 't'));
+ $list2 = $this->object->sendSync(new Request('/ip/arp/print', null, 't'));
$this->assertInstanceOf(
__NAMESPACE__ . '\ResponseCollection', $list2,
'The list is not a collection'
@@ -566,9 +566,9 @@ public function testClientInvokability()
{
$obj = $this->object;
$this->assertEquals(0, $obj->getPendingRequestsCount());
- $obj(new Request('/ping address=' . HOSTNAME, 'ping'));
+ $obj(new Request('/ping address=' . HOSTNAME, null, 'ping'));
$this->assertEquals(1, $obj->getPendingRequestsCount());
- $obj(new Request('/ip/arp/print', 'arp'));
+ $obj(new Request('/ip/arp/print', null, 'arp'));
$this->assertEquals(2, $obj->getPendingRequestsCount());
$obj(4);
$pingResponses = $obj->extractNewResponses('ping');
@@ -577,7 +577,7 @@ public function testClientInvokability()
$arpResponses1 = $obj('arp');
$this->assertEquals(0, $obj->getPendingRequestsCount());
$this->assertGreaterThan(0, count($arpResponses1));
- $obj(new Request('/ip/arp/print', 'arp'));
+ $obj(new Request('/ip/arp/print', null, 'arp'));
$this->assertEquals(1, $obj->getPendingRequestsCount());
$obj();
$arpResponses2 = $obj('arp');
View
10 tests/bootstrap.php
@@ -1,8 +1,12 @@
<?php
namespace PEAR2\Net\RouterOS;
-require_once
- '../../PEAR2_Net_Transmitter.git/src/PEAR2/Net/Transmitter/Autoload.php';
-require_once '../src/PEAR2/Net/RouterOS/Autoload.php';
+//require_once
+// '../../PEAR2_Net_Transmitter.git/src/PEAR2/Net/Transmitter/Autoload.php';
+//require_once '../src/PEAR2/Net/RouterOS/Autoload.php';
+require_once 'PEAR2/Autoload.php';
+\PEAR2\Autoload::initialize('../src');
+\PEAR2\Autoload::initialize('../../PEAR2_Net_Transmitter.git/src');
+\PEAR2\Autoload::initialize('../../PEAR2_Cache_SHM.git/src');
//Resolving HOSTNAME_* constants
$constants = array('HOSTNAME', 'HOSTNAME_INVALID', 'HOSTNAME_SILENT');
View
2  tests/phpunit.xml
@@ -30,7 +30,7 @@
<!--
A server with a different service at the API port.
-->
- <const name="HOSTNAME_INVALID" value="client.ros.example.com" />
+ <const name="HOSTNAME_INVALID" value="invalid.ros.example.com" />
<!--
A port on which there's a service for all HOSTNAME_* addresses,
but never the API one.
Please sign in to comment.
Something went wrong with that request. Please try again.