Added: 
incubator/shindig/trunk/php/test/PHPUnit/Util/TestDox/ResultPrinter/Text.php
URL: 
http://svn.apache.org/viewvc/incubator/shindig/trunk/php/test/PHPUnit/Util/TestDox/ResultPrinter/Text.php?rev=663970&view=auto
==============================================================================
--- 
incubator/shindig/trunk/php/test/PHPUnit/Util/TestDox/ResultPrinter/Text.php 
(added)
+++ 
incubator/shindig/trunk/php/test/PHPUnit/Util/TestDox/ResultPrinter/Text.php 
Fri Jun  6 07:55:55 2008
@@ -0,0 +1,99 @@
+<?php
+/**
+ * PHPUnit
+ *
+ * Copyright (c) 2002-2008, Sebastian Bergmann <[EMAIL PROTECTED]>.
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ *   * Redistributions of source code must retain the above copyright
+ *     notice, this list of conditions and the following disclaimer.
+ *
+ *   * Redistributions in binary form must reproduce the above copyright
+ *     notice, this list of conditions and the following disclaimer in
+ *     the documentation and/or other materials provided with the
+ *     distribution.
+ *
+ *   * Neither the name of Sebastian Bergmann nor the names of his
+ *     contributors may be used to endorse or promote products derived
+ *     from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+ * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+ * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+ * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+ * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
+ * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+ * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ *
+ * @category   Testing
+ * @package    PHPUnit
+ * @author     Sebastian Bergmann <[EMAIL PROTECTED]>
+ * @copyright  2002-2008 Sebastian Bergmann <[EMAIL PROTECTED]>
+ * @license    http://www.opensource.org/licenses/bsd-license.php  BSD License
+ * @version    SVN: $Id: Text.php 1985 2007-12-26 18:11:55Z sb $
+ * @link       http://www.phpunit.de/
+ * @since      File available since Release 2.3.0
+ */
+
+require_once '../PHPUnit/Util/Filter.php';
+require_once '../PHPUnit/Util/TestDox/ResultPrinter.php';
+
+PHPUnit_Util_Filter::addFileToFilter(__FILE__, 'PHPUNIT');
+
+/**
+ * Prints TestDox documentation in text format.
+ *
+ * @category   Testing
+ * @package    PHPUnit
+ * @author     Sebastian Bergmann <[EMAIL PROTECTED]>
+ * @copyright  2002-2008 Sebastian Bergmann <[EMAIL PROTECTED]>
+ * @license    http://www.opensource.org/licenses/bsd-license.php  BSD License
+ * @version    Release: 3.2.9
+ * @link       http://www.phpunit.de/
+ * @since      Class available since Release 2.1.0
+ */
+class PHPUnit_Util_TestDox_ResultPrinter_Text extends 
PHPUnit_Util_TestDox_ResultPrinter
+{
+    /**
+     * Handler for 'start class' event.
+     *
+     * @param  string $name
+     * @access protected
+     */
+    protected function startClass($name)
+    {
+        $this->write($name . "\n");
+    }
+
+    /**
+     * Handler for 'on test' event.
+     *
+     * @param  string $name
+     * @access protected
+     */
+    protected function onTest($name)
+    {
+        $this->write(' - ' . $name . "\n");
+    }
+
+    /**
+     * Handler for 'end class' event.
+     *
+     * @param  string $name
+     * @access protected
+     */
+    protected function endClass($name)
+    {
+        $this->write("\n");
+    }
+}
+?>

Added: incubator/shindig/trunk/php/test/PHPUnit/Util/TestSuiteIterator.php
URL: 
http://svn.apache.org/viewvc/incubator/shindig/trunk/php/test/PHPUnit/Util/TestSuiteIterator.php?rev=663970&view=auto
==============================================================================
--- incubator/shindig/trunk/php/test/PHPUnit/Util/TestSuiteIterator.php (added)
+++ incubator/shindig/trunk/php/test/PHPUnit/Util/TestSuiteIterator.php Fri Jun 
 6 07:55:55 2008
