You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@shindig.apache.org by ch...@apache.org on 2008/08/02 16:11:44 UTC

svn commit: r681982 [11/27] - in /incubator/shindig/trunk/php: external/ external/PHPUnit/ external/PHPUnit/Extensions/ external/PHPUnit/Extensions/Database/ external/PHPUnit/Extensions/Database/Constraint/ external/PHPUnit/Extensions/Database/DB/ exte...

Added: incubator/shindig/trunk/php/external/PHPUnit/Framework/TestResult.php
URL: http://svn.apache.org/viewvc/incubator/shindig/trunk/php/external/PHPUnit/Framework/TestResult.php?rev=681982&view=auto
==============================================================================
--- incubator/shindig/trunk/php/external/PHPUnit/Framework/TestResult.php (added)
+++ incubator/shindig/trunk/php/external/PHPUnit/Framework/TestResult.php Sat Aug  2 07:11:35 2008
@@ -0,0 +1,723 @@
+<?php
+/**
+ * PHPUnit
+ *
+ * Copyright (c) 2002-2008, Sebastian Bergmann <sb...@sebastian-bergmann.de>.
+ * 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 <sb...@sebastian-bergmann.de>
+ * @copyright  2002-2008 Sebastian Bergmann <sb...@sebastian-bergmann.de>
+ * @license    http://www.opensource.org/licenses/bsd-license.php  BSD License
+ * @version    SVN: $Id: TestResult.php 2126 2008-01-16 06:21:19Z sb $
+ * @link       http://www.phpunit.de/
+ * @since      File available since Release 2.0.0
+ */
+
+require_once 'PHPUnit/Framework.php';
+require_once 'PHPUnit/Util/ErrorHandler.php';
+require_once 'PHPUnit/Util/Filter.php';
+require_once 'PHPUnit/Util/Printer.php';
+require_once 'PHPUnit/Util/Test.php';
+require_once 'PHPUnit/Util/Timer.php';
+
+PHPUnit_Util_Filter::addFileToFilter(__FILE__, 'PHPUNIT');
+
+if (!class_exists('PHPUnit_Framework_TestResult', FALSE)) {
+
+/**
+ * A TestResult collects the results of executing a test case.
+ *
+ * @category   Testing
+ * @package    PHPUnit
+ * @author     Sebastian Bergmann <sb...@sebastian-bergmann.de>
+ * @copyright  2002-2008 Sebastian Bergmann <sb...@sebastian-bergmann.de>
+ * @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.0.0
+ */
+class PHPUnit_Framework_TestResult implements Countable
+{
+    protected static $xdebugLoaded = null;
+    protected static $useXdebug = null;
+
+    /**
+     * @var    array
+     * @access protected
+     */
+    protected $errors = array();
+
+    /**
+     * @var    array
+     * @access protected
+     */
+    protected $failures = array();
+
+    /**
+     * @var    array
+     * @access protected
+     */
+    protected $notImplemented = array();
+
+    /**
+     * @var    array
+     * @access protected
+     */
+    protected $skipped = array();
+
+    /**
+     * @var    array
+     * @access protected
+     */
+    protected $listeners = array();
+
+    /**
+     * @var    integer
+     * @access protected
+     */
+    protected $runTests = 0;
+
+    /**
+     * @var    float
+     * @access protected
+     */
+    protected $time = 0;
+
+    /**
+     * @var    PHPUnit_Framework_TestSuite
+     * @access protected
+     */
+    protected $topTestSuite = NULL;
+
+    /**
+     * Code Coverage information provided by Xdebug.
+     *
+     * @var    array
+     * @access protected
+     */
+    protected $codeCoverageInformation = array();
+
+    /**
+     * @var    boolean
+     * @access protected
+     */
+    protected $collectCodeCoverageInformation = FALSE;
+
+    /**
+     * @var    boolean
+     * @access protected
+     */
+    protected $stop = FALSE;
+
+    /**
+     * @var    boolean
+     * @access protected
+     */
+    protected $stopOnFailure = FALSE;
+
+    /**
+     * Registers a TestListener.
+     *
+     * @param  PHPUnit_Framework_TestListener
+     * @access public
+     */
+    public function addListener(PHPUnit_Framework_TestListener $listener)
+    {
+        $this->listeners[] = $listener;
+    }
+
+    /**
+     * Unregisters a TestListener.
+     *
+     * @param  PHPUnit_Framework_TestListener $listener
+     * @access public
+     */
+    public function removeListener(PHPUnit_Framework_TestListener $listener)
+    {
+        foreach ($this->listeners as $key => $_listener) {
+            if ($listener === $_listener) {
+                unset($this->listeners[$key]);
+            }
+        }
+    }
+
+    /**
+     * Flushes all flushable TestListeners.
+     *
+     * @access public
+     * @since  Method available since Release 3.0.0
+     */
+    public function flushListeners()
+    {
+        foreach ($this->listeners as $listener) {
+            if ($listener instanceof PHPUnit_Util_Printer) {
+                $listener->flush();
+            }
+        }
+    }
+
+    /**
+     * Adds an error to the list of errors.
+     * The passed in exception caused the error.
+     *
+     * @param  PHPUnit_Framework_Test $test
+     * @param  Exception              $e
+     * @param  float                  $time
+     * @access public
+     */
+    public function addError(PHPUnit_Framework_Test $test, Exception $e, $time)
+    {
+        if ($e instanceof PHPUnit_Framework_IncompleteTest) {
+            $this->notImplemented[] = new PHPUnit_Framework_TestFailure($test, $e);
+            $notifyMethod           = 'addIncompleteTest';
+        }
+
+        else if ($e instanceof PHPUnit_Framework_SkippedTest) {
+            $this->skipped[] = new PHPUnit_Framework_TestFailure($test, $e);
+            $notifyMethod    = 'addSkippedTest';
+        }
+
+        else {
+            $this->errors[] = new PHPUnit_Framework_TestFailure($test, $e);
+            $notifyMethod   = 'addError';
+
+            if ($this->stopOnFailure) {
+                $this->stop();
+            }
+        }
+
+        foreach ($this->listeners as $listener) {
+            $listener->$notifyMethod($test, $e, $time);
+        }
+    }
+
+    /**
+     * Adds a failure to the list of failures.
+     * The passed in exception caused the failure.
+     *
+     * @param  PHPUnit_Framework_Test                 $test
+     * @param  PHPUnit_Framework_AssertionFailedError $e
+     * @param  float                                  $time
+     * @access public
+     */
+    public function addFailure(PHPUnit_Framework_Test $test, PHPUnit_Framework_AssertionFailedError $e, $time)
+    {
+        if ($e instanceof PHPUnit_Framework_IncompleteTest) {
+            $this->notImplemented[] = new PHPUnit_Framework_TestFailure($test, $e);
+            $notifyMethod           = 'addIncompleteTest';
+        }
+
+        else if ($e instanceof PHPUnit_Framework_SkippedTest) {
+            $this->skipped[] = new PHPUnit_Framework_TestFailure($test, $e);
+            $notifyMethod    = 'addSkippedTest';
+        }
+
+        else {
+            $this->failures[] = new PHPUnit_Framework_TestFailure($test, $e);
+            $notifyMethod     = 'addFailure';
+
+            if ($this->stopOnFailure) {
+                $this->stop();
+            }
+        }
+
+        foreach ($this->listeners as $listener) {
+            $listener->$notifyMethod($test, $e, $time);
+        }
+    }
+
+    /**
+     * Informs the result that a testsuite will be started.
+     *
+     * @param  PHPUnit_Framework_TestSuite $suite
+     * @access public
+     * @since  Method available since Release 2.2.0
+     */
+    public function startTestSuite(PHPUnit_Framework_TestSuite $suite)
+    {
+        if ($this->topTestSuite === NULL) {
+            $this->topTestSuite = $suite;
+        }
+
+        foreach ($this->listeners as $listener) {
+            $listener->startTestSuite($suite);
+        }
+    }
+
+    /**
+     * Informs the result that a testsuite was completed.
+     *
+     * @param  PHPUnit_Framework_TestSuite $suite
+     * @access public
+     * @since  Method available since Release 2.2.0
+     */
+    public function endTestSuite(PHPUnit_Framework_TestSuite $suite)
+    {
+        foreach ($this->listeners as $listener) {
+            $listener->endTestSuite($suite);
+        }
+    }
+
+    /**
+     * Informs the result that a test will be started.
+     *
+     * @param  PHPUnit_Framework_Test $test
+     * @access public
+     */
+    public function startTest(PHPUnit_Framework_Test $test)
+    {
+        $this->runTests += count($test);
+
+        foreach ($this->listeners as $listener) {
+            $listener->startTest($test);
+        }
+    }
+
+    /**
+     * Informs the result that a test was completed.
+     *
+     * @param  PHPUnit_Framework_Test $test
+     * @param  float                  $time
+     * @access public
+     */
+    public function endTest(PHPUnit_Framework_Test $test, $time)
+    {
+        foreach ($this->listeners as $listener) {
+            $listener->endTest($test, $time);
+        }
+    }
+
+    /**
+     * Returns TRUE if no incomplete test occured.
+     *
+     * @return boolean
+     * @access public
+     */
+    public function allCompletlyImplemented()
+    {
+        return $this->notImplementedCount() == 0;
+    }
+
+    /**
+     * Gets the number of incomplete tests.
+     *
+     * @return integer
+     * @access public
+     */
+    public function notImplementedCount()
+    {
+        return count($this->notImplemented);
+    }
+
+    /**
+     * Returns an Enumeration for the incomplete tests.
+     *
+     * @return array
+     * @access public
+     */
+    public function notImplemented()
+    {
+        return $this->notImplemented;
+    }
+
+    /**
+     * Returns TRUE if no test has been skipped.
+     *
+     * @return boolean
+     * @access public
+     * @since  Method available since Release 3.0.0
+     */
+    public function noneSkipped()
+    {
+        return $this->skippedCount() == 0;
+    }
+
+    /**
+     * Gets the number of skipped tests.
+     *
+     * @return integer
+     * @access public
+     * @since  Method available since Release 3.0.0
+     */
+    public function skippedCount()
+    {
+        return count($this->skipped);
+    }
+
+    /**
+     * Returns an Enumeration for the skipped tests.
+     *
+     * @return array
+     * @access public
+     * @since  Method available since Release 3.0.0
+     */
+    public function skipped()
+    {
+        return $this->skipped;
+    }
+
+    /**
+     * Gets the number of detected errors.
+     *
+     * @return integer
+     * @access public
+     */
+    public function errorCount()
+    {
+        return count($this->errors);
+    }
+
+    /**
+     * Returns an Enumeration for the errors.
+     *
+     * @return array
+     * @access public
+     */
+    public function errors()
+    {
+        return $this->errors;
+    }
+
+    /**
+     * Gets the number of detected failures.
+     *
+     * @return integer
+     * @access public
+     */
+    public function failureCount()
+    {
+        return count($this->failures);
+    }
+
+    /**
+     * Returns an Enumeration for the failures.
+     *
+     * @return array
+     * @access public
+     */
+    public function failures()
+    {
+        return $this->failures;
+    }
+
+    /**
+     * Returns the (top) test suite.
+     *
+     * @return PHPUnit_Framework_TestSuite
+     * @access public
+     * @since  Method available since Release 3.0.0
+     */
+    public function topTestSuite()
+    {
+        return $this->topTestSuite;
+    }
+
+    /**
+     * Enables or disables the collection of Code Coverage information.
+     *
+     * @param  boolean $flag
+     * @throws InvalidArgumentException
+     * @access public
+     * @since  Method available since Release 2.3.0
+     */
+    public function collectCodeCoverageInformation($flag)
+    {
+        if (is_bool($flag)) {
+            $this->collectCodeCoverageInformation = $flag;
+        } else {
+            throw new InvalidArgumentException;
+        }
+    }
+
+    /**
+     * Returns whether code coverage information should be collected.
+     *
+     * @return boolean If code coverage should be collected
+     * @since  Method available since Release 3.2.0
+     */
+    public function getCollectCodeCoverageInformation()
+    {
+        return $this->collectCodeCoverageInformation;
+    }
+
+    /**
+     * Appends code coverage information to the test
+     *
+     * @param PHPUnit_Framework_Test $test
+     * @param array                  $data
+     * @since Method available since Release 3.2.0
+     */
+    public function appendCodeCoverageInformation(PHPUnit_Framework_Test $test, $data)
+    {
+        if ($test instanceof PHPUnit_Framework_TestCase) {
+            $linesToBeCovered = PHPUnit_Util_Test::getLinesToBeCovered(
+              get_class($test), $test->getName()
+            );
+
+            if (!empty($linesToBeCovered)) {
+                $filesToBeCovered = array_keys($linesToBeCovered);
+                $filesCovered     = array_keys($data);
+                $filesCovered     = array_intersect($filesCovered, $filesToBeCovered);
+
+                foreach ($filesCovered as $file) {
+                    $linesCovered    = array_keys($data[$file]);
+                    $linesNotToCover = array_diff($linesCovered, $linesToBeCovered[$file]);
+
+                    foreach ($linesNotToCover as $line) {
+                        if ($data[$file][$line] > 0) {
+                            $data[$file][$line] = -1;
+                        }
+                    }
+                }
+            }
+        }
+
+        $this->codeCoverageInformation[] = array(
+          'test'  => $test,
+          'files' => $data
+        );
+    }
+
+    /**
+     * Returns Code Coverage data per test case.
+     *
+     * Format of the result array:
+     *
+     * <code>
+     * array(
+     *   array(
+     *     'test'  => PHPUnit_Framework_Test
+     *     'files' => array(
+     *       "/tested/code.php" => array(
+     *         linenumber => flag
+     *       )
+     *     )
+     *   )
+     * )
+     * </code>
+     *
+     * flag < 0: Line is executable but was not executed.
+     * flag > 0: Line was executed.
+     *
+     * @param  boolean $filterTests
+     * @param  boolean $filterPHPUnit
+     * @return array
+     * @access public
+     */
+    public function getCodeCoverageInformation($filterTests = TRUE, $filterPHPUnit = TRUE)
+    {
+        return PHPUnit_Util_Filter::getFilteredCodeCoverage(
+          $this->codeCoverageInformation,
+          $filterTests,
+          $filterPHPUnit
+        );
+    }
+
+    /**
+     * Returns unfiltered Code Coverage data per test case.
+     * Returns data in the same form as getCodeCoverageInformation().
+     *
+     * @return array
+     * @access public
+     */
+    public function getUncoveredWhitelistFiles()
+    {
+        list(, $missing) = PHPUnit_Util_Filter::getFileCodeCoverageDisposition(
+          $this->codeCoverageInformation
+        );
+
+        return($missing);  
+    }
+
+    /**
+     * Runs a TestCase.
+     *
+     * @param  PHPUnit_Framework_Test $test
+     * @access public
+     */
+    public function run(PHPUnit_Framework_Test $test)
+    {
+        $error   = FALSE;
+        $failure = FALSE;
+
+        $this->startTest($test);
+
+        $errorHandlerSet = FALSE;
+
+        $oldErrorHandler = set_error_handler(
+          'PHPUnit_Util_ErrorHandler', E_ALL | E_STRICT
+        );
+
+        if ($oldErrorHandler === NULL) {
+            $errorHandlerSet = TRUE;
+        } else {
+            restore_error_handler();
+        }
+        $oldErrorHandler = set_error_handler(
+          'PHPUnit_Util_ErrorHandler', E_ALL | E_STRICT
+        );
+
+        if ($oldErrorHandler === NULL) {
+            $errorHandlerSet = TRUE;
+        } else {
+            restore_error_handler();
+        }
+
+        if (self::$xdebugLoaded === NULL) {
+            self::$xdebugLoaded = extension_loaded('xdebug');
+            self::$useXdebug = self::$xdebugLoaded;
+        }
+
+        $useXdebug = self::$useXdebug && $this->collectCodeCoverageInformation && !$test instanceof PHPUnit_Extensions_SeleniumTestCase;
+
+        if ($useXdebug) {
+            xdebug_start_code_coverage(XDEBUG_CC_UNUSED | XDEBUG_CC_DEAD_CODE);
+        }
+
+        PHPUnit_Util_Timer::start();
+
+        try {
+            $test->runBare();
+        }
+
+        catch (PHPUnit_Framework_AssertionFailedError $e) {
+            $failure = TRUE;
+        }
+
+        catch (Exception $e) {
+            $error = TRUE;
+        }
+
+        $time = PHPUnit_Util_Timer::stop();
+
+        if ($useXdebug) {
+            $codeCoverage = xdebug_get_code_coverage();
+            xdebug_stop_code_coverage();
+
+            $this->appendCodeCoverageInformation(
+              $test, $codeCoverage
+            );
+        }
+
+        if ($errorHandlerSet === TRUE) {
+            restore_error_handler();
+        }
+
+        if ($error === TRUE) {
+            $this->addError($test, $e, $time);
+        }
+
+        else if ($failure === TRUE) {
+            $this->addFailure($test, $e, $time);
+        }
+
+        $this->endTest($test, $time);
+
+        $this->time += $time;
+    }
+
+    /**
+     * Gets the number of run tests.
+     *
+     * @return integer
+     * @access public
+     */
+    public function count()
+    {
+        return $this->runTests;
+    }
+
+    /**
+     * Checks whether the test run should stop.
+     *
+     * @return boolean
+     * @access public
+     */
+    public function shouldStop()
+    {
+        return $this->stop;
+    }
+
+    /**
+     * Marks that the test run should stop.
+     *
+     * @access public
+     */
+    public function stop()
+    {
+        $this->stop = TRUE;
+    }
+
+    /**
+     * Enables or disables the stopping when a failure or error occurs.
+     *
+     * @param  boolean $flag
+     * @throws InvalidArgumentException
+     * @access public
+     * @since  Method available since Release 3.1.0
+     */
+    public function stopOnFailure($flag)
+    {
+        if (is_bool($flag)) {
+            $this->stopOnFailure = $flag;
+        } else {
+            throw new InvalidArgumentException;
+        }
+    }
+
+    /**
+     * Returns the time spent running the tests.
+     *
+     * @return float
+     * @access public
+     */
+    public function time()
+    {
+        return $this->time;
+    }
+
+    /**
+     * Returns whether the entire test was successful or not.
+     *
+     * @return boolean
+     * @access public
+     */
+    public function wasSuccessful()
+    {
+        return empty($this->errors) && empty($this->failures);
+    }
+}
+
+}
+?>

