Sfoglia il codice sorgente

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

Daniele Alessandri 14 anni fa
parent
commit
2ff3deed80
2 ha cambiato i file con 13 aggiunte e 13 eliminazioni
  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(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
 
-if (!defined(__DIR__)) {
+if (!@defined(__DIR__)) {
     define('__DIR__', dirname(__FILE__));
 }