@@ -0,0 +1,163 @@
+<?php
+/**
+ * PHPUnit
+ *
+ * Copyright (c) 2002-2008, Sebastian Bergmann <[EMAIL PROTECTED]>.
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ *   * Redistributions of source code must retain the above copyright
+ *     notice, this list of conditions and the following disclaimer.
+ * 
+ *   * Redistributions in binary form must reproduce the above copyright
+ *     notice, this list of conditions and the following disclaimer in
+ *     the documentation and/or other materials provided with the
+ *     distribution.
+ *
+ *   * Neither the name of Sebastian Bergmann nor the names of his
+ *     contributors may be used to endorse or promote products derived
+ *     from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+ * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+ * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+ * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+ * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
+ * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+ * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ *
+ * @category   Testing
+ * @package    PHPUnit
+ * @author     Sebastian Bergmann <[EMAIL PROTECTED]>
+ * @copyright  2002-2008 Sebastian Bergmann <[EMAIL PROTECTED]>
+ * @license    http://www.opensource.org/licenses/bsd-license.php  BSD License
+ * @version    SVN: $Id: TestSuiteIterator.php 1985 2007-12-26 18:11:55Z sb $
+ * @link       http://www.phpunit.de/
+ * @since      File available since Release 3.1.0
+ */
+
+require_once '../PHPUnit/Util/Filter.php';
+
+PHPUnit_Util_Filter::addFileToFilter(__FILE__, 'PHPUNIT');
+
+/**
+ * Iterator for test suites.
+ *
+ * @category   Testing
+ * @package    PHPUnit
+ * @author     Sebastian Bergmann <[EMAIL PROTECTED]>
+ * @copyright  2002-2008 Sebastian Bergmann <[EMAIL PROTECTED]>
+ * @license    http://www.opensource.org/licenses/bsd-license.php  BSD License
+ * @version    Release: 3.2.9
+ * @link       http://www.phpunit.de/
+ * @since      Class available since Release 3.1.0
+ */
+class PHPUnit_Util_TestSuiteIterator implements RecursiveIterator
+{
+    /**
+     * @var    integer
+     * @access protected
+     */
+    protected $position;
+
+    /**
+     * @var    PHPUnit_Framework_Test[]
+     * @access protected
+     */
+    protected $tests;
+
+    /**
+     * Constructor.
+     *
+     * @param  PHPUnit_Framework_TestSuite $suite
+     * @access public
+     */
+    public function __construct(PHPUnit_Framework_TestSuite $testSuite)
+    {
+        $this->tests = $testSuite->tests();
+    }
+
+    /**
+     * Rewinds the Iterator to the first element.
+     *
+     * @access public
+     */
+    public function rewind()
+    {
+        $this->position = 0;
+    }
+
+    /**
+     * Checks if there is a current element after calls to rewind() or next().
+     *
+     * @return boolean
+     * @access public
+     */
+    public function valid()
+    {
+        return $this->position < count($this->tests);
+    }
+
+    /**
+     * Returns the key of the current element.
+     *
+     * @return integer
+     * @access public
+     */
+    public function key()
+    {
+        return $this->position;
+    }
+
+    /**
+     * Returns the current element.
+     *
+     * @return PHPUnit_Framework_Test
+     * @access public
+     */
+    public function current()
+    {
+        return $this->valid() ? $this->tests[$this->position] : NULL;
+    }
+
+    /**
+     * Moves forward to next element.
+     *
+     * @access public
+     */
+    public function next()
+    {
+        $this->position++;
+    }
+
+    /**
+     * Returns the sub iterator for the current element.
+     *
+     * @return PHPUnit_Util_TestSuiteIterator
+     * @access public
+     */
+    public function getChildren()
+    {
+        return new 
PHPUnit_Util_TestSuiteIterator($this->tests[$this->position]);
+    }
+
+    /**
+     * Checks whether the current element has children.
+     *
+     * @return boolean
+     * @access public
+     */
+    public function hasChildren()
+    {
+        return $this->tests[$this->position] instanceof 
PHPUnit_Framework_TestSuite;
+    }
+}
+?>

Added: incubator/shindig/trunk/php/test/PHPUnit/Util/Timer.php
URL: 
http://svn.apache.org/viewvc/incubator/shindig/trunk/php/test/PHPUnit/Util/Timer.php?rev=663970&view=auto
==============================================================================
--- incubator/shindig/trunk/php/test/PHPUnit/Util/Timer.php (added)
+++ incubator/shindig/trunk/php/test/PHPUnit/Util/Timer.php Fri Jun  6 07:55:55 
2008
@@ -0,0 +1,136 @@
+<?php
+/**
+ * PHPUnit
+ *
+ * Copyright (c) 2002-2008, Sebastian Bergmann <[EMAIL PROTECTED]>.
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ *   * Redistributions of source code must retain the above copyright
+ *     notice, this list of conditions and the following disclaimer.
+ *
+ *   * Redistributions in binary form must reproduce the above copyright
+ *     notice, this list of conditions and the following disclaimer in
+ *     the documentation and/or other materials provided with the
+ *     distribution.
+ *
+ *   * Neither the name of Sebastian Bergmann nor the names of his
+ *     contributors may be used to endorse or promote products derived
+ *     from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+ * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+ * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+ * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+ * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
+ * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+ * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ *
+ * @category   Testing
+ * @package    PHPUnit
+ * @author     Sebastian Bergmann <[EMAIL PROTECTED]>
+ * @copyright  2002-2008 Sebastian Bergmann <[EMAIL PROTECTED]>
+ * @license    http://www.opensource.org/licenses/bsd-license.php  BSD License
+ * @version    SVN: $Id: Timer.php 1985 2007-12-26 18:11:55Z sb $
+ * @link       http://www.phpunit.de/
+ * @since      File available since Release 3.0.0
+ */
+
+require_once '../PHPUnit/Util/Filter.php';
+
+PHPUnit_Util_Filter::addFileToFilter(__FILE__, 'PHPUNIT');
+
+/**
+ * Utility class for timing.
+ *
+ * @category   Testing
+ * @package    PHPUnit
+ * @author     Sebastian Bergmann <[EMAIL PROTECTED]>
+ * @copyright  2002-2008 Sebastian Bergmann <[EMAIL PROTECTED]>
+ * @license    http://www.opensource.org/licenses/bsd-license.php  BSD License
+ * @version    Release: 3.2.9
+ * @link       http://www.phpunit.de/
+ * @since      Class available since Release 3.0.0
+ */
+class PHPUnit_Util_Timer
+{
+    protected static $startTimes = array();
+
+    /**
+     * Starts the timer.
+     *
+     * @access public
+     * @static
+     */
+    public static function start()
+    {
+        array_push(self::$startTimes, microtime(TRUE));
+    }
+
+    /**
+     * Returns the currently elapsed time.
+     *
+     * @return float
+     * @access public
+     * @static
+     */
+    public static function current()
+    {
+        return microtime(TRUE) - self::$startTimes[count(self::$startTimes)-1];
+    }
+
+    /**
+     * Stops the timer and returns the elapsed time.
+     *
+     * @access public
+     * @static
+     */
+    public static function stop()
+    {
+        return microtime(TRUE) - array_pop(self::$startTimes);
+    }
+
+    /**
+     * Formats elapsed time (in seconds) to a string.
+     *
+     * @param  float $time
+     * @return float
+     * @access public
+     * @static
+     */
+    public static function secondsToTimeString($time)
+    {
+        $buffer = '';
+
+        $hours   = sprintf('%02d', ($time >= 3600) ? floor($time / 3600) : 0);
+        $minutes = sprintf('%02d', ($time >= 60)   ? floor($time /   60) - 60 
* $hours : 0);
+        $seconds = sprintf('%02d', $time - 60 * 60 * $hours - 60 * $minutes);
+
+        if ($hours == 0 && $minutes == 0) {
+            $seconds = sprintf('%1d', $seconds);
+
+            $buffer .= $seconds . ' second';
+
+            if ($seconds != '1') {
+                $buffer .= 's';
+            }
+        } else {
+            if ($hours > 0) {
+                $buffer = $hours . ':';
+            }
+
+            $buffer .= $minutes . ':' . $seconds;
+        }
+
+        return $buffer;
+    }
+}
+?>