Added: incubator/shindig/trunk/php/external/PHPUnit/Framework/TestSuite.php
URL: http://svn.apache.org/viewvc/incubator/shindig/trunk/php/external/PHPUnit/Framework/TestSuite.php?rev=681982&view=auto
==============================================================================
--- incubator/shindig/trunk/php/external/PHPUnit/Framework/TestSuite.php (added)
+++ incubator/shindig/trunk/php/external/PHPUnit/Framework/TestSuite.php Sat Aug  2 07:11:35 2008
@@ -0,0 +1,877 @@
+<?php
+/**
+ * PHPUnit
+ *
+ * Copyright (c) 2002-2008, Sebastian Bergmann <sb...@sebastian-bergmann.de>.
+ * 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 <sb...@sebastian-bergmann.de>
+ * @copyright  2002-2008 Sebastian Bergmann <sb...@sebastian-bergmann.de>
+ * @license    http://www.opensource.org/licenses/bsd-license.php  BSD License
+ * @version    SVN: $Id: TestSuite.php 2157 2008-01-17 13:06:52Z sb $
+ * @link       http://www.phpunit.de/
+ * @since      File available since Release 2.0.0
+ */
+
+require_once 'PHPUnit/Framework.php';
+require_once 'PHPUnit/Extensions/PhptTestCase.php';
+require_once 'PHPUnit/Runner/BaseTestRunner.php';
+require_once 'PHPUnit/Util/Class.php';
+require_once 'PHPUnit/Util/Fileloader.php';
+require_once 'PHPUnit/Util/Filter.php';
+require_once 'PHPUnit/Util/Test.php';
+require_once 'PHPUnit/Util/TestSuiteIterator.php';
+
+PHPUnit_Util_Filter::addFileToFilter(__FILE__, 'PHPUNIT');
+
+if (!class_exists('PHPUnit_Framework_TestSuite', FALSE)) {
+
+/**
+ * A TestSuite is a composite of Tests. It runs a collection of test cases.
+ *
+ * Here is an example using the dynamic test definition.
+ *
+ * <code>
+ * <?php
+ * $suite = new PHPUnit_Framework_TestSuite;
+ * $suite->addTest(new MathTest('testPass'));
+ * ?>
+ * </code>
+ *
+ * Alternatively, a TestSuite can extract the tests to be run automatically.
+ * To do so you pass a ReflectionClass instance for your
+ * PHPUnit_Framework_TestCase class to the PHPUnit_Framework_TestSuite
+ * constructor.
+ *
+ * <code>
+ * <?php
+ * $suite = new PHPUnit_Framework_TestSuite(
+ *   new ReflectionClass('MathTest')
+ * );
+ * ?>
+ * </code>
+ *
+ * This constructor creates a suite with all the methods starting with
+ * "test" that take no arguments.
+ *
+ * @category   Testing
+ * @package    PHPUnit
+ * @author     Sebastian Bergmann <sb...@sebastian-bergmann.de>
+ * @copyright  2002-2008 Sebastian Bergmann <sb...@sebastian-bergmann.de>
+ * @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.0.0
+ */
+class PHPUnit_Framework_TestSuite implements PHPUnit_Framework_Test, PHPUnit_Framework_SelfDescribing, IteratorAggregate
+{
+    /**
+     * Fixture that is shared between the tests of this test suite.
+     *
+     * @var    mixed
+     * @access protected
+     */
+    protected $sharedFixture;
+
+    /**
+     * The name of the test suite.
+     *
+     * @var    string
+     * @access protected
+     */
+    protected $name = '';
+
+    /**
+     * The test groups of the test suite.
+     *
+     * @var    array
+     * @access protected
+     */
+    protected $groups = array();
+
+    /**
+     * The tests in the test suite.
+     *
+     * @var    array
+     * @access protected
+     */
+    protected $tests = array();
+
+    /**
+     * The number of tests in the test suite.
+     *
+     * @var    integer
+     * @access protected
+     */
+    protected $numTests = -1;
+
+    /**
+     * Constructs a new TestSuite:
+     *
+     *   - PHPUnit_Framework_TestSuite() constructs an empty TestSuite.
+     *
+     *   - PHPUnit_Framework_TestSuite(ReflectionClass) constructs a
+     *     TestSuite from the given class.
+     *
+     *   - PHPUnit_Framework_TestSuite(ReflectionClass, String)
+     *     constructs a TestSuite from the given class with the given
+     *     name.
+     *
+     *   - PHPUnit_Framework_TestSuite(String) either constructs a
+     *     TestSuite from the given class (if the passed string is the
+     *     name of an existing class) or constructs an empty TestSuite
+     *     with the given name.
+     *
+     * @param  mixed  $theClass
+     * @param  string $name
+     * @throws InvalidArgumentException
+     * @access public
+     */
+    public function __construct($theClass = '', $name = '')
+    {
+        $argumentsValid = FALSE;
+
+        if (is_object($theClass) &&
+            $theClass instanceof ReflectionClass) {
+            $argumentsValid = TRUE;
+        }
+
+        else if (is_string($theClass) && $theClass !== ''
+                 && class_exists($theClass, FALSE)) {
+            $argumentsValid = TRUE;
+
+            if ($name == '') {
+                $name = $theClass;
+            }
+
+            $theClass = new ReflectionClass($theClass);
+        }
+
+        else if (is_string($theClass)) {
+            $this->setName($theClass);
+            return;
+        }
+
+        if (!$argumentsValid) {
+            throw new InvalidArgumentException;
+        }
+
+        PHPUnit_Util_Filter::addFileToFilter(
+          realpath($theClass->getFilename()),
+          'TESTS'
+        );
+
+        if ($name != '') {
+            $this->setName($name);
+        } else {
+            $this->setName($theClass->getName());
+        }
+
+        $constructor = $theClass->getConstructor();
+
+        if ($constructor !== NULL &&
+            !$constructor->isPublic()) {
+            $this->addTest(
+              self::warning(
+                sprintf(
+                  'Class "%s" has no public constructor.',
+
+                  $theClass->getName()
+                )
+              )
+            );
+
+            return;
+        }
+
+        $className   = $theClass->getName();
+        $names       = array();
+        $classGroups = PHPUnit_Util_Test::getGroups($theClass);
+
+        foreach ($theClass->getMethods() as $method) {
+            if (strpos($method->getDeclaringClass()->getName(), 'PHPUnit_') !== 0) {
+                $this->addTestMethod(
+                  $method,
+                  PHPUnit_Util_Test::getGroups($method, $classGroups),
+                  $names,
+                  $theClass
+                );
+            }
+        }
+
+        if (empty($this->tests)) {
+            $this->addTest(
+              self::warning(
+                sprintf(
+                  'No tests found in class "%s".',
+
+                  $theClass->getName()
+                )
+              )
+            );
+        }
+    }
+
+    /**
+     * Returns a string representation of the test suite.
+     *
+     * @return string
+     * @access public
+     */
+    public function toString()
+    {
+        return $this->getName();
+    }
+
+    /**
+     * Adds a test to the suite.
+     *
+     * @param  PHPUnit_Framework_Test $test
+     * @param  array                  $groups
+     * @access public
+     */
+    public function addTest(PHPUnit_Framework_Test $test, $groups = array())
+    {
+        $this->tests[]  = $test;
+        $this->numTests = -1;
+
+        if ($test instanceof PHPUnit_Framework_TestSuite && empty($groups)) {
+            $groups = $test->getGroups();
+        }
+
+        if (empty($groups)) {
+            $groups = array('__nogroup__');
+        }
+
+        foreach ($groups as $group) {
+            if (!isset($this->groups[$group])) {
+                $this->groups[$group] = array($test);
+            } else {
+                $this->groups[$group][] = $test;
+            }
+        }
+    }
+
+    /**
+     * Adds the tests from the given class to the suite.
+     *
+     * @param  mixed $testClass
+     * @throws InvalidArgumentException
+     * @access public
+     */
+    public function addTestSuite($testClass)
+    {
+        if (is_string($testClass) && class_exists($testClass)) {
+            $testClass = new ReflectionClass($testClass);
+        }
+
+        if (!is_object($testClass)) {
+            throw new InvalidArgumentException;
+        }
+
+        if ($testClass instanceof PHPUnit_Framework_TestSuite) {
+            $this->addTest($testClass);
+        }
+
+        else if ($testClass instanceof ReflectionClass) {
+            $suiteMethod = FALSE;
+
+            if (!$testClass->isAbstract()) {
+                if ($testClass->hasMethod(PHPUnit_Runner_BaseTestRunner::SUITE_METHODNAME)) {
+                    $method = $testClass->getMethod(
+                      PHPUnit_Runner_BaseTestRunner::SUITE_METHODNAME
+                    );
+
+                    if ($method->isStatic()) {
+                        $this->addTest($method->invoke(NULL, $testClass->getName()));
+                        $suiteMethod = TRUE;
+                    }
+                }
+            }
+
+            if (!$suiteMethod) {
+                $this->addTest(new PHPUnit_Framework_TestSuite($testClass));
+            }
+        }
+
+        else {
+            throw new InvalidArgumentException;
+        }
+    }
+
+    /**
+     * Wraps both <code>addTest()</code> and <code>addTestSuite</code>
+     * as well as the separate import statements for the user's convenience.
+     *
+     * If the named file cannot be read or there are no new tests that can be
+     * added, a <code>PHPUnit_Framework_Warning</code> will be created instead,
+     * leaving the current test run untouched.
+     *
+     * @param  string  $filename
+     * @param  boolean $syntaxCheck
+     * @param  array   $phptOptions Array with ini settings for the php instance
+     *                              run, key being the name if the setting,
+     *                              value the ini value.
+     * @throws InvalidArgumentException
+     * @access public
+     * @since  Method available since Release 2.3.0
+     * @author Stefano F. Rausch <st...@rausch-e.net>
+     */
+    public function addTestFile($filename, $syntaxCheck = TRUE, $phptOptions = array())
+    {
+        if (!is_string($filename)) {
+            throw new InvalidArgumentException;
+        }
+
+        if (file_exists($filename) && substr($filename, -5) == '.phpt') {
+            $this->addTest(
+              new PHPUnit_Extensions_PhptTestCase($filename, $phptOptions)
+            );
+
+            return;
+        }
+
+        if (!file_exists($filename)) {
+            $includePaths = explode(PATH_SEPARATOR, get_include_path());
+
+            foreach ($includePaths as $includePath) {
+                $file = $includePath . DIRECTORY_SEPARATOR . $filename;
+
+                if (file_exists($file)) {
+                    $filename = $file;
+                    break;
+                }
+            }
+        }
+
+        PHPUnit_Util_Class::collectStart();
+        PHPUnit_Util_Fileloader::checkAndLoad($filename, $syntaxCheck);
+        $newClasses = PHPUnit_Util_Class::collectEnd();
+
+        $testsFound = FALSE;
+
+        foreach ($newClasses as $className) {
+            $class = new ReflectionClass($className);
+
+            if (!$class->isAbstract()) {
+                if ($class->hasMethod(PHPUnit_Runner_BaseTestRunner::SUITE_METHODNAME)) {
+                    $method = $class->getMethod(
+                      PHPUnit_Runner_BaseTestRunner::SUITE_METHODNAME
+                    );
+
+                    if ($method->isStatic()) {
+                        $this->addTest($method->invoke(NULL, $className));
+
+                        $testsFound = TRUE;
+                    }
+                }
+
+                else if ($class->implementsInterface('PHPUnit_Framework_Test')) {
+                    $this->addTestSuite($class);
+
+                    $testsFound = TRUE;
+                }
+            }
+        }
+
+        if (!$testsFound) {
+            $this->addTest(
+              new PHPUnit_Framework_Warning(
+                'No tests found in file "' . $filename . '".'
+              )
+            );
+        }
+
+        $this->numTests = -1;
+    }
+
+    /**
+     * Wrapper for addTestFile() that adds multiple test files.
+     *
+     * @param  array|Iterator $filenames
+     * @throws InvalidArgumentException
+     * @access public
+     * @since  Method available since Release 2.3.0
+     */
+    public function addTestFiles($filenames)
+    {
+        if (!(is_array($filenames) ||
+             (is_object($filenames) && $filenames instanceof Iterator))) {
+            throw new InvalidArgumentException;
+        }
+
+        foreach ($filenames as $filename) {
+            $this->addTestFile((string)$filename);
+        }
+    }
+
+    /**
+     * Counts the number of test cases that will be run by this test.
+     *
+     * @return integer
+     * @access public
+     */
+    public function count()
+    {
+        if ($this->numTests > -1) {
+            return $this->numTests;
+        }
+
+        $this->numTests = 0;
+
+        foreach ($this->tests as $test) {
+            $this->numTests += count($test);
+        }
+
+        return $this->numTests;
+    }
+
+    /**
+     * @param  ReflectionClass $theClass
+     * @param  string          $name
+     * @return PHPUnit_Framework_Test
+     * @access public
+     * @static
+     */
+    public static function createTest(ReflectionClass $theClass, $name)
+    {
+        $className  = $theClass->getName();
+        $method     = new ReflectionMethod($className, $name);
+        $docComment = $method->getDocComment();
+
+        if (!$theClass->isInstantiable()) {
+            return self::warning(
+              sprintf('Cannot instantiate class "%s".', $className)
+            );
+        }
+
+        // @expectedException ExceptionClass              on TestCase::testMethod()
+        // @expectedException ExceptionClass message      on TestCase::testMethod()
+        // @expectedException ExceptionClass message code on TestCase::testMethod()
+        if (preg_match('(@expectedException\s+([:.\w]+)(?:[\t ]+(\S*))?(?:[\t ]+(\S*))?[\t ]*$)m', $docComment, $matches)) {
+            $expectedException = $matches[1];
+
+            if (isset($matches[2])) {
+                $expectedExceptionMessage = trim($matches[2]);
+            } else {
+                $expectedExceptionMessage = '';
+            }
+
+            if (isset($matches[3])) {
+                $expectedExceptionCode = (int)$matches[3];
+            } else {
+                $expectedExceptionCode = 0;
+            }
+        }
+
+        $constructor = $theClass->getConstructor();
+
+        if ($constructor !== NULL) {
+            $parameters = $constructor->getParameters();
+
+            // TestCase() or TestCase($name)
+            if (count($parameters) < 2) {
+                $test = new $className;
+            }
+
+            // TestCase($name, $data)
+            else {
+                $data = PHPUnit_Util_Test::getProvidedData($className, $name);
+
+                if (is_array($data) || $data instanceof Iterator) {
+                     $test = new PHPUnit_Framework_TestSuite(
+                       $className . '::' . $name
+                     );
+
+                    foreach ($data as $_dataName => $_data) {
+                        $_test = new $className($name, $_data, $_dataName);
+
+                        if ($_test instanceof PHPUnit_Framework_TestCase &&
+                            isset($expectedException)) {
+                            $_test->setExpectedException(
+                              $expectedException,
+                              $expectedExceptionMessage,
+                              $expectedExceptionCode
+                            );
+                        }
+
+                        $test->addTest($_test);
+                    }
+                } else {
+                    $test = new $className;
+                }
+            }
+        }
+
+        if ($test instanceof PHPUnit_Framework_TestCase) {
+            $test->setName($name);
+
+            if (isset($expectedException)) {
+                $test->setExpectedException(
+                  $expectedException,
+                  $expectedExceptionMessage,
+                  $expectedExceptionCode
+                );
+            }
+        }
+
+        return $test;
+    }
+
+    /**
+     * Creates a default TestResult object.
+     *
+     * @return PHPUnit_Framework_TestResult
+     * @access protected
+     */
+    protected function createResult()
+    {
+        return new PHPUnit_Framework_TestResult;
+    }
+
+    /**
+     * Returns the name of the suite.
+     *
+     * @return string
+     * @access public
+     */
+    public function getName()
+    {
+        return $this->name;
+    }
+
+    /**
+     * Returns the test groups of the suite.
+     *
+     * @return array
+     * @access public
+     * @since  Method available since Release 3.2.0
+     */
+    public function getGroups()
+    {
+        return array_keys($this->groups);
+    }
+
+    /**
+     * Runs the tests and collects their result in a TestResult.
+     *
+     * @param  PHPUnit_Framework_TestResult $result
+     * @param  mixed                        $filter
+     * @param  array                        $groups
+     * @param  array                        $excludeGroups
+     * @return PHPUnit_Framework_TestResult
+     * @throws InvalidArgumentException
+     * @access public
+     */
+    public function run(PHPUnit_Framework_TestResult $result = NULL, $filter = FALSE, array $groups = array(), array $excludeGroups = array())
+    {
+        if ($result === NULL) {
+            $result = $this->createResult();
+        }
+
+        try {
+            $this->setUp();
+        }
+
+        catch (PHPUnit_Framework_SkippedTestSuiteError $e) {
+            $numTests = count($this);
+
+            for ($i = 0; $i < $numTests; $i++) {
+                $result->addFailure($this, $e, 0);
+            }
+
+            return $result;
+        }
+
+        $result->startTestSuite($this);
+
+        $tests = array();
+
+        if (empty($excludeGroups)) {
+            if (empty($groups)) {
+                $tests = $this->tests;
+            } else {
+                foreach ($groups as $group) {
+                    if (isset($this->groups[$group])) {
+                        $tests = array_merge($tests, $this->groups[$group]);
+                    }
+                }
+            }
+        } else {
+            foreach ($this->groups as $_group => $_tests) {
+                if (!in_array($_group, $excludeGroups)) {
+                    $tests = array_merge($tests, $_tests);
+                }
+            }
+        }
+
+        foreach ($tests as $test) {
+            if ($result->shouldStop()) {
+                break;
+            }
+
+            if ($test instanceof PHPUnit_Framework_TestSuite) {
+                $test->setSharedFixture($this->sharedFixture);
+                $test->run($result, $filter, $groups, $excludeGroups);
+            } else {
+                $runTest = TRUE;
+
+                if ($filter !== FALSE ) {
+                    $name = $test->getName();
+
+                    if ($name !== NULL && preg_match($filter, $name) == 0) {
+                        $runTest = FALSE;
+                    }
+                }
+
+                if ($runTest) {
+                    if ($test instanceof PHPUnit_Framework_TestCase) {
+                        $test->setSharedFixture($this->sharedFixture);
+                    }
+
+                    $this->runTest($test, $result);
+                }
+            }
+        }
+
+        $result->endTestSuite($this);
+        $this->tearDown();
+
+        return $result;
+    }
+
+    /**
+     * Runs a test.
+     *
+     * @param  PHPUnit_Framework_Test        $test
+     * @param  PHPUnit_Framework_TestResult  $testResult
+     * @access public
+     */
+    public function runTest(PHPUnit_Framework_Test $test, PHPUnit_Framework_TestResult $result)
+    {
+        $test->run($result);
+    }
+
+    /**
+     * Sets the name of the suite.
+     *
+     * @param  string
+     * @access public
+     */
+    public function setName($name)
+    {
+        $this->name = $name;
+    }
+
+    /**
+     * Returns the test at the given index.
+     *
+     * @param  integer
+     * @return PHPUnit_Framework_Test
+     * @access public
+     */
+    public function testAt($index)
+    {
+        if (isset($this->tests[$index])) {
+            return $this->tests[$index];
+        } else {
+            return FALSE;
+        }
+    }
+
+    /**
+     * Returns the number of tests in this suite.
+     *
+     * @return integer
+     * @access public
+     */
+    public function testCount()
+    {
+        return count($this->tests);
+    }
+
+    /**
+     * Returns the tests as an enumeration.
+     *
+     * @return array
+     * @access public
+     */
+    public function tests()
+    {
+        return $this->tests;
+    }
+
+    /**
+     * Mark the test suite as skipped.
+     *
+     * @param  string  $message
+     * @throws PHPUnit_Framework_SkippedTestSuiteError
+     * @access public
+     * @since  Method available since Release 3.0.0
+     */
+    public function markTestSuiteSkipped($message = '')
+    {
+        throw new PHPUnit_Framework_SkippedTestSuiteError($message);
+    }
+
+    /**
+     * @param  ReflectionMethod $method
+     * @param  string           $groups
+     * @param  array            $names
+     * @param  ReflectionClass  $theClass
+     * @access protected
+     */
+    protected function addTestMethod(ReflectionMethod $method, $groups, Array &$names, ReflectionClass $theClass)
+    {
+        $name = $method->getName();
+
+        if (in_array($name, $names)) {
+            return;
+        }
+
+        if ($this->isPublicTestMethod($method)) {
+            $names[] = $name;
+
+            $this->addTest(
+              self::createTest(
+                $theClass,
+                $name
+              ),
+              $groups
+            );
+        }
+
+        else if ($this->isTestMethod($method)) {
+            $this->addTest(
+              self::warning(
+                sprintf(
+                  'Test method "%s" is not public.',
+
+                  $name
+                )
+              )
+            );
+        }
+    }
+
+    /**
+     * @param  ReflectionMethod $method
+     * @return boolean
+     * @access public
+     * @static
+     */
+    public static function isPublicTestMethod(ReflectionMethod $method)
+    {
+        return (self::isTestMethod($method) && $method->isPublic());
+    }
+
+    /**
+     * @param  ReflectionMethod $method
+     * @return boolean
+     * @access public
+     * @static
+     */
+    public static function isTestMethod(ReflectionMethod $method)
+    {
+        if (strpos($method->name, 'test') === 0) {
+            return TRUE;
+        }
+
+        // @story on TestCase::testMethod()
+        // @test  on TestCase::testMethod()
+        return strpos($method->getDocComment(), '@test')  !== FALSE ||
+               strpos($method->getDocComment(), '@story') !== FALSE;
+    }
+
+    /**
+     * @param  string  $message
+     * @return PHPUnit_Framework_Warning
+     * @access protected
+     */
+    protected static function warning($message)
+    {
+        return new PHPUnit_Framework_Warning($message);
+    }
+
+    /**
+     * Sets the shared fixture for the tests of this test suite.
+     *
+     * @param  mixed $sharedFixture
+     * @access public
+     * @since  Method available since Release 3.1.0
+     */
+    public function setSharedFixture($sharedFixture)
+    {
+        $this->sharedFixture = $sharedFixture;
+    }
+
+    /**
+     * Returns an iterator for this test suite.
+     *
+     * @return RecursiveIteratorIterator
+     * @access public
+     * @since  Method available since Release 3.1.0
+     */
+    public function getIterator()
+    {
+        return new RecursiveIteratorIterator(
+          new PHPUnit_Util_TestSuiteIterator($this)
+        );
+    }
+
+    /**
+     * Template Method that is called before the tests
+     * of this test suite are run.
+     *
+     * @access protected
+     * @since  Method available since Release 3.1.0
+     */
+    protected function setUp()
+    {
+    }
+
+    /**
+     * Template Method that is called after the tests
+     * of this test suite have finished running.
+     *
+     * @access protected
+     * @since  Method available since Release 3.1.0
+     */
+    protected function tearDown()
+    {
+    }
+}
+
+}
+?>

