Pārlūkot izejas kodu

Fix tests for latest changes, added phpunit.xml.dist file and autoloader in test/bootstrap.php

Jordi Boggiano 14 gadi atpakaļ
vecāks
revīzija
ac1e6e1846

+ 15 - 0
phpunit.xml.dist

@@ -0,0 +1,15 @@
+<?xml version="1.0" encoding="UTF-8"?>
+
+<phpunit bootstrap="test/bootstrap.php">
+    <testsuites>
+        <testsuite name="Predis Test Suite">
+            <directory>test/</directory>
+        </testsuite>
+    </testsuites>
+
+    <filter>
+        <whitelist>
+            <directory suffix=".php">lib/Predis/</directory>
+        </whitelist>
+    </filter>
+</phpunit>

+ 0 - 1
test/PredisClientFeatures.php

@@ -1,5 +1,4 @@
 <?php
-require_once 'PredisShared.php';
 
 class PredisClientFeaturesTestSuite extends PHPUnit_Framework_TestCase {
     public $redis;

+ 1 - 2
test/PredisShared.php

@@ -13,7 +13,6 @@ if (I_AM_AWARE_OF_THE_DESTRUCTIVE_POWER_OF_THIS_TEST_SUITE !== true) {
 }
 
 require_once 'PHPUnit/Framework.php';
-require_once '../lib/Predis.php';
 
 if (!function_exists('array_union')) {
     function array_union(Array $a, Array $b) {
@@ -80,7 +79,7 @@ class RC {
         $redisUri = sprintf('redis://%s:%d/?database=%d', RC::SERVER_HOST, RC::SERVER_PORT, RC::DEFAULT_DATABASE);
         $handle = popen('php', 'w');
         fwrite($handle, "<?php
-        require '../lib/Predis.php';
+        require 'bootstrap.php';
         \$redis = new Predis\Client('$redisUri');
         \$redis->rpush('{$op}1', 'a');
         \$redis->rpush('{$op}2', 'b');

+ 0 - 1
test/RedisCommandsTest.php

@@ -1,5 +1,4 @@
 <?php
-require_once 'PredisShared.php';
 
 class RedisCommandTestSuite extends PHPUnit_Framework_TestCase {
     public $redis;

+ 12 - 0
test/bootstrap.php

@@ -0,0 +1,12 @@
+<?php
+
+spl_autoload_register(function($class)
+{
+    $file = __DIR__.'/../lib/'.strtr($class, '\\', '/').'.php';
+    if (file_exists($file)) {
+        require $file;
+        return true;
+    }
+});
+
+require __DIR__.'/PredisShared.php';