Added: incubator/shindig/trunk/php/test/PHPUnit/Util/Type.php
URL: 
http://svn.apache.org/viewvc/incubator/shindig/trunk/php/test/PHPUnit/Util/Type.php?rev=663970&view=auto
==============================================================================
--- incubator/shindig/trunk/php/test/PHPUnit/Util/Type.php (added)
+++ incubator/shindig/trunk/php/test/PHPUnit/Util/Type.php Fri Jun  6 07:55:55 
2008
@@ -0,0 +1,197 @@
+<?php
+/**
+ * PHPUnit
+ *
+ * Copyright (c) 2002-2008, Sebastian Bergmann <[EMAIL PROTECTED]>.
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ *   * Redistributions of source code must retain the above copyright
+ *     notice, this list of conditions and the following disclaimer.
+ *
+ *   * Redistributions in binary form must reproduce the above copyright
+ *     notice, this list of conditions and the following disclaimer in
+ *     the documentation and/or other materials provided with the
+ *     distribution.
+ *
+ *   * Neither the name of Sebastian Bergmann nor the names of his
+ *     contributors may be used to endorse or promote products derived
+ *     from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+ * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+ * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+ * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+ * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
+ * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+ * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ *
+ * @category   Testing
+ * @package    PHPUnit
+ * @author     Sebastian Bergmann <[EMAIL PROTECTED]>
+ * @copyright  2002-2008 Sebastian Bergmann <[EMAIL PROTECTED]>
+ * @license    http://www.opensource.org/licenses/bsd-license.php  BSD License
+ * @version    SVN: $Id: Type.php 1985 2007-12-26 18:11:55Z sb $
+ * @link       http://www.phpunit.de/
+ * @since      File available since Release 3.0.0
+ */
+
+require_once '../PHPUnit/Util/Filter.php';
+
+PHPUnit_Util_Filter::addFileToFilter(__FILE__, 'PHPUNIT');
+
+/**
+ * Utility class for textual type (and value) representation.
+ *
+ * @category   Testing
+ * @package    PHPUnit
+ * @author     Sebastian Bergmann <[EMAIL PROTECTED]>
+ * @copyright  2002-2008 Sebastian Bergmann <[EMAIL PROTECTED]>
+ * @license    http://www.opensource.org/licenses/bsd-license.php  BSD License
+ * @version    Release: 3.2.9
+ * @link       http://www.phpunit.de/
+ * @since      Class available since Release 3.0.0
+ */
+class PHPUnit_Util_Type
+{
+    public static function isType($type)
+    {
+        return in_array(
+          $type,
+          array(
+            'numeric',
+            'integer',
+            'int',
+            'float',
+            'string',
+            'boolean',
+            'bool',
+            'null',
+            'array',
+            'object',
+            'resource'
+          )
+        );
+    }
+
+    public static function shortenedExport($value)
+    {
+        if (is_string($value)) {
+            return self::shortenedString($value);
+        }
+
+        elseif (is_array($value)) {
+            if (count($value) == 0) {
+                return 'array()';
+            }
+
+            $a1 = array_slice($value, 0, 1, TRUE);
+            $k1 = key($a1);
+            $v1 = $a1[$k1];
+
+            if (is_string($v1)) {
+                $v1 = self::shortenedString($v1);
+            }
+
+            elseif (is_array($v1)) {
+                $v1 = 'array(...)';
+            } else {
+                $v1 = self::toString($v1);
+            }
+
+            $a2 = FALSE;
+
+            if (count($value) > 1) {
+                $a2 = array_slice($value, -1, 1, TRUE);
+                $k2 = key($a2);
+                $v2 = $a2[$k2];
+
+                if (is_string($v2)) {
+                    $v2 = self::shortenedString($v2);
+                }
+
+                elseif (is_array($v2)) {
+                    $v2 = 'array(...)';
+                } else {
+                    $v2 = self::toString($v2);
+                }
+            }
+
+            $text = 'array( ' . self::toString($k1) . ' => ' . $v1;
+
+            if ($a2 !== FALSE) {
+                $text .= ', ..., ' . self::toString($k2) . ' => ' . $v2 . ' )';
+            } else {
+                $text .= ' )';
+            }
+
+            return $text;
+        }
+
+        elseif (is_object($value)) {
+            return get_class($value) . '(...)';
+        }
+
+        return self::toString($value);
+    }
+
+    public static function shortenedString($string)
+    {
+        $string = preg_replace('#\n|\r\n|\r#', ' ', $string);
+
+        if (strlen($string) > 14) {
+            return PHPUnit_Util_Type::toString(
+              substr($string, 0, 7) . '...' . substr($string, -7)
+            );
+        } else {
+            return PHPUnit_Util_Type::toString($string);
+        }
+    }
+
+    public static function toString($value, $short = FALSE)
+    {
+        if (is_array($value) || is_object($value)) {
+            if (!$short) {
+                return "\n" . print_r($value, TRUE);
+            } else {
+                if (is_array($value)) {
+                    return '<array>';
+                } else {
+                    return '<' . get_class($value) . '>';
+                }
+            }
+        }
+
+        if (is_string($value) && strpos($value, "\n") !== FALSE) {
+            return '<text>';
+        }
+
+        if (!is_null($value)) {
+            $type = gettype($value) . ':';
+        } else {
+            $type  = '';
+            $value = 'null';
+        }
+
+        if (is_bool($value)) {
+            if ($value === TRUE) {
+                $value = 'true';
+            }
+
+            else if ($value === FALSE) {
+                $value = 'false';
+            }
+        }
+
+        return '<' . $type . $value . '>';
+    }
+}
+?>