Added: incubator/shindig/trunk/php/external/PHPUnit/Framework/Warning.php
URL: http://svn.apache.org/viewvc/incubator/shindig/trunk/php/external/PHPUnit/Framework/Warning.php?rev=681982&view=auto
==============================================================================
--- incubator/shindig/trunk/php/external/PHPUnit/Framework/Warning.php (added)
+++ incubator/shindig/trunk/php/external/PHPUnit/Framework/Warning.php Sat Aug  2 07:11:35 2008
@@ -0,0 +1,104 @@
+<?php
+/**
+ * PHPUnit
+ *
+ * Copyright (c) 2002-2008, Sebastian Bergmann <sb...@sebastian-bergmann.de>.
+ * 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 <sb...@sebastian-bergmann.de>
+ * @copyright  2002-2008 Sebastian Bergmann <sb...@sebastian-bergmann.de>
+ * @license    http://www.opensource.org/licenses/bsd-license.php  BSD License
+ * @version    SVN: $Id: Warning.php 1985 2007-12-26 18:11:55Z sb $
+ * @link       http://www.phpunit.de/
+ * @since      File available since Release 2.0.0
+ */
+
+require_once 'PHPUnit/Framework.php';
+require_once 'PHPUnit/Util/Filter.php';
+
+PHPUnit_Util_Filter::addFileToFilter(__FILE__, 'PHPUNIT');
+
+if (!class_exists('PHPUnit_Framework_Warning', FALSE)) {
+
+/**
+ * A warning.
+ *
+ * @category   Testing
+ * @package    PHPUnit
+ * @author     Sebastian Bergmann <sb...@sebastian-bergmann.de>
+ * @copyright  2002-2008 Sebastian Bergmann <sb...@sebastian-bergmann.de>
+ * @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.0.0
+ */
+class PHPUnit_Framework_Warning extends PHPUnit_Framework_TestCase
+{
+    /**
+     * @var    string
+     * @access protected
+     */
+    protected $message = '';
+
+    /**
+     * @param  string  $message
+     * @access public
+     */
+    public function __construct($message = '')
+    {
+        $this->message = $message;
+        parent::__construct('Warning');
+    }
+
+    /**
+     * @access protected
+     */
+    protected function runTest()
+    {
+        $this->fail($this->message);
+    }
+
+    /**
+     * @return string
+     * @access public
+     * @since  Method available since Release 3.0.0
+     */
+    public function getMessage()
+    {
+        return $this->message;
+    }
+}
+
+}
+?>

