Browse Source

Fix code in the test suite not compatible with PHP 5.2 (see issue #46).

Daniele Alessandri 13 years ago
parent
commit
2ff3deed80
2 changed files with 13 additions and 13 deletions
  1. 12 12
      test/RedisCommandsTest.php
  2. 1 1
      test/bootstrap.php

+ 12 - 12
test/RedisCommandsTest.php

@@ -314,18 +314,18 @@ class RedisCommandsTestSuite extends PHPUnit_Framework_TestCase {
         $this->assertEquals(1, $this->redis->getbit('binary', 31));
         $this->assertEquals(1, $this->redis->getbit('binary', 31));
         $this->assertEquals(0, $this->redis->getbit('binary', 63));
         $this->assertEquals(0, $this->redis->getbit('binary', 63));
 
 
-        RC::testForServerException($this, RC::EXCEPTION_BIT_OFFSET, function($test) {
-            $test->redis->getbit('binary', -1);
-        });
-
-        RC::testForServerException($this, RC::EXCEPTION_BIT_OFFSET, function($test) {
-            $test->redis->getbit('binary', 'invalid');
-        });
-
-        RC::testForServerException($this, RC::EXCEPTION_WRONG_TYPE, function($test) {
-            $test->redis->rpush('metavars', 'foo');
-            $test->redis->getbit('metavars', 0);
-        });
+        RC::testForServerException($this, RC::EXCEPTION_BIT_OFFSET, p_anon("\$test", "
+            \$test->redis->getbit('binary', -1);
+        "));
+
+        RC::testForServerException($this, RC::EXCEPTION_BIT_OFFSET, p_anon("\$test", "
+            \$test->redis->getbit('binary', 'invalid');
+        "));
+
+        RC::testForServerException($this, RC::EXCEPTION_WRONG_TYPE, p_anon("\$test", "
+            \$test->redis->rpush('metavars', 'foo');
+            \$test->redis->getbit('metavars', 0);
+        "));
     }
     }
 
 
 
 

+ 1 - 1
test/bootstrap.php

@@ -1,6 +1,6 @@
 <?php
 <?php
 
 
-if (!defined(__DIR__)) {
+if (!@defined(__DIR__)) {
     define('__DIR__', dirname(__FILE__));
     define('__DIR__', dirname(__FILE__));
 }
 }