Added: incubator/shindig/trunk/php/test/PHPUnit/Util/XML.php
URL: 
http://svn.apache.org/viewvc/incubator/shindig/trunk/php/test/PHPUnit/Util/XML.php?rev=663970&view=auto
==============================================================================
--- incubator/shindig/trunk/php/test/PHPUnit/Util/XML.php (added)
+++ incubator/shindig/trunk/php/test/PHPUnit/Util/XML.php Fri Jun  6 07:55:55 
2008
@@ -0,0 +1,106 @@
+<?php
+/**
+ * PHPUnit
+ *
+ * Copyright (c) 2002-2008, Sebastian Bergmann <[EMAIL PROTECTED]>.
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ *   * Redistributions of source code must retain the above copyright
+ *     notice, this list of conditions and the following disclaimer.
+ *
+ *   * Redistributions in binary form must reproduce the above copyright
+ *     notice, this list of conditions and the following disclaimer in
+ *     the documentation and/or other materials provided with the
+ *     distribution.
+ *
+ *   * Neither the name of Sebastian Bergmann nor the names of his
+ *     contributors may be used to endorse or promote products derived
+ *     from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+ * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+ * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+ * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+ * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
+ * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+ * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ *
+ * @category   Testing
+ * @package    PHPUnit
+ * @author     Sebastian Bergmann <[EMAIL PROTECTED]>
+ * @copyright  2002-2008 Sebastian Bergmann <[EMAIL PROTECTED]>
+ * @license    http://www.opensource.org/licenses/bsd-license.php  BSD License
+ * @version    SVN: $Id: XML.php 1985 2007-12-26 18:11:55Z sb $
+ * @link       http://www.phpunit.de/
+ * @since      File available since Release 3.2.0
+ */
+
+require_once '../PHPUnit/Util/Filter.php';
+
+PHPUnit_Util_Filter::addFileToFilter(__FILE__, 'PHPUNIT');
+
+/**
+ * XML helpers.
+ *
+ * @category   Testing
+ * @package    PHPUnit
+ * @author     Sebastian Bergmann <[EMAIL PROTECTED]>
+ * @copyright  2002-2008 Sebastian Bergmann <[EMAIL PROTECTED]>
+ * @license    http://www.opensource.org/licenses/bsd-license.php  BSD License
+ * @version    Release: 3.2.9
+ * @link       http://www.phpunit.de/
+ * @since      Class available since Release 3.2.0
+ */
+class PHPUnit_Util_XML
+{
+    public static function load($filename, $html = FALSE)
+    {
+        $document = new DOMDocument;
+
+        if (is_readable($filename)) {
+            libxml_use_internal_errors(TRUE);
+
+            if (!$html) {
+                $loaded = @$document->load($filename);
+            } else {
+                $loaded = @$document->loadHTMLFile($filename);
+            }
+
+            if ($loaded === FALSE) {
+                $message = '';
+
+                foreach (libxml_get_errors() as $error) {
+                    $message .= $error->message;
+                }
+
+                throw new RuntimeException(
+                  sprintf(
+                    'Could not load "%s".%s',
+
+                    $filename,
+                    $message != '' ? "\n" . $message : ''
+                  )
+                );
+            }
+        } else {
+            throw new RuntimeException(
+              sprintf(
+                'Could not read "%s".',
+                $filename
+              )
+            );
+        }
+
+        return $document;
+    }
+}
+?>