Added: incubator/shindig/trunk/php/external/PHPUnit/Runner/BaseTestRunner.php
URL: http://svn.apache.org/viewvc/incubator/shindig/trunk/php/external/PHPUnit/Runner/BaseTestRunner.php?rev=681982&view=auto
==============================================================================
--- incubator/shindig/trunk/php/external/PHPUnit/Runner/BaseTestRunner.php (added)
+++ incubator/shindig/trunk/php/external/PHPUnit/Runner/BaseTestRunner.php Sat Aug  2 07:11:35 2008
@@ -0,0 +1,313 @@
+<?php
+/**
+ * PHPUnit
+ *
+ * Copyright (c) 2002-2008, Sebastian Bergmann <sb...@sebastian-bergmann.de>.
+ * 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 <sb...@sebastian-bergmann.de>
+ * @copyright  2002-2008 Sebastian Bergmann <sb...@sebastian-bergmann.de>
+ * @license    http://www.opensource.org/licenses/bsd-license.php  BSD License
+ * @version    SVN: $Id: BaseTestRunner.php 1985 2007-12-26 18:11:55Z sb $
+ * @link       http://www.phpunit.de/
+ * @since      File available since Release 2.0.0
+ */
+
+require_once 'PHPUnit/Framework.php';
+require_once 'PHPUnit/Util/Filter.php';
+require_once 'PHPUnit/Runner/StandardTestSuiteLoader.php';
+
+PHPUnit_Util_Filter::addFileToFilter(__FILE__, 'PHPUNIT');
+
+/**
+ * Base class for all test runners.
+ *
+ * @category   Testing
+ * @package    PHPUnit
+ * @author     Sebastian Bergmann <sb...@sebastian-bergmann.de>
+ * @copyright  2002-2008 Sebastian Bergmann <sb...@sebastian-bergmann.de>
+ * @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.0.0
+ * @abstract
+ */
+abstract class PHPUnit_Runner_BaseTestRunner implements PHPUnit_Framework_TestListener
+{
+    const STATUS_PASSED     = 0;
+    const STATUS_SKIPPED    = 1;
+    const STATUS_INCOMPLETE = 2;
+    const STATUS_FAILURE    = 3;
+    const STATUS_ERROR      = 4;
+    const SUITE_METHODNAME  = 'suite';
+
+    /**
+     * An error occurred.
+     *
+     * @param  PHPUnit_Framework_Test $test
+     * @param  Exception              $e
+     * @param  float                  $time
+     * @access public
+     */
+    public function addError(PHPUnit_Framework_Test $test, Exception $e, $time)
+    {
+        $this->testFailed(self::STATUS_ERROR, $test, $e);
+    }
+
+    /**
+     * A failure occurred.
+     *
+     * @param  PHPUnit_Framework_Test                 $test
+     * @param  PHPUnit_Framework_AssertionFailedError $e
+     * @param  float                                  $time
+     * @access public
+     */
+    public function addFailure(PHPUnit_Framework_Test $test, PHPUnit_Framework_AssertionFailedError $e, $time)
+    {
+        $this->testFailed(self::STATUS_FAILURE, $test, $e);
+    }
+
+    /**
+     * Incomplete test.
+     *
+     * @param  PHPUnit_Framework_Test $test
+     * @param  Exception              $e
+     * @param  float                  $time
+     * @access public
+     */
+    public function addIncompleteTest(PHPUnit_Framework_Test $test, Exception $e, $time)
+    {
+        $this->testFailed(self::STATUS_INCOMPLETE, $test, $e);
+    }
+
+    /**
+     * Skipped test.
+     *
+     * @param  PHPUnit_Framework_Test $test
+     * @param  Exception              $e
+     * @param  float                  $time
+     * @access public
+     * @since  Method available since Release 3.0.0
+     */
+    public function addSkippedTest(PHPUnit_Framework_Test $test, Exception $e, $time)
+    {
+        $this->testFailed(self::STATUS_SKIPPED, $test, $e);
+    }
+
+    /**
+     * A testsuite started.
+     *
+     * @param  PHPUnit_Framework_TestSuite $suite
+     * @access public
+     * @since  Method available since Release 2.2.0
+     */
+    public function startTestSuite(PHPUnit_Framework_TestSuite $suite)
+    {
+    }
+
+    /**
+     * A testsuite ended.
+     *
+     * @param  PHPUnit_Framework_TestSuite $suite
+     * @access public
+     * @since  Method available since Release 2.2.0
+     */
+    public function endTestSuite(PHPUnit_Framework_TestSuite $suite)
+    {
+    }
+
+    /**
+     * A test started.
+     *
+     * @param  PHPUnit_Framework_Test  $test
+     * @access public
+     */
+    public function startTest(PHPUnit_Framework_Test $test)
+    {
+        $this->testStarted($test->getName());
+    }
+
+    /**
+     * A test ended.
+     *
+     * @param  PHPUnit_Framework_Test $test
+     * @param  float                  $time
+     * @access public
+     */
+    public function endTest(PHPUnit_Framework_Test $test, $time)
+    {
+        $this->testEnded($test->getName());
+    }
+
+    /**
+     * Returns the loader to be used.
+     *
+     * @return PHPUnit_Runner_TestSuiteLoader
+     * @access public
+     */
+    public function getLoader()
+    {
+        return new PHPUnit_Runner_StandardTestSuiteLoader;
+    }
+
+    /**
+     * Returns the Test corresponding to the given suite.
+     * This is a template method, subclasses override
+     * the runFailed() and clearStatus() methods.
+     *
+     * @param  string  $suiteClassName
+     * @param  string  $suiteClassFile
+     * @param  boolean $syntaxCheck
+     * @return PHPUnit_Framework_Test
+     * @access public
+     */
+    public function getTest($suiteClassName, $suiteClassFile = '', $syntaxCheck = TRUE)
+    {
+        try {
+            $testClass = $this->loadSuiteClass(
+              $suiteClassName, $suiteClassFile, $syntaxCheck
+            );
+        }
+
+        catch (Exception $e) {
+            $this->runFailed($e->getMessage());
+            return NULL;
+        }
+
+        try {
+            $suiteMethod = $testClass->getMethod(self::SUITE_METHODNAME);
+
+            if (!$suiteMethod->isStatic()) {
+                $this->runFailed(
+                  'suite() method must be static.'
+                );
+
+                return NULL;
+            }
+
+            try {
+                $test = $suiteMethod->invoke(NULL, $testClass->getName());
+            }
+
+            catch (ReflectionException $e) {
+                $this->runFailed(
+                  sprintf(
+                    "Failed to invoke suite() method.\n%s",
+
+                    $e->getMessage()
+                  )
+                );
+
+                return NULL;
+            }
+        }
+
+        catch (ReflectionException $e) {
+            $test = new PHPUnit_Framework_TestSuite($testClass);
+        }
+
+        $this->clearStatus();
+
+        return $test;
+    }
+
+    /**
+     * Override to define how to handle a failed loading of
+     * a test suite.
+     *
+     * @param  string  $message
+     * @access protected
+     * @abstract
+     */
+    abstract protected function runFailed($message);
+
+    /**
+     * Returns the loaded ReflectionClass for a suite name.
+     *
+     * @param  string  $suiteClassName
+     * @param  string  $suiteClassFile
+     * @param  boolean $syntaxCheck
+     * @return ReflectionClass
+     * @access protected
+     */
+    protected function loadSuiteClass($suiteClassName, $suiteClassFile = '', $syntaxCheck = TRUE)
+    {
+        $loader = $this->getLoader();
+
+        if ($loader instanceof PHPUnit_Runner_StandardTestSuiteLoader) {
+            return $loader->load($suiteClassName, $suiteClassFile, $syntaxCheck);
+        } else {
+            return $loader->load($suiteClassName, $suiteClassFile);
+        }
+    }
+
+    /**
+     * Clears the status message.
+     *
+     * @access protected
+     */
+    protected function clearStatus()
+    {
+    }
+
+    /**
+     * A test started.
+     *
+     * @param  string  $testName
+     * @access public
+     * @abstract
+     */
+    abstract public function testStarted($testName);
+
+    /**
+     * A test ended.
+     *
+     * @param  string  $testName
+     * @access public
+     * @abstract
+     */
+    abstract public function testEnded($testName);
+
+    /**
+     * A test failed.
+     *
+     * @param  integer                                 $status
+     * @param  PHPUnit_Framework_Test                 $test
+     * @param  PHPUnit_Framework_AssertionFailedError $e
+     * @access public
+     * @abstract
+     */
+    abstract public function testFailed($status, PHPUnit_Framework_Test $test, PHPUnit_Framework_AssertionFailedError $e);
+}
+?>

