Skip to content
This repository
Browse code

Swapped the second and third argument at Request;

Made Query::where() use static instead of self.
  • Loading branch information...
commit f5401443a6953db9b8b09d1c6743627b92dbc64a 1 parent d5cbb5c
Vasil Rangelov authored February 01, 2012
2  src/PEAR2/Net/RouterOS/Query.php
@@ -111,7 +111,7 @@ protected static function sanitizeAction($action)
111 111
     public static function where(
112 112
         $name, $value = null, $action = self::ACTION_EXIST
113 113
     ) {
114  
-        $query = new self;
  114
+        $query = new static;
115 115
         return $query->addWhere($name, $value, $action);
116 116
     }
117 117
 
6  src/PEAR2/Net/RouterOS/Request.php
@@ -47,15 +47,15 @@ class Request extends Message
47 47
      * 
48 48
      * @param string $command The command to send. Can also contain arguments
49 49
      * expressed in a shell-like syntax.
50  
-     * @param string $tag     The tag for the request.
51 50
      * @param Query  $query   A query to associate with the request.
  51
+     * @param string $tag     The tag for the request.
52 52
      * 
53 53
      * @see setCommand()
54 54
      * @see setArgument()
55 55
      * @see setTag()
56 56
      * @see setQuery()
57 57
      */
58  
-    public function __construct($command, $tag = null, Query $query = null)
  58
+    public function __construct($command, Query $query = null, $tag = null)
59 59
     {
60 60
         if (false !== ($firstEquals = strpos($command, '='))
61 61
             && false !== ($spaceBeforeEquals = strrpos(
@@ -66,8 +66,8 @@ public function __construct($command, $tag = null, Query $query = null)
66 66
             $command = rtrim(substr($command, 0, $spaceBeforeEquals));
67 67
         }
68 68
         $this->setCommand($command);
69  
-        $this->setTag($tag);
70 69
         $this->setQuery($query);
  70
+        $this->setTag($tag);
71 71
     }
72 72
     
73 73
     /**
8  tests/ClientFeaturesTest.php
@@ -45,7 +45,7 @@ public function testSendSyncReturningCollection()
45 45
         );
46 46
         $this->assertEquals(Response::TYPE_DATA, $list1->current()->getType());
47 47
         
48  
-        $list2 = $this->object->sendSync(new Request('/ip/arp/print', 't'));
  48
+        $list2 = $this->object->sendSync(new Request('/ip/arp/print', null, 't'));
49 49
         $this->assertInstanceOf(
50 50
             __NAMESPACE__ . '\ResponseCollection', $list2,
51 51
             'The list is not a collection'
@@ -566,9 +566,9 @@ public function testClientInvokability()
566 566
     {
567 567
         $obj = $this->object;
568 568
         $this->assertEquals(0, $obj->getPendingRequestsCount());
569  
-        $obj(new Request('/ping address=' . HOSTNAME, 'ping'));
  569
+        $obj(new Request('/ping address=' . HOSTNAME, null, 'ping'));
570 570
         $this->assertEquals(1, $obj->getPendingRequestsCount());
571  
-        $obj(new Request('/ip/arp/print', 'arp'));
  571
+        $obj(new Request('/ip/arp/print', null, 'arp'));
572 572
         $this->assertEquals(2, $obj->getPendingRequestsCount());
573 573
         $obj(4);
574 574
         $pingResponses = $obj->extractNewResponses('ping');
@@ -577,7 +577,7 @@ public function testClientInvokability()
577 577
         $arpResponses1 = $obj('arp');
578 578
         $this->assertEquals(0, $obj->getPendingRequestsCount());
579 579
         $this->assertGreaterThan(0, count($arpResponses1));
580  
-        $obj(new Request('/ip/arp/print', 'arp'));
  580
+        $obj(new Request('/ip/arp/print', null, 'arp'));
581 581
         $this->assertEquals(1, $obj->getPendingRequestsCount());
582 582
         $obj();
583 583
         $arpResponses2 = $obj('arp');
10  tests/bootstrap.php
... ...
@@ -1,8 +1,12 @@
1 1
 <?php
2 2
 namespace PEAR2\Net\RouterOS;
3  
-require_once
4  
-    '../../PEAR2_Net_Transmitter.git/src/PEAR2/Net/Transmitter/Autoload.php';
5  
-require_once '../src/PEAR2/Net/RouterOS/Autoload.php';
  3
+//require_once
  4
+//    '../../PEAR2_Net_Transmitter.git/src/PEAR2/Net/Transmitter/Autoload.php';
  5
+//require_once '../src/PEAR2/Net/RouterOS/Autoload.php';
  6
+require_once 'PEAR2/Autoload.php';
  7
+\PEAR2\Autoload::initialize('../src');
  8
+\PEAR2\Autoload::initialize('../../PEAR2_Net_Transmitter.git/src');
  9
+\PEAR2\Autoload::initialize('../../PEAR2_Cache_SHM.git/src');
6 10
 
7 11
 //Resolving HOSTNAME_* constants
8 12
 $constants = array('HOSTNAME', 'HOSTNAME_INVALID', 'HOSTNAME_SILENT');
2  tests/phpunit.xml
@@ -30,7 +30,7 @@
30 30
         <!--
31 31
         A server with a different service at the API port.
32 32
         -->
33  
-        <const name="HOSTNAME_INVALID" value="client.ros.example.com" />
  33
+        <const name="HOSTNAME_INVALID" value="invalid.ros.example.com" />
34 34
         <!--
35 35
         A port on which there's a service for all HOSTNAME_* addresses,
36 36
         but never the API one.

0 notes on commit f540144

Please sign in to comment.
Something went wrong with that request. Please try again.