Added: incubator/shindig/trunk/php/test/common/index.php
URL: 
http://svn.apache.org/viewvc/incubator/shindig/trunk/php/test/common/index.php?rev=663970&view=auto
==============================================================================
--- incubator/shindig/trunk/php/test/common/index.php (added)
+++ incubator/shindig/trunk/php/test/common/index.php Fri Jun  6 07:55:55 2008
@@ -0,0 +1,43 @@
+<?php
+require_once "../PHPUnit/Framework/TestSuite.php";
+require_once "../PHPUnit/TextUI/TestRunner.php";
+
+// JUST FOR DEV
+
+function readDirR($dirName, &$names){
+       if(is_file($dir)){
+                               return;
+       }
+       $dir = opendir($dirName);
+       if(count($dir)> 2 ){
+               foreach ($dir as $file){
+                       if($file != '..' && $file != '.'){
+                               if(is_dir($file)){
+                                       readDirR($dirName.'/'.$file, $names);
+                               }
+                               $clase = str_replace('.php','',$file);
+                               $names[] = array('path' => 
$dirName.'/'.$file,'name' => $clase);
+                       }
+               }
+       }
+
+}
+
+$clases = array();
+readDirR('.', $clases);
+$suite  = new PHPUnit_Framework_TestSuite();
+
+foreach($clases as $clase){
+       if(file_exists($clase['path'])){
+               @require_once $clase['path'];
+               if(class_exists($clase['name'])){
+                       $suite->addTestSuite($clase['name']);
+               }
+       }
+}
+
+$result = new PHPUnit_TextUI_TestRunner();
+echo '<html><head><title>TestCases</title></head><body><h1>Test 
Cases</h1><pre>'; 
+       $result->doRun($suite);
+echo'</pre></body></html>'
+?>
\ No newline at end of file