Added: incubator/shindig/trunk/php/external/PHPUnit/Runner/IncludePathTestCollector.php
URL: http://svn.apache.org/viewvc/incubator/shindig/trunk/php/external/PHPUnit/Runner/IncludePathTestCollector.php?rev=681982&view=auto
==============================================================================
--- incubator/shindig/trunk/php/external/PHPUnit/Runner/IncludePathTestCollector.php (added)
+++ incubator/shindig/trunk/php/external/PHPUnit/Runner/IncludePathTestCollector.php Sat Aug  2 07:11:35 2008
@@ -0,0 +1,166 @@
+<?php
+/**
+ * PHPUnit
+ *
+ * Copyright (c) 2002-2008, Sebastian Bergmann <sb...@sebastian-bergmann.de>.
+ * 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 <sb...@sebastian-bergmann.de>
+ * @copyright  2002-2008 Sebastian Bergmann <sb...@sebastian-bergmann.de>
+ * @license    http://www.opensource.org/licenses/bsd-license.php  BSD License
+ * @version    SVN: $Id: IncludePathTestCollector.php 1985 2007-12-26 18:11:55Z sb $
+ * @link       http://www.phpunit.de/
+ * @since      File available since Release 2.1.0
+ */
+
+require_once 'PHPUnit/Util/Filter.php';
+require_once 'PHPUnit/Runner/TestCollector.php';
+require_once 'PHPUnit/Util/FilterIterator.php';
+
+PHPUnit_Util_Filter::addFileToFilter(__FILE__, 'PHPUNIT');
+
+/**
+ * A test collector that collects tests from one or more directories
+ * recursively. If no directories are specified, the include_path is searched.
+ *
+ * <code>
+ * $testCollector = new PHPUnit_Runner_IncludePathTestCollector(
+ *   array('/path/to/*Test.php files')
+ * );
+ *
+ * $suite = new PHPUnit_Framework_TestSuite('My Test Suite');
+ * $suite->addTestFiles($testCollector->collectTests());
+ * </code>
+ *
+ * @category   Testing
+ * @package    PHPUnit
+ * @author     Sebastian Bergmann <sb...@sebastian-bergmann.de>
+ * @copyright  2002-2008 Sebastian Bergmann <sb...@sebastian-bergmann.de>
+ * @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_Runner_IncludePathTestCollector implements PHPUnit_Runner_TestCollector
+{
+    /**
+     * @var    string
+     * @access protected
+     */
+    protected $filterIterator;
+
+    /**
+     * @var    array
+     * @access protected
+     */
+    protected $paths;
+
+    /**
+     * @var    string
+     * @access protected
+     */
+    protected $suffix;
+
+    /**
+     * @param  array  $paths
+     * @param  string $suffix
+     * @access public
+     */
+    public function __construct(array $paths = array(), $suffix = 'Test.php')
+    {
+        if (!empty($paths)) {
+            $this->paths = $paths;
+        } else {
+            $this->paths = explode(PATH_SEPARATOR, get_include_path());
+        }
+
+        $this->suffix = $suffix;
+    }
+
+    /**
+     * @return array
+     * @access public
+     */
+    public function collectTests()
+    {
+        $pathIterator = new AppendIterator;
+        $result       = array();
+
+        foreach ($this->paths as $path) {
+            $pathIterator->append(
+              new RecursiveIteratorIterator(
+                new RecursiveDirectoryIterator($path)
+              )
+            );
+        }
+
+        $filterIterator = new PHPUnit_Util_FilterIterator(
+          $pathIterator, $this->suffix
+        );
+
+        if ($this->filterIterator !== NULL) {
+            $class          = new ReflectionClass($this->filterIterator);
+            $filterIterator = $class->newInstance($filterIterator);
+        }
+
+        return $filterIterator;
+    }
+
+    /**
+     * Adds a FilterIterator to filter the source files to be collected.
+     *
+     * @param  string $filterIterator
+     * @throws InvalidArgumentException
+     * @access public
+     */
+    public function setFilterIterator($filterIterator)
+    {
+        if (is_string($filterIterator) && class_exists($filterIterator)) {
+            try {
+                $class = new ReflectionClass($filterIterator);
+
+                if ($class->isSubclassOf('FilterIterator')) {
+                    $this->filterIterator = $filterIterator;
+                }
+            }
+
+            catch (ReflectionException $e) {
+                throw new InvalidArgumentException;
+            }
+        } else {
+            throw new InvalidArgumentException;
+        }
+    }
+}
+?>

