Simplify, add autoloader.
authorJan Schneider <jan@horde.org>
Thu, 16 Dec 2010 13:32:05 +0000 (14:32 +0100)
committerJan Schneider <jan@horde.org>
Thu, 16 Dec 2010 13:33:30 +0000 (14:33 +0100)
framework/Support/package.xml
framework/Support/test/Horde/Support/Autoload.php [new file with mode: 0644]
framework/Support/test/Horde/Support/ConsistentHashTest.php

index d10adda..96e99a1 100644 (file)
@@ -10,8 +10,8 @@
   <email>chuck@horde.org</email>
   <active>yes</active>
  </lead>
- <date>2010-07-10</date>
- <time>10:39:15</time>
+ <date>2010-12-16</date>
+ <time>14:31:38</time>
  <version>
   <release>0.2.0</release>
   <api>0.1.0</api>
@@ -21,7 +21,8 @@
   <api>beta</api>
  </stability>
  <license uri="http://opensource.org/licenses/bsd-license.php">BSD</license>
- <notes>* Add Horde_Support_Randomid::.
+ <notes>
+* Add Horde_Support_Randomid::.
  * Add Portuguese numerizer.
  </notes>
  <contents>
@@ -63,6 +64,7 @@
       </dir> <!-- /test/Horde/Support/Numerizer -->
       <file name="AllTests.php" role="test" />
       <file name="ArrayTest.php" role="test" />
+      <file name="Autoload.php" role="test" />
       <file name="BacktraceTest.php" role="test" />
       <file name="CombineStreamTest.php" role="test" />
       <file name="ConsistentHashTest.php" role="test" />
    <install as="Horde/Support/Numerizer/Locale/Pt.php" name="lib/Horde/Support/Numerizer/Locale/Pt.php" />
    <install as="Horde/Support/AllTests.php" name="test/Horde/Support/AllTests.php" />
    <install as="Horde/Support/ArrayTest.php" name="test/Horde/Support/ArrayTest.php" />
+   <install as="Horde/Support/Autoload.php" name="test/Horde/Support/Autoload.php" />
    <install as="Horde/Support/BacktraceTest.php" name="test/Horde/Support/BacktraceTest.php" />
    <install as="Horde/Support/CombineStreamTest.php" name="test/Horde/Support/CombineStreamTest.php" />
    <install as="Horde/Support/ConsistentHashTest.php" name="test/Horde/Support/ConsistentHashTest.php" />
 * Initial Horde_Support_Numerizer objects
    </notes>
   </release>
+  <release>
+   <version>
+    <release>0.2.0</release>
+    <api>0.1.0</api>
+   </version>
+   <stability>
+    <release>beta</release>
+    <api>beta</api>
+   </stability>
+   <date>2010-12-16</date>
+   <license uri="http://opensource.org/licenses/bsd-license.php">BSD</license>
+   <notes>
+* Add Horde_Support_Randomid::.
+ * Add Portuguese numerizer.
+   </notes>
+  </release>
  </changelog>
 </package>
diff --git a/framework/Support/test/Horde/Support/Autoload.php b/framework/Support/test/Horde/Support/Autoload.php
new file mode 100644 (file)
index 0000000..955f7e8
--- /dev/null
@@ -0,0 +1,20 @@
+<?php
+/**
+ * Setup autoloading for the tests.
+ *
+ * Copyright 2009-2010 The Horde Project (http://www.horde.org/)
+ *
+ * See the enclosed file COPYING for license information (LGPL). If you
+ * did not receive this file, see http://www.fsf.org/copyleft/lgpl.html.
+ *
+ * @category   Horde
+ * @package    Support
+ * @subpackage UnitTests
+ * @copyright  2008-2010 The Horde Project (http://www.horde.org/)
+ * @license    http://opensource.org/licenses/bsd-license.php
+ */
+
+require_once 'Horde/Test/Autoload.php';
+
+/** Catch strict standards */
+error_reporting(E_ALL | E_STRICT);
index 24e4e98..cbf596b 100644 (file)
@@ -3,16 +3,20 @@
  * @category   Horde
  * @package    Support
  * @subpackage UnitTests
- * @copyright  2008-2009 The Horde Project (http://www.horde.org/)
+ * @copyright  2008-2010 The Horde Project (http://www.horde.org/)
  * @license    http://opensource.org/licenses/bsd-license.php
  */
 
 /**
- * @group      support
+ * Prepare the test setup.
+ */
+require_once dirname(__FILE__) . '/Autoload.php';
+
+/**
  * @category   Horde
  * @package    Support
  * @subpackage UnitTests
- * @copyright  2008-2009 The Horde Project (http://www.horde.org/)
+ * @copyright  2008-2010 The Horde Project (http://www.horde.org/)
  * @license    http://opensource.org/licenses/bsd-license.php
  */
 class Horde_Support_ConsistentHashTest extends PHPUnit_Framework_TestCase
@@ -183,8 +187,7 @@ class Horde_Support_ConsistentHashTest extends PHPUnit_Framework_TestCase
         // Remove the fixed test value.
         $nodes = array_values($nodes);
         $testindex = array_search('key', $nodes);
-        $tmp = array_splice($nodes, $testindex, 1);
-        $testvalue = array_shift($tmp);
+        array_splice($nodes, $testindex, 1);
 
         foreach ($nodes as $node) {
             $h->add($node);
@@ -197,7 +200,7 @@ class Horde_Support_ConsistentHashTest extends PHPUnit_Framework_TestCase
 
         $this->assertEquals(
             $expected,
-            $h->getNodes($testvalue, 10));
+            $h->getNodes('key', 10));
     }
 
     public function testFallbackWhenANodeIsRemoved()
@@ -217,8 +220,7 @@ class Horde_Support_ConsistentHashTest extends PHPUnit_Framework_TestCase
         // Remove the fixed test value.
         $nodes = array_values($nodes);
         $testindex = array_search('key', $nodes);
-        $tmp = array_splice($nodes, $testindex, 1);
-        $testvalue = array_shift($tmp);
+        array_splice($nodes, $testindex, 1);
 
         foreach ($nodes as $node) {
             $h->add($node);