Added: incubator/shindig/trunk/php/test/gadgets/GadgetContextTest.php
URL: 
http://svn.apache.org/viewvc/incubator/shindig/trunk/php/test/gadgets/GadgetContextTest.php?rev=663970&view=auto
==============================================================================
--- incubator/shindig/trunk/php/test/gadgets/GadgetContextTest.php (added)
+++ incubator/shindig/trunk/php/test/gadgets/GadgetContextTest.php Fri Jun  6 
07:55:55 2008
@@ -0,0 +1,390 @@
+<?php
+
+require_once '../../src/gadgets/GadgetContext.php';
+require_once '../PHPUnit/Framework/TestCase.php';
+require_once '../../config.php';
+
+/**
+ * GadgetContext test case.
+ */
+class GadgetContextTest extends PHPUnit_Framework_TestCase {
+       
+       /**
+        * @var GadgetContext
+        */
+       private $GadgetContext;
+       
+       /**
+        * @var testData
+        */
+       private $testData = array(
+               'url' => 'http://www.google.com/gadget-',
+               'libs' => '',
+               'synd' => 'default',
+               'nocache' => '',
+               'container' => 'default',
+               'view' => 'default',
+               'mid' => '123',
+               'bcp' => ''
+       );
+       
+       /**
+        * @var gadgetRenderingContext
+        */
+       private $gadgetRenderingContext = 'GADGET';
+       /**
+        * Prepares the environment before running a test.
+        */
+       protected function setUp() {
+               parent::setUp ();
+       
+               $_GET = $this->testData;
+               $this->GadgetContext = new 
GadgetContext($this->gadgetRenderingContext);
+       
+       }
+       
+       /**
+        * Cleans up the environment after running a test.
+        */
+       protected function tearDown() {
+               $this->GadgetContext = null;
+               
+               parent::tearDown ();
+       }
+       
+       /**
+        * Constructs the test case.
+        */
+       public function __construct() {
+               // TODO Auto-generated constructor
+               
+               
+       }
+       
+       /**
+        * Tests GadgetContext->getBlacklist()
+        */
+       public function testGetBlacklist() {
+               $this->markTestIncomplete ( "getBlacklist test not implemented" 
);
+               
+               $this->GadgetContext->getBlacklist(/* parameters */);
+       
+       }
+       
+       /**
+        * Tests GadgetContext->getCache()
+        */
+       public function testGetCache() {
+               // TODO Auto-generated GadgetContextTest->testGetCache()
+               $this->markTestIncomplete ( "getCache test not implemented" );
+               
+               $this->GadgetContext->getCache(/* parameters */);
+       
+       }
+       
+       /**
+        * Tests GadgetContext->getContainer()
+        */
+       public function testGetContainer() {
+               
+               
$this->assertEquals($this->testData['container'],$this->GadgetContext->getContainer());
+       
+       }
+       
+       /**
+        * Tests GadgetContext->getContainerConfig()
+        */
+       public function testGetContainerConfig() {
+               // TODO Auto-generated 
GadgetContextTest->testGetContainerConfig()
+               $this->markTestIncomplete ( "getContainerConfig test not 
implemented" );
+               
+               $this->GadgetContext->getContainerConfig(/* parameters */);
+       
+       }
+       
+       /**
+        * Tests GadgetContext->getFeatureRegistry()
+        */
+       public function testGetFeatureRegistry() {
+               // TODO Auto-generated 
GadgetContextTest->testGetFeatureRegistry()
+               $this->markTestIncomplete ( "getFeatureRegistry test not 
implemented" );
+               
+               $this->GadgetContext->getFeatureRegistry(/* parameters */);
+       
+       }
+       
+       /**
+        * Tests GadgetContext->getForcedJsLibs()
+        */
+       public function testGetForcedJsLibs() {
+               
+               
$this->assertEquals($this->testData['libs'],$this->GadgetContext->getForcedJsLibs());
+       
+       }
+       
+       /**
+        * Tests GadgetContext->getGadgetId()
+        */
+       public function testGetGadgetId() {
+               // TODO Auto-generated GadgetContextTest->testGetGadgetId()
+               $this->markTestIncomplete ( "getGadgetId test not implemented" 
);
+               
+               $this->GadgetContext->getGadgetId(/* parameters */);
+       
+       }
+       
+       /**
+        * Tests GadgetContext->getHttpFetcher()
+        */
+       public function testGetHttpFetcher() {
+               // TODO Auto-generated GadgetContextTest->testGetHttpFetcher()
+               $this->markTestIncomplete ( "getHttpFetcher test not 
implemented" );
+               
+               $this->GadgetContext->getHttpFetcher(/* parameters */);
+       
+       }
+       
+       /**
+        * Tests GadgetContext->getIgnoreCache()
+        */
+       public function testGetIgnoreCache() {
+               // TODO Auto-generated GadgetContextTest->testGetIgnoreCache()
+               $this->markTestIncomplete ( "getIgnoreCache test not 
implemented" );
+               
+               $this->GadgetContext->getIgnoreCache(/* parameters */);
+       
+       }
+       
+       /**
+        * Tests GadgetContext->getLocale()
+        */
+       public function testGetLocale() {
+               // TODO Auto-generated GadgetContextTest->testGetLocale()
+               $this->markTestIncomplete ( "getLocale test not implemented" );
+               
+               $this->GadgetContext->getLocale(/* parameters */);
+       
+       }
+       
+       /**
+        * Tests GadgetContext->getModuleId()
+        */
+       public function testGetModuleId() {             
+               
$this->assertEquals($this->testData['mid'],$this->GadgetContext->getModuleId());
+       
+       }
+       
+       /**
+        * Tests GadgetContext->getRegistry()
+        */
+       public function testGetRegistry() {
+               // TODO Auto-generated GadgetContextTest->testGetRegistry()
+               $this->markTestIncomplete ( "getRegistry test not implemented" 
);
+               
+               $this->GadgetContext->getRegistry(/* parameters */);
+       
+       }
+       
+       /**
+        * Tests GadgetContext->getRenderingContext()
+        */
+       public function testGetRenderingContext() {
+               
+               
$this->assertEquals($this->gadgetRenderingContext,$this->GadgetContext->getRenderingContext());
+       
+       }
+       
+       /**
+        * Tests GadgetContext->getUrl()
+        */
+       public function testGetUrl() {
+               
+               
$this->assertEquals($this->testData['url'],$this->GadgetContext->getUrl());
+       
+       }
+       
+       /**
+        * Tests GadgetContext->getUserPrefs()
+        */
+       public function testGetUserPrefs() {
+               // TODO Auto-generated GadgetContextTest->testGetUserPrefs()
+               $this->markTestIncomplete ( "getUserPrefs test not implemented" 
);
+               
+               $this->GadgetContext->getUserPrefs();
+       
+       }
+       
+       /**
+        * Tests GadgetContext->getView()
+        */
+       public function testGetView() {
+               
+               $this->assertEquals($this->testData['view'], 
$this->GadgetContext->getView());
+       
+       }
+       
+       /**
+        * Tests GadgetContext->setBlacklist()
+        */
+       public function testSetBlacklist() {
+               // TODO Auto-generated GadgetContextTest->testSetBlacklist()
+               $this->markTestIncomplete ( "setBlacklist test not implemented" 
);
+               
+               $this->GadgetContext->setBlacklist(/* parameters */);
+       
+       }
+       
+       /**
+        * Tests GadgetContext->setCache()
+        */
+       public function testSetCache() {
+               // TODO Auto-generated GadgetContextTest->testSetCache()
+               $this->markTestIncomplete ( "setCache test not implemented" );
+               
+               $this->GadgetContext->setCache(/* parameters */);
+       
+       }
+       
+       /**
+        * Tests GadgetContext->setContainer()
+        */
+       public function testSetContainer() {
+               // TODO Auto-generated GadgetContextTest->testSetContainer()
+               $this->markTestIncomplete ( "setContainer test not implemented" 
);
+               
+               $this->GadgetContext->setContainer(/* parameters */);
+       
+       }
+       
+       /**
+        * Tests GadgetContext->setContainerConfig()
+        */
+       public function testSetContainerConfig() {
+               // TODO Auto-generated 
GadgetContextTest->testSetContainerConfig()
+               $this->markTestIncomplete ( "setContainerConfig test not 
implemented" );
+               
+               $this->GadgetContext->setContainerConfig(/* parameters */);
+       
+       }
+       
+       /**
+        * Tests GadgetContext->setForcedJsLibs()
+        */
+       public function testSetForcedJsLibs() {
+               // TODO Auto-generated GadgetContextTest->testSetForcedJsLibs()
+               $this->markTestIncomplete ( "setForcedJsLibs test not 
implemented" );
+               
+               $this->GadgetContext->setForcedJsLibs(/* parameters */);
+       
+       }
+       
+       /**
+        * Tests GadgetContext->setGadgetId()
+        */
+       public function testSetGadgetId() {
+               // TODO Auto-generated GadgetContextTest->testSetGadgetId()
+               $this->markTestIncomplete ( "setGadgetId test not implemented" 
);
+               
+               $this->GadgetContext->setGadgetId(/* parameters */);
+       
+       }
+       
+       /**
+        * Tests GadgetContext->setHttpFetcher()
+        */
+       public function testSetHttpFetcher() {
+               // TODO Auto-generated GadgetContextTest->testSetHttpFetcher()
+               $this->markTestIncomplete ( "setHttpFetcher test not 
implemented" );
+               
+               $this->GadgetContext->setHttpFetcher(/* parameters */);
+       
+       }
+       
+       /**
+        * Tests GadgetContext->setIgnoreCache()
+        */
+       public function testSetIgnoreCache() {
+               // TODO Auto-generated GadgetContextTest->testSetIgnoreCache()
+               $this->markTestIncomplete ( "setIgnoreCache test not 
implemented" );
+               
+               $this->GadgetContext->setIgnoreCache(/* parameters */);
+       
+       }
+       
+       /**
+        * Tests GadgetContext->setLocale()
+        */
+       public function testSetLocale() {
+               // TODO Auto-generated GadgetContextTest->testSetLocale()
+               $this->markTestIncomplete ( "setLocale test not implemented" );
+               
+               $this->GadgetContext->setLocale(/* parameters */);
+       
+       }
+       
+       /**
+        * Tests GadgetContext->setModuleId()
+        */
+       public function testSetModuleId() {
+               // TODO Auto-generated GadgetContextTest->testSetModuleId()
+               $this->markTestIncomplete ( "setModuleId test not implemented" 
);
+               
+               $this->GadgetContext->setModuleId(/* parameters */);
+       
+       }
+       
+       /**
+        * Tests GadgetContext->setRegistry()
+        */
+       public function testSetRegistry() {
+               // TODO Auto-generated GadgetContextTest->testSetRegistry()
+               $this->markTestIncomplete ( "setRegistry test not implemented" 
);
+               
+               $this->GadgetContext->setRegistry(/* parameters */);
+       
+       }
+       
+       /**
+        * Tests GadgetContext->setRenderingContext()
+        */
+       public function testSetRenderingContext() {
+               $redering_context = 'Dummie_rendering_context';
+               $this->GadgetContext->setRenderingContext($redering_context);
+               
$this->assertAttributeEquals($redering_context,'renderingContext',$this->GadgetContext);
+       
+       }
+       
+       /**
+        * Tests GadgetContext->setUrl()
+        */
+       public function testSetUrl() {
+               $url = 'Dummie_url';
+               $this->GadgetContext->setUrl($url);
+               $this->assertAttributeEquals($url,'url',$this->GadgetContext);
+       
+       }
+       
+       /**
+        * Tests GadgetContext->setUserPrefs()
+        */
+       public function testSetUserPrefs() {
+               // TODO Auto-generated GadgetContextTest->testSetUserPrefs()
+               $this->markTestIncomplete ( "setUserPrefs test not implemented" 
);
+               
+               $this->GadgetContext->setUserPrefs(/* parameters */);
+       
+       }
+       
+       /**
+        * Tests GadgetContext->setView()
+        */
+       public function testSetView() {
+               $view = 'Dummie_view';
+               $this->GadgetContext->setView($view);
+               $this->assertAttributeEquals($view,'view',$this->GadgetContext);
+               
+       }
+       
+
+}
+

Added: incubator/shindig/trunk/php/test/gadgets/GadgetIdTest.php
URL: 
http://svn.apache.org/viewvc/incubator/shindig/trunk/php/test/gadgets/GadgetIdTest.php?rev=663970&view=auto
==============================================================================
--- incubator/shindig/trunk/php/test/gadgets/GadgetIdTest.php (added)
+++ incubator/shindig/trunk/php/test/gadgets/GadgetIdTest.php Fri Jun  6 
07:55:55 2008
@@ -0,0 +1,80 @@
+<?php
+
+require_once '../../src/gadgets/GadgetId.php';
+
+require_once '../PHPUnit/Framework/TestCase.php';
+
+/**
+ * GadgetId test case.
+ */
+class GadgetIdTest extends PHPUnit_Framework_TestCase {
+       
+       /**
+        * @var GadgetId
+        */
+       private $GadgetId;
+       private $uri;
+       private $moduleId;
+       /**
+        * Prepares the environment before running a test.
+        */
+       protected function setUp() {
+               parent::setUp ();
+               
+               // TODO Auto-generated GadgetIdTest::setUp()
+               
+               
+               $this->GadgetId = new GadgetId($this->uri,$this->moduleId);
+       
+       }
+       
+       /**
+        * Cleans up the environment after running a test.
+        */
+       protected function tearDown() {
+               // TODO Auto-generated GadgetIdTest::tearDown()
+               
+
+               $this->GadgetId = null;
+               
+               parent::tearDown ();
+       }
+       
+       /**
+        * Constructs the test case.
+        */
+       public function __construct() {
+               // TODO Auto-generated constructor
+       }
+       
+       
+       /**
+        * Tests GadgetId->getKey()
+        */
+       public function testGetKey() {
+               // TODO Auto-generated GadgetIdTest->testGetKey()
+               
+               $this->assertEquals($this->uri,$this->GadgetId->getKey());
+       }
+       
+       /**
+        * Tests GadgetId->getModuleId()
+        */
+       public function testGetModuleId() {
+               // TODO Auto-generated GadgetIdTest->testGetModuleId()
+               
+               $this->GadgetId->getModuleId();
+       
+       }
+       
+       /**
+        * Tests GadgetId->getURI()
+        */
+       public function testGetURI() {
+               // TODO Auto-generated GadgetIdTest->testGetURI()
+               $this->assertEquals($this->uri,$this->GadgetId->getURI());
+       
+       }
+
+}
+

Added: incubator/shindig/trunk/php/test/gadgets/index.php
URL: 
http://svn.apache.org/viewvc/incubator/shindig/trunk/php/test/gadgets/index.php?rev=663970&view=auto
==============================================================================
--- incubator/shindig/trunk/php/test/gadgets/index.php (added)
+++ incubator/shindig/trunk/php/test/gadgets/index.php Fri Jun  6 07:55:55 2008
@@ -0,0 +1,43 @@
+<?php
+
+set_include_path("../");
+
+require_once "PHPUnit/Framework/TestSuite.php";
+require_once "PHPUnit/TextUI/TestRunner.php";
+
+// JUST FOR DEV
+
+function readDirR($dirName, &$names){
+       $dir = opendir($dirName);
+       if(count($dir)> 0 ){
+                while (($file = readdir($dir)) !== false) {
+                       if($file != '..' && $file != '.' && $file != 
'index.php'){
+                               if(is_dir($file)){
+                                       readDirR($dirName.'/'.$file, $names);
+                               }else{
+                                       $clase = str_replace('.php','',$file);
+                                       $names[] = array('path' => 
$dirName.'/'.$file,'name' => $clase);
+                               }
+                       }
+               }
+       }
+
+}
+
+$clases = array();
+readDirR('.', $clases);
+$suite  = new PHPUnit_Framework_TestSuite();
+
+foreach($clases as $clase){
+       if(file_exists($clase['path'])){
+               @require_once $clase['path'];
+               if(class_exists($clase['name'])){
+                       $suite->addTestSuite($clase['name']);
+               }
+       }
+}
+$result = new PHPUnit_TextUI_TestRunner();
+echo '<html><head><title>TestCases</title></head><body><h1>Test 
Cases</h1><pre>'; 
+       $result->doRun($suite);
+echo'</pre></body></html>'
+?>
\ No newline at end of file

Added: incubator/shindig/trunk/php/test/socialdata/index.php
URL: 
http://svn.apache.org/viewvc/incubator/shindig/trunk/php/test/socialdata/index.php?rev=663970&view=auto
==============================================================================
--- incubator/shindig/trunk/php/test/socialdata/index.php (added)
+++ incubator/shindig/trunk/php/test/socialdata/index.php Fri Jun  6 07:55:55 
2008
@@ -0,0 +1,43 @@
+<?php
+require_once "../PHPUnit/Framework/TestSuite.php";
+require_once "../PHPUnit/TextUI/TestRunner.php";
+
+// JUST FOR DEV
+
+function readDirR($dirName, &$names){
+       if(is_file($dir)){
+                               return;
+       }
+       $dir = opendir($dirName);
+       if(count($dir)> 2 ){
+               foreach ($dir as $file){
+                       if($file != '..' && $file != '.'){
+                               if(is_dir($file)){
+                                       readDirR($dirName.'/'.$file, $names);
+                               }
+                               $clase = str_replace('.php','',$file);
+                               $names[] = array('path' => 
$dirName.'/'.$file,'name' => $clase);
+                       }
+               }
+       }
+
+}
+
+$clases = array();
+readDirR('.', $clases);
+$suite  = new PHPUnit_Framework_TestSuite();
+
+foreach($clases as $clase){
+       if(file_exists($clase['path'])){
+               @require_once $clase['path'];
+               if(class_exists($clase['name'])){
+                       $suite->addTestSuite($clase['name']);
+               }
+       }
+}
+
+$result = new PHPUnit_TextUI_TestRunner();
+echo '<html><head><title>TestCases</title></head><body><h1>Test 
Cases</h1><pre>'; 
+       $result->doRun($suite);
+echo'</pre></body></html>'
+?>
\ No newline at end of file


Reply via email to