Added: incubator/shindig/trunk/php/external/PHPUnit/Runner/StandardTestSuiteLoader.php
URL: http://svn.apache.org/viewvc/incubator/shindig/trunk/php/external/PHPUnit/Runner/StandardTestSuiteLoader.php?rev=681982&view=auto
==============================================================================
--- incubator/shindig/trunk/php/external/PHPUnit/Runner/StandardTestSuiteLoader.php (added)
+++ incubator/shindig/trunk/php/external/PHPUnit/Runner/StandardTestSuiteLoader.php Sat Aug  2 07:11:35 2008
@@ -0,0 +1,124 @@
+<?php
+/**
+ * PHPUnit
+ *
+ * Copyright (c) 2002-2008, Sebastian Bergmann <sb...@sebastian-bergmann.de>.
+ * 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 <sb...@sebastian-bergmann.de>
+ * @copyright  2002-2008 Sebastian Bergmann <sb...@sebastian-bergmann.de>
+ * @license    http://www.opensource.org/licenses/bsd-license.php  BSD License
+ * @version    SVN: $Id: StandardTestSuiteLoader.php 2085 2008-01-14 16:03:31Z sb $
+ * @link       http://www.phpunit.de/
+ * @since      File available since Release 2.0.0
+ */
+
+require_once 'PHPUnit/Util/Filter.php';
+require_once 'PHPUnit/Runner/TestSuiteLoader.php';
+require_once 'PHPUnit/Util/Fileloader.php';
+
+PHPUnit_Util_Filter::addFileToFilter(__FILE__, 'PHPUNIT');
+
+/**
+ * The standard test suite loader.
+ *
+ * @category   Testing
+ * @package    PHPUnit
+ * @author     Sebastian Bergmann <sb...@sebastian-bergmann.de>
+ * @copyright  2002-2008 Sebastian Bergmann <sb...@sebastian-bergmann.de>
+ * @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.0.0
+ */
+class PHPUnit_Runner_StandardTestSuiteLoader implements PHPUnit_Runner_TestSuiteLoader
+{
+    /**
+     * @param  string  $suiteClassName
+     * @param  string  $suiteClassFile
+     * @param  boolean $syntaxCheck
+     * @return ReflectionClass
+     * @throws RuntimeException
+     * @access public
+     */
+    public function load($suiteClassName, $suiteClassFile = '', $syntaxCheck = TRUE)
+    {
+        $suiteClassName = str_replace('.php', '', $suiteClassName);
+
+        if (empty($suiteClassFile)) {
+            $suiteClassFile = str_replace(array('_', '::'), DIRECTORY_SEPARATOR, $suiteClassName) . '.php';
+        }
+
+        if (!class_exists($suiteClassName, FALSE)) {
+            if(!file_exists($suiteClassFile)) {
+                $includePaths = explode(PATH_SEPARATOR, get_include_path());
+
+                foreach ($includePaths as $includePath) {
+                    $file = $includePath . DIRECTORY_SEPARATOR . $suiteClassFile;
+
+                    if (file_exists($file)) {
+                        $suiteClassFile = $file;
+                        break;
+                    }
+                }
+            }
+
+            PHPUnit_Util_Fileloader::checkAndLoad($suiteClassFile, $syntaxCheck);
+        }
+
+        if (class_exists($suiteClassName, FALSE)) {
+            return new ReflectionClass($suiteClassName);
+        } else {
+            throw new RuntimeException(
+              sprintf(
+                'Class %s could not be found in %s.',
+
+                $suiteClassName,
+                $suiteClassFile
+              )
+            );
+        }
+    }
+
+    /**
+     * @param  ReflectionClass  $aClass
+     * @return ReflectionClass
+     * @access public
+     */
+    public function reload(ReflectionClass $aClass)
+    {
+        return $aClass;
+    }
+}
+?>

Added: incubator/shindig/trunk/php/external/PHPUnit/Runner/TestCollector.php
URL: http://svn.apache.org/viewvc/incubator/shindig/trunk/php/external/PHPUnit/Runner/TestCollector.php?rev=681982&view=auto
==============================================================================
--- incubator/shindig/trunk/php/external/PHPUnit/Runner/TestCollector.php (added)
+++ incubator/shindig/trunk/php/external/PHPUnit/Runner/TestCollector.php Sat Aug  2 07:11:35 2008
@@ -0,0 +1,72 @@
+<?php
+/**
+ * PHPUnit
+ *
+ * Copyright (c) 2002-2008, Sebastian Bergmann <sb...@sebastian-bergmann.de>.
+ * 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 <sb...@sebastian-bergmann.de>
+ * @copyright  2002-2008 Sebastian Bergmann <sb...@sebastian-bergmann.de>
+ * @license    http://www.opensource.org/licenses/bsd-license.php  BSD License
+ * @version    SVN: $Id: TestCollector.php 1985 2007-12-26 18:11:55Z sb $
+ * @link       http://www.phpunit.de/
+ * @since      File available since Release 2.0.0
+ */
+
+require_once 'PHPUnit/Util/Filter.php';
+
+PHPUnit_Util_Filter::addFileToFilter(__FILE__, 'PHPUNIT');
+
+/**
+ * Collects Test class names to be presented
+ * by the TestSelector.
+ *
+ * @category   Testing
+ * @package    PHPUnit
+ * @author     Sebastian Bergmann <sb...@sebastian-bergmann.de>
+ * @copyright  2002-2008 Sebastian Bergmann <sb...@sebastian-bergmann.de>
+ * @license    http://www.opensource.org/licenses/bsd-license.php  BSD License
+ * @version    Release: 3.2.9
+ * @link       http://www.phpunit.de/
+ * @since      Interface available since Release 2.0.0
+ */
+interface PHPUnit_Runner_TestCollector
+{
+    /**
+     * @return array
+     * @access public
+     */
+    public function collectTests();
+}
+?>

Added: incubator/shindig/trunk/php/external/PHPUnit/Runner/TestSuiteLoader.php
URL: http://svn.apache.org/viewvc/incubator/shindig/trunk/php/external/PHPUnit/Runner/TestSuiteLoader.php?rev=681982&view=auto
==============================================================================
--- incubator/shindig/trunk/php/external/PHPUnit/Runner/TestSuiteLoader.php (added)
+++ incubator/shindig/trunk/php/external/PHPUnit/Runner/TestSuiteLoader.php Sat Aug  2 07:11:35 2008
@@ -0,0 +1,80 @@
+<?php
+/**
+ * PHPUnit
+ *
+ * Copyright (c) 2002-2008, Sebastian Bergmann <sb...@sebastian-bergmann.de>.
+ * 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 <sb...@sebastian-bergmann.de>
+ * @copyright  2002-2008 Sebastian Bergmann <sb...@sebastian-bergmann.de>
+ * @license    http://www.opensource.org/licenses/bsd-license.php  BSD License
+ * @version    SVN: $Id: TestSuiteLoader.php 1985 2007-12-26 18:11:55Z sb $
+ * @link       http://www.phpunit.de/
+ * @since      File available since Release 2.0.0
+ */
+
+require_once 'PHPUnit/Util/Filter.php';
+
+PHPUnit_Util_Filter::addFileToFilter(__FILE__, 'PHPUNIT');
+
+/**
+ * An interface to define how a test suite should be loaded.
+ *
+ * @category   Testing
+ * @package    PHPUnit
+ * @author     Sebastian Bergmann <sb...@sebastian-bergmann.de>
+ * @copyright  2002-2008 Sebastian Bergmann <sb...@sebastian-bergmann.de>
+ * @license    http://www.opensource.org/licenses/bsd-license.php  BSD License
+ * @version    Release: 3.2.9
+ * @link       http://www.phpunit.de/
+ * @since      Interface available since Release 2.0.0
+ */
+interface PHPUnit_Runner_TestSuiteLoader
+{
+    /**
+     * @param  string  $suiteClassName
+     * @param  string  $suiteClassFile
+     * @return ReflectionClass
+     * @access public
+     */
+    public function load($suiteClassName, $suiteClassFile = '');
+
+    /**
+     * @param  ReflectionClass $aClass
+     * @return ReflectionClass
+     * @access public
+     */
+    public function reload(ReflectionClass $aClass);
+}
+?>

Added: incubator/shindig/trunk/php/external/PHPUnit/Runner/Version.php
URL: http://svn.apache.org/viewvc/incubator/shindig/trunk/php/external/PHPUnit/Runner/Version.php?rev=681982&view=auto
==============================================================================
--- incubator/shindig/trunk/php/external/PHPUnit/Runner/Version.php (added)
+++ incubator/shindig/trunk/php/external/PHPUnit/Runner/Version.php Sat Aug  2 07:11:35 2008
@@ -0,0 +1,87 @@
+<?php
+/**
+ * PHPUnit
+ *
+ * Copyright (c) 2002-2008, Sebastian Bergmann <sb...@sebastian-bergmann.de>.
+ * 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 <sb...@sebastian-bergmann.de>
+ * @copyright  2002-2008 Sebastian Bergmann <sb...@sebastian-bergmann.de>
+ * @license    http://www.opensource.org/licenses/bsd-license.php  BSD License
+ * @version    SVN: $Id: Version.php 1985 2007-12-26 18:11:55Z sb $
+ * @link       http://www.phpunit.de/
+ * @since      File available since Release 2.0.0
+ */
+
+require_once 'PHPUnit/Util/Filter.php';
+
+PHPUnit_Util_Filter::addFileToFilter(__FILE__, 'PHPUNIT');
+
+/**
+ * This class defines the current version of PHPUnit.
+ *
+ * @category   Testing
+ * @package    PHPUnit
+ * @author     Sebastian Bergmann <sb...@sebastian-bergmann.de>
+ * @copyright  2002-2008 Sebastian Bergmann <sb...@sebastian-bergmann.de>
+ * @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.0.0
+ */
+class PHPUnit_Runner_Version
+{
+    /**
+     * Returns the current version of PHPUnit.
+     *
+     * @return string
+     * @access public
+     * @static
+     */
+  	public static function id()
+  	{
+    		return '3.2.9';
+  	}
+
+    /**
+     * @return string
+     * @access public
+     * @static
+     */
+    public static function getVersionString()
+    {
+        return 'PHPUnit 3.2.9 by Sebastian Bergmann.';
+    }
+}
+?>

Added: incubator/shindig/trunk/php/external/PHPUnit/Samples/BankAccount/BankAccount.php
URL: http://svn.apache.org/viewvc/incubator/shindig/trunk/php/external/PHPUnit/Samples/BankAccount/BankAccount.php?rev=681982&view=auto
==============================================================================
--- incubator/shindig/trunk/php/external/PHPUnit/Samples/BankAccount/BankAccount.php (added)
+++ incubator/shindig/trunk/php/external/PHPUnit/Samples/BankAccount/BankAccount.php Sat Aug  2 07:11:35 2008
@@ -0,0 +1,126 @@
+<?php
+/**
+ * PHPUnit
+ *
+ * Copyright (c) 2002-2008, Sebastian Bergmann <sb...@sebastian-bergmann.de>.
+ * 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 <sb...@sebastian-bergmann.de>
+ * @copyright  2002-2008 Sebastian Bergmann <sb...@sebastian-bergmann.de>
+ * @license    http://www.opensource.org/licenses/bsd-license.php  BSD License
+ * @version    SVN: $Id: BankAccount.php 1985 2007-12-26 18:11:55Z sb $
+ * @link       http://www.phpunit.de/
+ * @since      File available since Release 2.3.0
+ */
+
+class BankAccountException extends RuntimeException {}
+
+/**
+ * A bank account.
+ *
+ * @category   Testing
+ * @package    PHPUnit
+ * @author     Sebastian Bergmann <sb...@sebastian-bergmann.de>
+ * @copyright  2002-2008 Sebastian Bergmann <sb...@sebastian-bergmann.de>
+ * @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.3.0
+ */
+class BankAccount
+{
+    /**
+     * The bank account's balance.
+     *
+     * @var    float
+     * @access protected
+     */
+    protected $balance = 0;
+
+    /**
+     * Returns the bank account's balance.
+     *
+     * @return float
+     * @access public
+     */
+    public function getBalance()
+    {
+        return $this->balance;
+    }
+
+    /**
+     * Sets the bank account's balance.
+     *
+     * @param  float $balance
+     * @throws BankAccountException
+     * @access protected
+     */
+    protected function setBalance($balance)
+    {
+        if ($balance >= 0) {
+            $this->balance = $balance;
+        } else {
+            throw new BankAccountException;
+        }
+    }
+
+    /**
+     * Deposits an amount of money to the bank account.
+     *
+     * @param  float $balance
+     * @throws BankAccountException
+     * @access public
+     */
+    public function depositMoney($balance)
+    {
+        $this->setBalance($this->getBalance() + $balance);
+
+        return $this->getBalance();
+    }
+
+    /**
+     * Withdraws an amount of money from the bank account.
+     *
+     * @param  float $balance
+     * @throws BankAccountException
+     * @access public
+     */
+    public function withdrawMoney($balance)
+    {
+        $this->setBalance($this->getBalance() - $balance);
+
+        return $this->getBalance();
+    }
+}
+?>