← Back to team overview

aikiframework-devel team mailing list archive

Re: [Merge] lp:~brylie/aikiframework/dev into lp:aikiframework

 

This is very cool. Did you guys see this? Bassel, can you review this?
This is a pretty big merge, so it needs to be handled with care.

Cool! unit testing!

On Sun, Jan 2, 2011 at 3:32 AM, Brylie Oxley <brylie@xxxxxxxxxxxx> wrote:
> Brylie Oxley has proposed merging lp:~brylie/aikiframework/dev into lp:aikiframework.
>
> Requested reviews:
>  Aiki Framework Developers (aikiframework-devel)
>
> For more details, see:
> https://code.launchpad.net/~brylie/aikiframework/dev/+merge/44981
>
> Added the PHPUnit library for unit testing.
> --
> The attached diff has been truncated due to its size.
> https://code.launchpad.net/~brylie/aikiframework/dev/+merge/44981
> Your team Aiki Framework Developers is requested to review the proposed merge of lp:~brylie/aikiframework/dev into lp:aikiframework.
>
> === added directory 'src/system/libraries/phpunit'
> === added file 'src/system/libraries/phpunit/.gitignore'
> --- src/system/libraries/phpunit/.gitignore     1970-01-01 00:00:00 +0000
> +++ src/system/libraries/phpunit/.gitignore     2011-01-01 19:31:54 +0000
> @@ -0,0 +1,2 @@
> +build
> +phpunit.xml
>
> === added file 'src/system/libraries/phpunit/ChangeLog.markdown'
> --- src/system/libraries/phpunit/ChangeLog.markdown     1970-01-01 00:00:00 +0000
> +++ src/system/libraries/phpunit/ChangeLog.markdown     2011-01-01 19:31:54 +0000
> @@ -0,0 +1,95 @@
> +PHPUnit 3.5
> +===========
> +
> +This is the list of changes for the PHPUnit 3.5 release series.
> +
> +PHPUnit 3.5.6
> +-------------
> +
> +* Fixed GH-87: Fatal error when calling `isPublic()` on dynamically created variable.
> +* Properly marked `assertType()` and `assertNotType()` as well as `assertAttributeType()` and `assertAttributeNotType()` as deprecated. These assertions will removed in PHPUnit 3.6 and should no longer be used. `assertInternalType()` should be used for asserting internal types such as `integer` or `string` whereas `assertInstanceOf()` should be used for asserting that an object is an instance of a specified class or interface.
> +
> +PHPUnit 3.5.5
> +-------------
> +
> +* Added support for `getMockForAbstractClass()` to the mock builder API.
> +
> +PHPUnit 3.5.4
> +-------------
> +
> +* Added a ticket listener that interacts with the Trac issue API.
> +* Added support for `E_USER_NOTICE` and `E_USER_WARNING` to `PHPUnit_Framework_Error_Notice` and `PHPUnit_Framework_Error_Warning`, respectively.
> +* Refactored test dependency handling (required for a bugfix in `PHPUnit_Selenium`).
> +* Fixed `--stop-on-failure`.
> +
> +PHPUnit 3.5.3
> +-------------
> +
> +* Fixed GH-13: Result XML inconsistent when data provider returns empty array or does not exist.
> +* Fixed the skeleton generator for tested classes.
> +* Strict mode is now compatible with process isolation.
> +* Worked around http://bugs.php.net/bug.php?id=52911 to make process isolation work on Windows.
> +
> +PHPUnit 3.5.2
> +-------------
> +
> +* Tests that are incomplete or skipped no longer yield code coverage in strict mode.
> +* Fixed GH-34: Bogus bootstrap file raises cryptic error.
> +
> +PHPUnit 3.5.1
> +-------------
> +
> +* Fixed GH-30: `--repeat` option does not work.
> +* Fixed GH-47: Failure message ignored in `assertSelectCount()`.
> +* Fixed GH-48: Remove strict incomplete duplication.
> +
> +PHPUnit 3.5.0
> +-------------
> +
> +* Implemented TRAC-834: Refactor collection, processing, and rendering of code coverage information using the [PHP_CodeCoverage](http://github.com/sebastianbergmann/php-code-coverage) component.
> +* Implemented TRAC-948: Add D-BUS test listener.
> +* Implemented TRAC-967: Only populate whitelist when code coverage is used.
> +* Implemented TRAC-985: Sort arrays before diff.
> +* Implemented TRAC-1033: Supplement commandline option `--stop-on-error` and friends.
> +* Implemented TRAC-1038: Add `assertInstanceOf()`, `assertAttributeInstanceOf()`, `assertNotInstanceOf()`, and `assertAttributeNotInstanceOf()` as well as `assertInternalType()`, `assertAttributeInternalType()`, `assertNotInternalType()`, and `assertAttributeNotInternalType()`.
> +* Implemented TRAC-1039: Added support for `regexpi:` matcher to Selenium RC driver.
> +* Implemented TRAC-1078: Added support for setting superglobals via the XML configuration file.
> +* Added support for mocking/stubbing of static methods. This requires PHP 5.3 and late static binding.
> +* Added `assertStringMatchesFormat()` and `assertStringNotMatchesFormat()` as well as `assertStringMatchesFormatFile()` and `assertStringNotMatchesFormatFile()` for `EXPECTF`-like (`run-tests.php`) format string matching.
> +* Added `assertEmpty()` and `assertNotEmpty()` as well as `assertAttributeEmpty()` and `assertAttributeNotEmpty()`.
> +* Added the `@expectedExceptionCode` and `@expectedExceptionMessage` annotations.
> +* Added support for the [XML format of mysqldump](http://dev.mysql.com/doc/refman/5.1/en/mysqldump.html#option_mysqldump_xml) to the database extension.
> +* Added the `<includePath>` element to the `<php>` section of the XML configuration file.
> +* Added the `verbose` attribute to the `<phpunit>` element of the XML configuration file.
> +* Added a ticket listener that interacts with the GitHub issue API.
> +* Added a ticket listener that interacts with the GoogleCode issue API.
> +* Added a test listener that uses [XHProf](http://mirror.facebook.net/facebook/xhprof/doc.html) to profile the tested code.
> +* Added the `--strict` switch to mark tests that perform no assertions as incomplete.
> +* The paths in the XML configuration file can now be relative to the directory that contains the XML configuration file.
> +* The `@author` annotation is now an alias for `@group` allowing to filter tests based on their authors.
> +* The `PHPUnit_Extensions_SeleniumTestCase::$autoStop` flag has been removed, please start Selenium RC with `-browserSessionReuse` instead.
> +* The `--log-metrics` and `--log-pmd` switches have been removed. Their functionality has been or will be merged into [PHP_Depend](http://pdepend.org/) and [PHPMD](http://phpmd.org/). Details can be found [here](http://sebastian-bergmann.de/archives/744-On-PHPUnit-and-Software-Metrics.html).
> +* The `--ansi` switch has been removed, please use `--colors` instead.
> +* The `--coverage-source` switch has been removed.
> +* The `--coverage-xml` switch has been removed, please use `--coverage-clover` instead.
> +* The `--log-graphviz` switch has been removed.
> +* The `--log-xml` switch has been removed, please use `--log-junit` instead.
> +* The `--report` switch has been removed, please use `--coverage-html` instead.
> +* The `--skeleton` switch has been removed, please use `--skeleton-test` instead.
> +* The `TestListener` implementation that logs to [PEAR::Log](http://pear.php.net/package/Log) sinks has been removed.
> +* The test database functionality has been removed.
> +* The shared fixture functionality has been removed.
> +* `PHPUnit_Extensions_PerformanceTestCase` has been removed.
> +* `PHPUnit_Extensions_TicketListener_Trac` has been removed.
> +* The `PHPUnit_Extensions_Story_TestCase` functionality has been deprecated.
> +* Replaced `PHPUnit_Framework_MockObject` with the [PHPUnit_MockObject](http://github.com/sebastianbergmann/phpunit-mock-objects) component.
> +* Replaced `PHPUnit_Extensions_Database_TestCase` with the [DbUnit](http://github.com/sebastianbergmann/dbunit) component.
> +* Replaced `PHPUnit_Extensions_SeleniumTestCase` with the [PHPUnit_Selenium](http://github.com/sebastianbergmann/phpunit-selenium) component.
> +* Replaced `PHPUnit_Util_FilterIterator` with the [PHP_FileIterator](http://github.com/sebastianbergmann/php-file-iterator) component.
> +* Replaced `PHPUnit_Util_Template` with the [Text_Template](http://github.com/sebastianbergmann/php-text-template) component.
> +* Replaced `PHPUnit_Util_Timer` with the [PHP_Timer](http://github.com/sebastianbergmann/php-timer) component.
> +* Fixed TRAC-1068: `assertSame()` on two floats does not print the error message.
> +* Fixed GH-7: Code paths that create a `PHPUnit_Framework_Warning` end up serializing/unserializing globals unconditionally.
> +* PHPUnit now requires PHP 5.2.7 (or later) but PHP 5.3.3 (or later) is highly recommended.
> +* PHPUnit now uses an autoloader to load its classes. If the tested code requires an autoloader, use `spl_autoload_register()` to register it.
> +* `PHPUnit/Framework.php` should no longer be included by test code. If needed, include `PHPUnit/Autoload.php` to make PHPUnit's autoloader available.
>
> === added directory 'src/system/libraries/phpunit/PHPUnit'
> === added file 'src/system/libraries/phpunit/PHPUnit/Autoload.php'
> --- src/system/libraries/phpunit/PHPUnit/Autoload.php   1970-01-01 00:00:00 +0000
> +++ src/system/libraries/phpunit/PHPUnit/Autoload.php   2011-01-01 19:31:54 +0000
> @@ -0,0 +1,89 @@
> +<?php
> +/**
> + * PHPUnit
> + *
> + * Copyright (c) 2002-2011, Sebastian Bergmann <sebastian@xxxxxxxxxx>.
> + * 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.
> + *
> + * @package    PHPUnit
> + * @author     Sebastian Bergmann <sebastian@xxxxxxxxxx>
> + * @copyright  2002-2011 Sebastian Bergmann <sebastian@xxxxxxxxxx>
> + * @license    http://www.opensource.org/licenses/bsd-license.php  BSD License
> + * @link       http://www.phpunit.de/
> + * @since      File available since Release 3.5.0
> + */
> +
> +require_once 'PHPUnit/Util/Filesystem.php';
> +require_once 'PHP/CodeCoverage/Filter.php';
> +
> +if (!function_exists('phpunit_autoload')) {
> +    function phpunit_autoload($class)
> +    {
> +        if (strpos($class, 'PHPUnit_') === 0) {
> +            $file = str_replace('_', '/', $class) . '.php';
> +            $file = PHPUnit_Util_Filesystem::fileExistsInIncludePath($file);
> +
> +            if ($file) {
> +                require_once $file;
> +            }
> +        }
> +    }
> +
> +    spl_autoload_register('phpunit_autoload');
> +
> +    $dir    = dirname(__FILE__);
> +    $filter = PHP_CodeCoverage_Filter::getInstance();
> +
> +    $filter->addDirectoryToBlacklist(
> +      $dir . '/Extensions', '.php', '', 'PHPUNIT', FALSE
> +    );
> +
> +    $filter->addDirectoryToBlacklist(
> +      $dir . '/Framework', '.php', '', 'PHPUNIT', FALSE
> +    );
> +
> +    $filter->addDirectoryToBlacklist(
> +      $dir . '/Runner', '.php', '', 'PHPUNIT', FALSE
> +    );
> +
> +    $filter->addDirectoryToBlacklist(
> +      $dir . '/TextUI', '.php', '', 'PHPUNIT', FALSE
> +    );
> +
> +    $filter->addDirectoryToBlacklist(
> +      $dir . '/Util', '.php', '', 'PHPUNIT', FALSE
> +    );
> +
> +    $filter->addFileToBlacklist(__FILE__, 'PHPUNIT', FALSE);
> +
> +    unset($dir, $filter);
> +}
>
> === added directory 'src/system/libraries/phpunit/PHPUnit/Extensions'
> === added file 'src/system/libraries/phpunit/PHPUnit/Extensions/GroupTestSuite.php'
> --- src/system/libraries/phpunit/PHPUnit/Extensions/GroupTestSuite.php  1970-01-01 00:00:00 +0000
> +++ src/system/libraries/phpunit/PHPUnit/Extensions/GroupTestSuite.php  2011-01-01 19:31:54 +0000
> @@ -0,0 +1,100 @@
> +<?php
> +/**
> + * PHPUnit
> + *
> + * Copyright (c) 2002-2011, Sebastian Bergmann <sebastian@xxxxxxxxxx>.
> + * 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.
> + *
> + * @package    PHPUnit
> + * @subpackage Extensions
> + * @author     Sebastian Bergmann <sebastian@xxxxxxxxxx>
> + * @copyright  2002-2011 Sebastian Bergmann <sebastian@xxxxxxxxxx>
> + * @license    http://www.opensource.org/licenses/bsd-license.php  BSD License
> + * @link       http://www.phpunit.de/
> + * @since      File available since Release 3.3.0
> + */
> +
> +/**
> + * We have a TestSuite object A.
> + * In TestSuite object A we have Tests tagged with @group.
> + * We want a TestSuite object B that contains TestSuite objects C, D, ...
> + * for the Tests tagged with @group C, @group D, ...
> + * Running the Tests from TestSuite object B results in Tests tagged with both
> + * @group C and @group D in TestSuite object A to be run twice .
> + *
> + * <code>
> + * $suite = new PHPUnit_Extensions_GroupTestSuite($A, array('C', 'D'));
> + * </code>
> + *
> + * @package    PHPUnit
> + * @subpackage Extensions
> + * @author     Sebastian Bergmann <sebastian@xxxxxxxxxx>
> + * @copyright  2002-2011 Sebastian Bergmann <sebastian@xxxxxxxxxx>
> + * @license    http://www.opensource.org/licenses/bsd-license.php  BSD License
> + * @version    Release: @package_version@
> + * @link       http://www.phpunit.de/
> + * @since      Class available since Release 3.3.0
> + */
> +class PHPUnit_Extensions_GroupTestSuite extends PHPUnit_Framework_TestSuite
> +{
> +    public function __construct(PHPUnit_Framework_TestSuite $suite, array $groups)
> +    {
> +        $groupSuites = array();
> +        $name        = $suite->getName();
> +
> +        foreach ($groups as $group) {
> +            $groupSuites[$group] = new PHPUnit_Framework_TestSuite($name . ' - ' . $group);
> +            $this->addTest($groupSuites[$group]);
> +        }
> +
> +        $tests = new RecursiveIteratorIterator(
> +          new PHPUnit_Util_TestSuiteIterator($suite),
> +          RecursiveIteratorIterator::LEAVES_ONLY
> +        );
> +
> +        foreach ($tests as $test) {
> +            if ($test instanceof PHPUnit_Framework_TestCase) {
> +                $testGroups = PHPUnit_Util_Test::getGroups(
> +                  get_class($test), $test->getName(FALSE)
> +                );
> +
> +                foreach ($groups as $group) {
> +                    foreach ($testGroups as $testGroup) {
> +                        if ($group == $testGroup) {
> +                            $groupSuites[$group]->addTest($test);
> +                        }
> +                    }
> +                }
> +            }
> +        }
> +    }
> +}
>
> === added file 'src/system/libraries/phpunit/PHPUnit/Extensions/OutputTestCase.php'
> --- src/system/libraries/phpunit/PHPUnit/Extensions/OutputTestCase.php  1970-01-01 00:00:00 +0000
> +++ src/system/libraries/phpunit/PHPUnit/Extensions/OutputTestCase.php  2011-01-01 19:31:54 +0000
> @@ -0,0 +1,202 @@
> +<?php
> +/**
> + * PHPUnit
> + *
> + * Copyright (c) 2002-2011, Sebastian Bergmann <sebastian@xxxxxxxxxx>.
> + * 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.
> + *
> + * @package    PHPUnit
> + * @subpackage Extensions
> + * @author     Sebastian Bergmann <sebastian@xxxxxxxxxx>
> + * @copyright  2002-2011 Sebastian Bergmann <sebastian@xxxxxxxxxx>
> + * @license    http://www.opensource.org/licenses/bsd-license.php  BSD License
> + * @link       http://www.phpunit.de/
> + * @since      File available since Release 3.0.0
> + */
> +
> +/**
> + * A TestCase that expects a specified output.
> + *
> + * @package    PHPUnit
> + * @subpackage Extensions
> + * @author     Sebastian Bergmann <sebastian@xxxxxxxxxx>
> + * @copyright  2002-2011 Sebastian Bergmann <sebastian@xxxxxxxxxx>
> + * @license    http://www.opensource.org/licenses/bsd-license.php  BSD License
> + * @version    Release: @package_version@
> + * @link       http://www.phpunit.de/
> + * @since      Class available since Release 3.0.0
> + */
> +abstract class PHPUnit_Extensions_OutputTestCase extends PHPUnit_Framework_TestCase
> +{
> +    /**
> +     * @var    string
> +     */
> +    protected $expectedRegex = NULL;
> +
> +    /**
> +     * @var    string
> +     */
> +    protected $expectedString = NULL;
> +
> +    /**
> +     * @var    string
> +     */
> +    protected $output = '';
> +
> +    /**
> +     * @var    boolean
> +     */
> +    protected $obActive = FALSE;
> +
> +    /**
> +     * @var    mixed
> +     */
> +    protected $outputCallback = FALSE;
> +
> +    /**
> +     * @return bool
> +     */
> +    public function setOutputCallback($callback)
> +    {
> +        if (is_callable($callback)) {
> +            $this->outputCallback = $callback;
> +            return TRUE;
> +        }
> +
> +        return FALSE;
> +    }
> +
> +    /**
> +     * @return string
> +     */
> +    public function normalizeOutput($buffer)
> +    {
> +        return str_replace("\r", '', $buffer);
> +    }
> +
> +    /**
> +     * @return string
> +     */
> +    public function getActualOutput()
> +    {
> +        if (!$this->obActive) {
> +            return $this->output;
> +        } else {
> +            return ob_get_contents();
> +        }
> +    }
> +
> +    /**
> +     * @return string
> +     */
> +    public function expectedRegex()
> +    {
> +        return $this->expectedRegex;
> +    }
> +
> +    /**
> +     * @param  string  $expectedRegex
> +     */
> +    public function expectOutputRegex($expectedRegex)
> +    {
> +        if ($this->expectedString !== NULL) {
> +            throw new PHPUnit_Framework_Exception;
> +        }
> +
> +        if (is_string($expectedRegex) || is_null($expectedRegex)) {
> +            $this->expectedRegex = $expectedRegex;
> +        }
> +    }
> +
> +    /**
> +     * @return string
> +     */
> +    public function expectedString()
> +    {
> +        return $this->expectedString;
> +    }
> +
> +    /**
> +     * @param  string  $expectedString
> +     */
> +    public function expectOutputString($expectedString)
> +    {
> +        if ($this->expectedRegex !== NULL) {
> +            throw new PHPUnit_Framework_Exception;
> +        }
> +
> +        if (is_string($expectedString) || is_null($expectedString)) {
> +            $this->expectedString = $expectedString;
> +        }
> +    }
> +
> +    /**
> +     * @return mixed
> +     * @throws RuntimeException
> +     */
> +    protected function runTest()
> +    {
> +        ob_start();
> +        $this->obActive = TRUE;
> +
> +        try {
> +            $testResult = parent::runTest();
> +        }
> +
> +        catch (Exception $e) {
> +            ob_end_clean();
> +            $this->obActive = FALSE;
> +            throw $e;
> +        }
> +
> +        if ($this->outputCallback === FALSE) {
> +            $this->output = ob_get_contents();
> +        } else {
> +            $this->output = call_user_func_array($this->outputCallback, array(ob_get_contents()));
> +        }
> +
> +        ob_end_clean();
> +        $this->obActive = FALSE;
> +
> +        if ($this->expectedRegex !== NULL) {
> +            $this->assertRegExp($this->expectedRegex, $this->output);
> +            $this->expectedRegex = NULL;
> +        }
> +
> +        else if ($this->expectedString !== NULL) {
> +            $this->assertEquals($this->expectedString, $this->output);
> +            $this->expectedString = NULL;
> +        }
> +
> +        return $testResult;
> +    }
> +}
>
> === added directory 'src/system/libraries/phpunit/PHPUnit/Extensions/PhptTestCase'
> === added file 'src/system/libraries/phpunit/PHPUnit/Extensions/PhptTestCase.php'
> --- src/system/libraries/phpunit/PHPUnit/Extensions/PhptTestCase.php    1970-01-01 00:00:00 +0000
> +++ src/system/libraries/phpunit/PHPUnit/Extensions/PhptTestCase.php    2011-01-01 19:31:54 +0000
> @@ -0,0 +1,277 @@
> +<?php
> +/**
> + * PHPUnit
> + *
> + * Copyright (c) 2002-2011, Sebastian Bergmann <sebastian@xxxxxxxxxx>.
> + * 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.
> + *
> + * @package    PHPUnit
> + * @subpackage Extensions_PhptTestCase
> + * @author     Sebastian Bergmann <sebastian@xxxxxxxxxx>
> + * @copyright  2002-2011 Sebastian Bergmann <sebastian@xxxxxxxxxx>
> + * @license    http://www.opensource.org/licenses/bsd-license.php  BSD License
> + * @link       http://www.phpunit.de/
> + * @since      File available since Release 3.1.4
> + */
> +
> +if (PHPUnit_Util_Filesystem::fileExistsInIncludePath('PEAR/RunTest.php')) {
> +    $currentErrorReporting = error_reporting(E_ERROR | E_WARNING | E_PARSE);
> +    PHPUnit_Util_Filesystem::collectStart();
> +    require_once 'PEAR/RunTest.php';
> +    error_reporting($currentErrorReporting);
> +
> +    PHPUnit_Util_Filesystem::collectEndAndAddToBlacklist();
> +}
> +
> +require_once 'PHP/CodeCoverage.php';
> +require_once 'PHP/Timer.php';
> +
> +/**
> + * Wrapper to run .phpt test cases.
> + *
> + * @package    PHPUnit
> + * @subpackage Extensions_PhptTestCase
> + * @author     Sebastian Bergmann <sebastian@xxxxxxxxxx>
> + * @copyright  2002-2011 Sebastian Bergmann <sebastian@xxxxxxxxxx>
> + * @license    http://www.opensource.org/licenses/bsd-license.php  BSD License
> + * @version    Release: @package_version@
> + * @link       http://www.phpunit.de/
> + * @since      Class available since Release 3.1.4
> + */
> +class PHPUnit_Extensions_PhptTestCase implements PHPUnit_Framework_Test, PHPUnit_Framework_SelfDescribing
> +{
> +    /**
> +     * The filename of the .phpt file.
> +     *
> +     * @var    string
> +     */
> +    protected $filename;
> +
> +    /**
> +     * Options for PEAR_RunTest.
> +     *
> +     * @var    array
> +     */
> +    protected $options = array();
> +
> +    /**
> +     * Constructs a test case with the given filename.
> +     *
> +     * @param  string $filename
> +     * @param  array  $options
> +     */
> +    public function __construct($filename, array $options = array())
> +    {
> +        if (!is_string($filename)) {
> +            throw PHPUnit_Util_InvalidArgumentHelper::factory(1, 'string');
> +        }
> +
> +        if (!is_file($filename)) {
> +            throw new PHPUnit_Framework_Exception(
> +              sprintf(
> +                'File "%s" does not exist.',
> +                $filename
> +              )
> +            );
> +        }
> +
> +        $this->filename = $filename;
> +        $this->options  = $options;
> +    }
> +
> +    /**
> +     * Counts the number of test cases executed by run(TestResult result).
> +     *
> +     * @return integer
> +     */
> +    public function count()
> +    {
> +        return 1;
> +    }
> +
> +    /**
> +     * Runs a test and collects its result in a TestResult instance.
> +     *
> +     * @param  PHPUnit_Framework_TestResult $result
> +     * @param  array                        $options
> +     * @return PHPUnit_Framework_TestResult
> +     */
> +    public function run(PHPUnit_Framework_TestResult $result = NULL, array $options = array())
> +    {
> +        if (!class_exists('PEAR_RunTest', FALSE)) {
> +            throw new PHPUnit_Framework_Exception('Class PEAR_RunTest not found.');
> +        }
> +
> +        if (isset($GLOBALS['_PEAR_destructor_object_list']) &&
> +            is_array($GLOBALS['_PEAR_destructor_object_list']) &&
> +            !empty($GLOBALS['_PEAR_destructor_object_list'])) {
> +            $pearDestructorObjectListCount = count($GLOBALS['_PEAR_destructor_object_list']);
> +        } else {
> +            $pearDestructorObjectListCount = 0;
> +        }
> +
> +        if ($result === NULL) {
> +            $result = new PHPUnit_Framework_TestResult;
> +        }
> +
> +        $coverage = $result->getCollectCodeCoverageInformation();
> +        $options  = array_merge($options, $this->options);
> +
> +        if (!isset($options['include_path'])) {
> +            $options['include_path'] = get_include_path();
> +        }
> +
> +        if ($coverage) {
> +            $options['coverage'] = TRUE;
> +        } else {
> +            $options['coverage'] = FALSE;
> +        }
> +
> +        $currentErrorReporting = error_reporting(E_ERROR | E_WARNING | E_PARSE);
> +        $runner                = new PEAR_RunTest(new PHPUnit_Extensions_PhptTestCase_Logger, $options);
> +
> +        if ($coverage) {
> +            $runner->xdebug_loaded = TRUE;
> +        } else {
> +            $runner->xdebug_loaded = FALSE;
> +        }
> +
> +        $result->startTest($this);
> +
> +        PHP_Timer::start();
> +
> +        $buffer = $runner->run($this->filename, $options);
> +        $time   = PHP_Timer::stop();
> +
> +        error_reporting($currentErrorReporting);
> +
> +        $base         = basename($this->filename);
> +        $path         = dirname($this->filename);
> +        $coverageFile = $path . DIRECTORY_SEPARATOR . str_replace(
> +                          '.phpt', '.xdebug', $base
> +                        );
> +        $diffFile     = $path . DIRECTORY_SEPARATOR . str_replace(
> +                          '.phpt', '.diff', $base
> +                        );
> +        $expFile      = $path . DIRECTORY_SEPARATOR . str_replace(
> +                          '.phpt', '.exp', $base
> +                        );
> +        $logFile      = $path . DIRECTORY_SEPARATOR . str_replace(
> +                          '.phpt', '.log', $base
> +                        );
> +        $outFile      = $path . DIRECTORY_SEPARATOR . str_replace(
> +                          '.phpt', '.out', $base
> +                        );
> +        $phpFile      = $path . DIRECTORY_SEPARATOR . str_replace(
> +                          '.phpt', '.php', $base
> +                        );
> +
> +        if (file_exists($phpFile)) {
> +            PHP_CodeCoverage_Filter::getInstance()->addFileToBlacklist(
> +              $phpFile, 'TESTS'
> +            );
> +        }
> +
> +        if (is_object($buffer) && $buffer instanceof PEAR_Error) {
> +            $result->addError(
> +              $this,
> +              new RuntimeException($buffer->getMessage()),
> +              $time
> +            );
> +        }
> +
> +        else if ($buffer == 'SKIPPED') {
> +            $result->addFailure($this, new PHPUnit_Framework_SkippedTestError, 0);
> +        }
> +
> +        else if ($buffer != 'PASSED') {
> +            $result->addFailure(
> +              $this,
> +              PHPUnit_Framework_ComparisonFailure::diffEqual(
> +                file_get_contents($expFile),
> +                file_get_contents($outFile)
> +              ),
> +              $time
> +            );
> +        }
> +
> +        foreach (array($diffFile, $expFile, $logFile, $phpFile, $outFile) as $file) {
> +            if (file_exists($file)) {
> +                unlink($file);
> +            }
> +        }
> +
> +        if ($coverage && file_exists($coverageFile)) {
> +            eval('$coverageData = ' . file_get_contents($coverageFile) . ';');
> +            unset($coverageData[$phpFile]);
> +
> +            $result->getCodeCoverage()->append($coverageData, $this);
> +            unlink($coverageFile);
> +        }
> +
> +        $result->endTest($this, $time);
> +
> +        // Do not invoke PEAR's destructor mechanism for PHP 4
> +        // as it raises an E_STRICT.
> +        if ($pearDestructorObjectListCount == 0) {
> +            unset($GLOBALS['_PEAR_destructor_object_list']);
> +        } else {
> +            $count = count($GLOBALS['_PEAR_destructor_object_list']) - $pearDestructorObjectListCount;
> +
> +            for ($i = 0; $i < $count; $i++) {
> +                array_pop($GLOBALS['_PEAR_destructor_object_list']);
> +            }
> +        }
> +
> +        return $result;
> +    }
> +
> +    /**
> +     * Returns the name of the test case.
> +     *
> +     * @return string
> +     */
> +    public function getName()
> +    {
> +        return $this->toString();
> +    }
> +
> +    /**
> +     * Returns a string representation of the test case.
> +     *
> +     * @return string
> +     */
> +    public function toString()
> +    {
> +        return $this->filename;
> +    }
> +}
>
> === added file 'src/system/libraries/phpunit/PHPUnit/Extensions/PhptTestCase/Logger.php'
> --- src/system/libraries/phpunit/PHPUnit/Extensions/PhptTestCase/Logger.php     1970-01-01 00:00:00 +0000
> +++ src/system/libraries/phpunit/PHPUnit/Extensions/PhptTestCase/Logger.php     2011-01-01 19:31:54 +0000
> @@ -0,0 +1,63 @@
> +<?php
> +/**
> + * PHPUnit
> + *
> + * Copyright (c) 2002-2011, Sebastian Bergmann <sebastian@xxxxxxxxxx>.
> + * 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.
> + *
> + * @package    PHPUnit
> + * @subpackage Extensions_PhptTestCase
> + * @author     Sebastian Bergmann <sebastian@xxxxxxxxxx>
> + * @copyright  2002-2011 Sebastian Bergmann <sebastian@xxxxxxxxxx>
> + * @license    http://www.opensource.org/licenses/bsd-license.php  BSD License
> + * @link       http://www.phpunit.de/
> + * @since      File available since Release 3.1.4
> + */
> +
> +/**
> + * Dummy logger for PEAR_RunTest.
> + *
> + * @package    PHPUnit
> + * @subpackage Extensions_PhptTestCase
> + * @author     Sebastian Bergmann <sebastian@xxxxxxxxxx>
> + * @copyright  2002-2011 Sebastian Bergmann <sebastian@xxxxxxxxxx>
> + * @license    http://www.opensource.org/licenses/bsd-license.php  BSD License
> + * @version    Release: @package_version@
> + * @link       http://www.phpunit.de/
> + * @since      Class available since Release 3.1.4
> + */
> +class PHPUnit_Extensions_PhptTestCase_Logger
> +{
> +    public function log($level, $msg, $append_crlf = TRUE)
> +    {
> +    }
> +}
>
> === added file 'src/system/libraries/phpunit/PHPUnit/Extensions/PhptTestSuite.php'
> --- src/system/libraries/phpunit/PHPUnit/Extensions/PhptTestSuite.php   1970-01-01 00:00:00 +0000
> +++ src/system/libraries/phpunit/PHPUnit/Extensions/PhptTestSuite.php   2011-01-01 19:31:54 +0000
> @@ -0,0 +1,86 @@
> +<?php
> +/**
> + * PHPUnit
> + *
> + * Copyright (c) 2002-2011, Sebastian Bergmann <sebastian@xxxxxxxxxx>.
> + * 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.
> + *
> + * @package    PHPUnit
> + * @subpackage Extensions_PhptTestCase
> + * @author     Sebastian Bergmann <sebastian@xxxxxxxxxx>
> + * @copyright  2002-2011 Sebastian Bergmann <sebastian@xxxxxxxxxx>
> + * @license    http://www.opensource.org/licenses/bsd-license.php  BSD License
> + * @link       http://www.phpunit.de/
> + * @since      File available since Release 3.1.4
> + */
> +
> +require_once 'File/Iterator/Factory.php';
> +
> +/**
> + * Suite for .phpt test cases.
> + *
> + * @package    PHPUnit
> + * @subpackage Extensions_PhptTestCase
> + * @author     Sebastian Bergmann <sebastian@xxxxxxxxxx>
> + * @copyright  2002-2011 Sebastian Bergmann <sebastian@xxxxxxxxxx>
> + * @license    http://www.opensource.org/licenses/bsd-license.php  BSD License
> + * @version    Release: @package_version@
> + * @link       http://www.phpunit.de/
> + * @since      Class available since Release 3.1.4
> + */
> +class PHPUnit_Extensions_PhptTestSuite extends PHPUnit_Framework_TestSuite
> +{
> +    /**
> +     * Constructs a new TestSuite for .phpt test cases.
> +     *
> +     * @param  string $directory
> +     * @param  array  $options Array with ini settings for the php instance run,
> +     *                         key being the name if the setting, value the ini value.
> +     * @throws InvalidArgumentException
> +     */
> +    public function __construct($directory, array $options = array())
> +    {
> +        if (is_string($directory) && is_dir($directory)) {
> +            $this->setName($directory);
> +
> +            $iterator = File_Iterator_Factory::getFileIterator(
> +              $directory, '.phpt'
> +            );
> +
> +            foreach ($iterator as $testFile) {
> +                $this->addTestFile($testFile->getPathname(), TRUE, $options);
> +            }
> +        } else {
> +            throw PHPUnit_Util_InvalidArgumentHelper::factory(1, 'directory name');
> +        }
> +    }
> +}
>
> === added file 'src/system/libraries/phpunit/PHPUnit/Extensions/RepeatedTest.php'
> --- src/system/libraries/phpunit/PHPUnit/Extensions/RepeatedTest.php    1970-01-01 00:00:00 +0000
> +++ src/system/libraries/phpunit/PHPUnit/Extensions/RepeatedTest.php    2011-01-01 19:31:54 +0000
> @@ -0,0 +1,154 @@
> +<?php
> +/**
> + * PHPUnit
> + *
> + * Copyright (c) 2002-2011, Sebastian Bergmann <sebastian@xxxxxxxxxx>.
> + * 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.
> + *
> + * @package    PHPUnit
> + * @author     Sebastian Bergmann <sebastian@xxxxxxxxxx>
> + * @copyright  2002-2011 Sebastian Bergmann <sebastian@xxxxxxxxxx>
> + * @license    http://www.opensource.org/licenses/bsd-license.php  BSD License
> + * @link       http://www.phpunit.de/
> + * @since      File available since Release 2.0.0
> + */
> +
> +/**
> + * A Decorator that runs a test repeatedly.
> + *
> + * @package    PHPUnit
> + * @author     Sebastian Bergmann <sebastian@xxxxxxxxxx>
> + * @copyright  2002-2011 Sebastian Bergmann <sebastian@xxxxxxxxxx>
> + * @license    http://www.opensource.org/licenses/bsd-license.php  BSD License
> + * @version    Release: @package_version@
> + * @link       http://www.phpunit.de/
> + * @since      Class available since Release 2.0.0
> + */
> +class PHPUnit_Extensions_RepeatedTest extends PHPUnit_Extensions_TestDecorator
> +{
> +    /**
> +     * @var mixed
> +     */
> +    protected $filter = FALSE;
> +
> +    /**
> +     * @var array
> +     */
> +    protected $groups = array();
> +
> +    /**
> +     * @var array
> +     */
> +    protected $excludeGroups = array();
> +
> +    /**
> +     * @var boolean
> +     */
> +    protected $processIsolation = FALSE;
> +
> +    /**
> +     * @var integer
> +     */
> +    protected $timesRepeat = 1;
> +
> +    /**
> +     * Constructor.
> +     *
> +     * @param  PHPUnit_Framework_Test $test
> +     * @param  integer                $timesRepeat
> +     * @param  mixed                  $filter
> +     * @param  array                  $groups
> +     * @param  array                  $excludeGroups
> +     * @param  boolean                $processIsolation
> +     * @throws InvalidArgumentException
> +     */
> +    public function __construct(PHPUnit_Framework_Test $test, $timesRepeat = 1, $filter = FALSE, array $groups = array(), array $excludeGroups = array(), $processIsolation = FALSE)
> +    {
> +        parent::__construct($test);
> +
> +        if (is_integer($timesRepeat) &&
> +            $timesRepeat >= 0) {
> +            $this->timesRepeat = $timesRepeat;
> +        } else {
> +            throw PHPUnit_Util_InvalidArgumentHelper::factory(
> +              2, 'positive integer'
> +            );
> +        }
> +
> +        $this->filter           = $filter;
> +        $this->groups           = $groups;
> +        $this->excludeGroups    = $excludeGroups;
> +        $this->processIsolation = $processIsolation;
> +    }
> +
> +    /**
> +     * Counts the number of test cases that
> +     * will be run by this test.
> +     *
> +     * @return integer
> +     */
> +    public function count()
> +    {
> +        return $this->timesRepeat * count($this->test);
> +    }
> +
> +    /**
> +     * Runs the decorated test and collects the
> +     * result in a TestResult.
> +     *
> +     * @param  PHPUnit_Framework_TestResult $result
> +     * @return PHPUnit_Framework_TestResult
> +     * @throws InvalidArgumentException
> +     */
> +    public function run(PHPUnit_Framework_TestResult $result = NULL)
> +    {
> +        if ($result === NULL) {
> +            $result = $this->createResult();
> +        }
> +
> +        for ($i = 0; $i < $this->timesRepeat && !$result->shouldStop(); $i++) {
> +            if ($this->test instanceof PHPUnit_Framework_TestSuite) {
> +                $this->test->run(
> +                  $result,
> +                  $this->filter,
> +                  $this->groups,
> +                  $this->excludeGroups,
> +                  $this->processIsolation
> +                );
> +            } else {
> +                $this->test->run($result);
> +            }
> +        }
> +
> +        return $result;
> +    }
> +}
>
> === added directory 'src/system/libraries/phpunit/PHPUnit/Extensions/Story'
> === added file 'src/system/libraries/phpunit/PHPUnit/Extensions/Story/Given.php'
> --- src/system/libraries/phpunit/PHPUnit/Extensions/Story/Given.php     1970-01-01 00:00:00 +0000
> +++ src/system/libraries/phpunit/PHPUnit/Extensions/Story/Given.php     2011-01-01 19:31:54 +0000
> @@ -0,0 +1,71 @@
> +<?php
> +/**
> + * PHPUnit
> + *
> + * Copyright (c) 2002-2011, Sebastian Bergmann <sebastian@xxxxxxxxxx>.
> + * 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.
> + *
> + * @package    PHPUnit
> + * @subpackage Extensions_Story
> + * @author     Mattis Stordalen Flister <mattis@xxxxxxx>
> + * @author     Sebastian Bergmann <sebastian@xxxxxxxxxx>
> + * @copyright  2002-2011 Sebastian Bergmann <sebastian@xxxxxxxxxx>
> + * @license    http://www.opensource.org/licenses/bsd-license.php  BSD License
> + * @link       http://www.phpunit.de/
> + * @since      File available since Release 3.3.0
> + */
> +
> +/**
> + * A "Given" step.
> + *
> + * @package    PHPUnit
> + * @subpackage Extensions_Story
> + * @author     Mattis Stordalen Flister <mattis@xxxxxxx>
> + * @author     Sebastian Bergmann <sebastian@xxxxxxxxxx>
> + * @copyright  2002-2011 Sebastian Bergmann <sebastian@xxxxxxxxxx>
> + * @license    http://www.opensource.org/licenses/bsd-license.php  BSD License
> + * @version    Release: @package_version@
> + * @link       http://www.phpunit.de/
> + * @since      Class available since Release 3.3.0
> + */
> +class PHPUnit_Extensions_Story_Given extends PHPUnit_Extensions_Story_Step
> +{
> +    /**
> +     * Returns this step's name.
> +     *
> +     * @return string
> +     */
> +    public function getName()
> +    {
> +        return 'Given';
> +    }
> +}
>
> === added directory 'src/system/libraries/phpunit/PHPUnit/Extensions/Story/ResultPrinter'
> === added file 'src/system/libraries/phpunit/PHPUnit/Extensions/Story/ResultPrinter.php'
> --- src/system/libraries/phpunit/PHPUnit/Extensions/Story/ResultPrinter.php     1970-01-01 00:00:00 +0000
> +++ src/system/libraries/phpunit/PHPUnit/Extensions/Story/ResultPrinter.php     2011-01-01 19:31:54 +0000
> @@ -0,0 +1,102 @@
> +<?php
> +/**
> + * PHPUnit
> + *
> + * Copyright (c) 2002-2011, Sebastian Bergmann <sebastian@xxxxxxxxxx>.
> + * 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.
> + *
> + * @package    PHPUnit
> + * @subpackage Extensions_Story
> + * @author     Sebastian Bergmann <sebastian@xxxxxxxxxx>
> + * @copyright  2002-2011 Sebastian Bergmann <sebastian@xxxxxxxxxx>
> + * @license    http://www.opensource.org/licenses/bsd-license.php  BSD License
> + * @link       http://www.phpunit.de/
> + * @since      File available since Release 3.3.0
> + */
> +
> +/**
> + * Base for Story result printers.
> + *
> + * @package    PHPUnit
> + * @subpackage Extensions_Story
> + * @author     Sebastian Bergmann <sebastian@xxxxxxxxxx>
> + * @copyright  2002-2011 Sebastian Bergmann <sebastian@xxxxxxxxxx>
> + * @license    http://www.opensource.org/licenses/bsd-license.php  BSD License
> + * @version    Release: @package_version@
> + * @link       http://www.phpunit.de/
> + * @since      Class available since Release 3.3.0
> + */
> +class PHPUnit_Extensions_Story_ResultPrinter extends PHPUnit_Util_TestDox_ResultPrinter
> +{
> +    /**
> +     * A test ended.
> +     *
> +     * @param  PHPUnit_Framework_Test $test
> +     * @param  float                  $time
> +     */
> +    public function endTest(PHPUnit_Framework_Test $test, $time)
> +    {
> +        if ($test instanceof PHPUnit_Extensions_Story_TestCase ||
> +            $test instanceof PHPUnit_Extensions_Story_SeleniumTestCase) {
> +            if ($this->testStatus == PHPUnit_Runner_BaseTestRunner::STATUS_PASSED) {
> +                $this->successful++;
> +                $success = TRUE;
> +            } else {
> +                $success = FALSE;
> +            }
> +
> +            $this->onTest(
> +              $this->currentTestMethodPrettified,
> +              $success,
> +              $test->getScenario()->getSteps()
> +            );
> +        }
> +    }
> +
> +    /**
> +     */
> +    protected function doEndClass()
> +    {
> +        $this->endClass($this->testClass);
> +    }
> +
> +    /**
> +     * Handler for 'on test' event.
> +     *
> +     * @param  string  $name
> +     * @param  boolean $success
> +     * @param  array   $steps
> +     */
> +    protected function onTest($name, $success = TRUE, array $steps = array())
> +    {
> +    }
> +}
>
> === added file 'src/system/libraries/phpunit/PHPUnit/Extensions/Story/ResultPrinter/HTML.php'
> --- src/system/libraries/phpunit/PHPUnit/Extensions/Story/ResultPrinter/HTML.php        1970-01-01 00:00:00 +0000
> +++ src/system/libraries/phpunit/PHPUnit/Extensions/Story/ResultPrinter/HTML.php        2011-01-01 19:31:54 +0000
> @@ -0,0 +1,212 @@
> +<?php
> +/**
> + * PHPUnit
> + *
> + * Copyright (c) 2002-2011, Sebastian Bergmann <sebastian@xxxxxxxxxx>.
> + * 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.
> + *
> + * @package    PHPUnit
> + * @subpackage Extensions_Story
> + * @author     Mattis Stordalen Flister <mattis@xxxxxxx>
> + * @author     Sebastian Bergmann <sebastian@xxxxxxxxxx>
> + * @copyright  2002-2011 Sebastian Bergmann <sebastian@xxxxxxxxxx>
> + * @license    http://www.opensource.org/licenses/bsd-license.php  BSD License
> + * @link       http://www.phpunit.de/
> + * @since      File available since Release 3.3.0
> + */
> +
> +/**
> + * Prints stories in HTML format.
> + *
> + * @package    PHPUnit
> + * @subpackage Extensions_Story
> + * @author     Mattis Stordalen Flister <mattis@xxxxxxx>
> + * @author     Sebastian Bergmann <sebastian@xxxxxxxxxx>
> + * @copyright  2002-2011 Sebastian Bergmann <sebastian@xxxxxxxxxx>
> + * @license    http://www.opensource.org/licenses/bsd-license.php  BSD License
> + * @version    Release: @package_version@
> + * @link       http://www.phpunit.de/
> + * @since      Class available since Release 3.3.0
> + */
> +class PHPUnit_Extensions_Story_ResultPrinter_HTML extends PHPUnit_Extensions_Story_ResultPrinter
> +{
> +    /**
> +     * @var boolean
> +     */
> +    protected $printsHTML = TRUE;
> +
> +    /**
> +     * @var integer
> +     */
> +    protected $id = 0;
> +
> +    /**
> +     * @var string
> +     */
> +    protected $scenarios = '';
> +
> +    /**
> +     * @var string
> +     */
> +    protected $templatePath;
> +
> +    /**
> +     * Constructor.
> +     *
> +     * @param  mixed   $out
> +     * @throws InvalidArgumentException
> +     */
> +    public function __construct($out = NULL)
> +    {
> +        parent::__construct($out);
> +
> +        $this->templatePath = sprintf(
> +          '%s%sTemplate%s',
> +
> +          dirname(__FILE__),
> +          DIRECTORY_SEPARATOR,
> +          DIRECTORY_SEPARATOR
> +        );
> +    }
> +
> +    /**
> +     * Handler for 'start class' event.
> +     *
> +     * @param  string $name
> +     */
> +    protected function startClass($name)
> +    {
> +        $scenarioHeaderTemplate = new Text_Template(
> +          $this->templatePath . 'scenario_header.html'
> +        );
> +
> +        $scenarioHeaderTemplate->setVar(
> +          array(
> +            'name' => $this->currentTestClassPrettified
> +          )
> +        );
> +
> +        $this->scenarios .= $scenarioHeaderTemplate->render();
> +    }
> +
> +    /**
> +     * Handler for 'on test' event.
> +     *
> +     * @param  string  $name
> +     * @param  boolean $success
> +     * @param  array   $steps
> +     */
> +    protected function onTest($name, $success = TRUE, array $steps = array())
> +    {
> +        if ($this->testStatus == PHPUnit_Runner_BaseTestRunner::STATUS_FAILURE) {
> +            $scenarioStatus = 'scenarioFailed';
> +        }
> +
> +        else if ($this->testStatus == PHPUnit_Runner_BaseTestRunner::STATUS_SKIPPED) {
> +            $scenarioStatus = 'scenarioSkipped';
> +        }
> +
> +        else if ($this->testStatus == PHPUnit_Runner_BaseTestRunner::STATUS_INCOMPLETE) {
> +            $scenarioStatus = 'scenarioIncomplete';
> +        }
> +
> +        else {
> +            $scenarioStatus = 'scenarioSuccess';
> +        }
> +
> +        $lastStepName = '';
> +        $stepsBuffer  = '';
> +
> +        foreach ($steps as $step) {
> +            $currentStepName = $step->getName();
> +
> +            if ($lastStepName == $currentStepName) {
> +                $stepText = 'and';
> +            } else {
> +                $stepText = $currentStepName;
> +            }
> +
> +            $lastStepName = $currentStepName;
> +
> +            $stepTemplate = new Text_Template(
> +              $this->templatePath . 'step.html'
> +            );
> +
> +            $stepTemplate->setVar(
> +              array(
> +                'text'   => $stepText,
> +                'action' => $step->getAction() . ' ' . $step->getArguments(TRUE),
> +              )
> +            );
> +
> +            $stepsBuffer .= $stepTemplate->render();
> +        }
> +
> +        $scenarioTemplate = new Text_Template(
> +          $this->templatePath . 'scenario.html'
> +        );
> +
> +        $scenarioTemplate->setVar(
> +          array(
> +            'id'             => ++$this->id,
> +            'name'           => $name,
> +            'scenarioStatus' => $scenarioStatus,
> +            'steps'          => $stepsBuffer,
> +          )
> +        );
> +
> +        $this->scenarios .= $scenarioTemplate->render();
> +    }
> +
> +    /**
> +     * Handler for 'end run' event.
> +     *
> +     */
> +    protected function endRun()
> +    {
> +        $scenariosTemplate = new Text_Template(
> +          $this->templatePath . 'scenarios.html'
> +        );
> +
> +        $scenariosTemplate->setVar(
> +          array(
> +            'scenarios'           => $this->scenarios,
> +            'successfulScenarios' => $this->successful,
> +            'failedScenarios'     => $this->failed,
> +            'skippedScenarios'    => $this->skipped,
> +            'incompleteScenarios' => $this->incomplete
> +          )
> +        );
> +
> +        $this->write($scenariosTemplate->render());
> +    }
> +}
>
> === added directory 'src/system/libraries/phpunit/PHPUnit/Extensions/Story/ResultPrinter/Template'
> === added file 'src/system/libraries/phpunit/PHPUnit/Extensions/Story/ResultPrinter/Template/scenario.html.dist'
> --- src/system/libraries/phpunit/PHPUnit/Extensions/Story/ResultPrinter/Template/scenario.html.dist     1970-01-01 00:00:00 +0000
> +++ src/system/libraries/phpunit/PHPUnit/Extensions/Story/ResultPrinter/Template/scenario.html.dist     2011-01-01 19:31:54 +0000
> @@ -0,0 +1,13 @@
> +   <tr>
> +    <td>
> +     <p class="{scenarioStatus}" onclick="showHide('{id}', this)">[+] {name}</p>
> +    </td>
> +   </tr>
> +   <tr>
> +    <td>
> +     <table border="0" width="100%" class="{scenarioStatus} scenarioStepsTable" id="stepContainer{id}">
> +{steps}
> +     </table>
> +    </td>
> +   </tr>
> +
>
> === added file 'src/system/libraries/phpunit/PHPUnit/Extensions/Story/ResultPrinter/Template/scenario_header.html.dist'
> --- src/system/libraries/phpunit/PHPUnit/Extensions/Story/ResultPrinter/Template/scenario_header.html.dist      1970-01-01 00:00:00 +0000
> +++ src/system/libraries/phpunit/PHPUnit/Extensions/Story/ResultPrinter/Template/scenario_header.html.dist      2011-01-01 19:31:54 +0000
> @@ -0,0 +1,6 @@
> +   <tr>
> +    <td>
> +     <p class="header">{name}</p>
> +    </td>
> +   </tr>
> +
>
> === added file 'src/system/libraries/phpunit/PHPUnit/Extensions/Story/ResultPrinter/Template/scenarios.html.dist'
> --- src/system/libraries/phpunit/PHPUnit/Extensions/Story/ResultPrinter/Template/scenarios.html.dist    1970-01-01 00:00:00 +0000
> +++ src/system/libraries/phpunit/PHPUnit/Extensions/Story/ResultPrinter/Template/scenarios.html.dist    2011-01-01 19:31:54 +0000
> @@ -0,0 +1,60 @@
> +<html>
> + <head>
> +  <style type ="text/css">
> +  body { font-family: Andale Mono, monospace; }
> +  .header { font-size: large; font-weight: bold; }
> +  .scenarioSuccess { color: green; }
> +  .scenario { color: black; }
> +  .scenarioFailed { color: red; }
> +  .scenarioSkipped { color: teal; }
> +  .scenarioIncomplete { color: gray; }
> +  .scenarioStepsTable { margin-left: 10px; display: none; }
> +  .stepName { }
> +  </style>
> +  <script type="text/javascript">
> +  function showHide(nodeId, linkObj)
> +  {
> +    var subObj = document.getElementById('stepContainer' + nodeId);
> +
> +    if (linkObj.innerHTML.indexOf('+')>0) {
> +      linkObj.innerHTML = linkObj.innerHTML.replace('+','-');
> +      subObj.style.display='block';
> +      subObj.style.width = '100%';
> +    } else {
> +      linkObj.innerHTML = linkObj.innerHTML.replace('-','+');
> +      subObj.style.display='none';
> +    }
> +  }
> +  </script>
> + </head>
> + <body>
> +  <table border="0">
> +{scenarios}
> +   <tr>
> +    <td>
> +     <p style="margin-top: 20px;" id="Summary" onclick="showHide('Summary', this)">[+] Summary:</p>
> +     <div style="margin-left: 10px; display:none" id="stepContainerSummary">
> +      <table border="0">
> +       <tr>
> +        <td width="250" class="scenarioSuccess">Successful scenarios:</td>
> +        <td class="scenarioSuccessValue">{successfulScenarios}</td>
> +       </tr>
> +       <tr>
> +        <td class="scenarioFailed">Failed scenarios:</td>
> +        <td class="scenarioFailedValue">{failedScenarios}</td>
> +       </tr>
> +       <tr>
> +        <td class="scenarioSkipped">Skipped scenarios:</td>
> +        <td class="scenarioSkippedValue">{skippedScenarios}</td>
> +       </tr>
> +       <tr>
> +        <td class="scenarioIncomplete">Incomplete scenarios:</td>
> +        <td class="scenarioIncompleteValue">{incompleteScenarios}</td>
> +       </tr>
> +      </table>
> +     </div>
> +    </td>
> +   </tr>
> +  </table>
> + </body>
> +</html>
>
> === added file 'src/system/libraries/phpunit/PHPUnit/Extensions/Story/ResultPrinter/Template/step.html.dist'
> --- src/system/libraries/phpunit/PHPUnit/Extensions/Story/ResultPrinter/Template/step.html.dist 1970-01-01 00:00:00 +0000
> +++ src/system/libraries/phpunit/PHPUnit/Extensions/Story/ResultPrinter/Template/step.html.dist 2011-01-01 19:31:54 +0000
> @@ -0,0 +1,6 @@
> +      <tr>
> +       <td width="60">{text}</td>
> +       <td class="stepName">{action}</td>
> +       <td>&nbsp;</td>
> +      </tr>
> +
>
> === added file 'src/system/libraries/phpunit/PHPUnit/Extensions/Story/ResultPrinter/Text.php'
> --- src/system/libraries/phpunit/PHPUnit/Extensions/Story/ResultPrinter/Text.php        1970-01-01 00:00:00 +0000
> +++ src/system/libraries/phpunit/PHPUnit/Extensions/Story/ResultPrinter/Text.php        2011-01-01 19:31:54 +0000
> @@ -0,0 +1,150 @@
> +<?php
> +/**
> + * PHPUnit
> + *
> + * Copyright (c) 2002-2011, Sebastian Bergmann <sebastian@xxxxxxxxxx>.
> + * 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.
> + *
> + * @package    PHPUnit
> + * @subpackage Extensions_Story
> + * @author     Mattis Stordalen Flister <mattis@xxxxxxx>
> + * @author     Sebastian Bergmann <sebastian@xxxxxxxxxx>
> + * @copyright  2002-2011 Sebastian Bergmann <sebastian@xxxxxxxxxx>
> + * @license    http://www.opensource.org/licenses/bsd-license.php  BSD License
> + * @link       http://www.phpunit.de/
> + * @since      File available since Release 3.3.0
> + */
> +
> +/**
> + * Prints stories in HTML format.
> + *
> + * @package    PHPUnit
> + * @subpackage Extensions_Story
> + * @author     Mattis Stordalen Flister <mattis@xxxxxxx>
> + * @author     Sebastian Bergmann <sebastian@xxxxxxxxxx>
> + * @copyright  2002-2011 Sebastian Bergmann <sebastian@xxxxxxxxxx>
> + * @license    http://www.opensource.org/licenses/bsd-license.php  BSD License
> + * @version    Release: @package_version@
> + * @link       http://www.phpunit.de/
> + * @since      Class available since Release 3.3.0
> + */
> +class PHPUnit_Extensions_Story_ResultPrinter_Text extends PHPUnit_Extensions_Story_ResultPrinter
> +{
> +    /**
> +     * Handler for 'start class' event.
> +     *
> +     * @param  string $name
> +     */
> +    protected function startClass($name)
> +    {
> +        $this->write($this->currentTestClassPrettified . "\n");
> +    }
> +
> +    /**
> +     * Handler for 'on test' event.
> +     *
> +     * @param  string  $name
> +     * @param  boolean $success
> +     * @param  array   $steps
> +     */
> +    protected function onTest($name, $success = TRUE, array $steps = array())
> +    {
> +        if ($this->testStatus == PHPUnit_Runner_BaseTestRunner::STATUS_FAILURE) {
> +            $scenarioStatus = 'failed';
> +        }
> +
> +        else if ($this->testStatus == PHPUnit_Runner_BaseTestRunner::STATUS_SKIPPED) {
> +            $scenarioStatus = 'skipped';
> +        }
> +
> +        else if ($this->testStatus == PHPUnit_Runner_BaseTestRunner::STATUS_INCOMPLETE) {
> +            $scenarioStatus = 'incomplete';
> +        }
> +
> +        else {
> +            $scenarioStatus = 'successful';
> +        }
> +
> +        $this->write(
> +          sprintf(
> +            " [%s] %s\n\n",
> +            $scenarioStatus == 'successful' ? 'x' : ' ',
> +            $name
> +          )
> +        );
> +
> +        $lastStepName = '';
> +        $stepsBuffer  = '';
> +
> +        foreach ($steps as $step) {
> +            $currentStepName = $step->getName();
> +
> +            if ($lastStepName == $currentStepName) {
> +                $stepText = 'and';
> +            } else {
> +                $stepText = $currentStepName;
> +            }
> +
> +            $lastStepName = $currentStepName;
> +
> +            $this->write(
> +              sprintf(
> +                "   %5s %s %s\n",
> +                $stepText,
> +                $step->getAction(),
> +                $step->getArguments(TRUE)
> +              )
> +            );
> +        }
> +
> +        $this->write("\n");
> +    }
> +
> +    /**
> +     * Handler for 'end run' event.
> +     *
> +     */
> +    protected function endRun()
> +    {
> +        $this->write(
> +          sprintf(
> +            "Scenarios: %d, Failed: %d, Skipped: %d, Incomplete: %d.\n",
> +
> +            $this->successful + $this->failed +
> +            $this->skipped    + $this->incomplete,
> +            $this->failed,
> +            $this->skipped,
> +            $this->incomplete
> +          )
> +        );
> +    }
> +}
>
> === added file 'src/system/libraries/phpunit/PHPUnit/Extensions/Story/Scenario.php'
> --- src/system/libraries/phpunit/PHPUnit/Extensions/Story/Scenario.php  1970-01-01 00:00:00 +0000
> +++ src/system/libraries/phpunit/PHPUnit/Extensions/Story/Scenario.php  2011-01-01 19:31:54 +0000
> @@ -0,0 +1,189 @@
> +<?php
> +/**
> + * PHPUnit
> + *
> + * Copyright (c) 2002-2011, Sebastian Bergmann <sebastian@xxxxxxxxxx>.
> + * 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.
> + *
> + * @package    PHPUnit
> + * @subpackage Extensions_Story
> + * @author     Mattis Stordalen Flister <mattis@xxxxxxx>
> + * @author     Sebastian Bergmann <sebastian@xxxxxxxxxx>
> + * @copyright  2002-2011 Sebastian Bergmann <sebastian@xxxxxxxxxx>
> + * @license    http://www.opensource.org/licenses/bsd-license.php  BSD License
> + * @link       http://www.phpunit.de/
> + * @since      File available since Release 3.3.0
> + */
> +
> +/**
> + * A scenario.
> + *
> + * @package    PHPUnit
> + * @subpackage Extensions_Story
> + * @author     Mattis Stordalen Flister <mattis@xxxxxxx>
> + * @author     Sebastian Bergmann <sebastian@xxxxxxxxxx>
> + * @copyright  2002-2011 Sebastian Bergmann <sebastian@xxxxxxxxxx>
> + * @license    http://www.opensource.org/licenses/bsd-license.php  BSD License
> + * @version    Release: @package_version@
> + * @link       http://www.phpunit.de/
> + * @since      Class available since Release 3.3.0
> + */
> +class PHPUnit_Extensions_Story_Scenario
> +{
> +    /**
> +     * @var    PHPUnit_Extensions_Story_TestCase
> +     */
> +    protected $test;
> +
> +    /**
> +     * @var    array
> +     */
> +    protected $steps = array();
> +
> +    /**
> +     * @var    string
> +     */
> +    protected $lastCalledMethod;
> +
> +    /**
> +     * Constructor.
> +     *
> +     * @param  PHPUnit_Extensions_Story_TestCase $caller
> +     */
> +    public function __construct($test)
> +    {
> +        if ($test instanceof PHPUnit_Extensions_Story_TestCase ||
> +            $test instanceof PHPUnit_Extensions_Story_SeleniumTestCase) {
> +            $this->test = $test;
> +        } else {
> +            throw new Exception('$test must either be PHPUnit_Extensions_Story_TestCase or PHPUnit_Extensions_Story_SeleniumTestCase');
> +        }
> +    }
> +
> +    /**
> +     * Adds a "Given" step to the scenario.
> +     *
> +     * @param  array $arguments
> +     * @return PHPUnit_Extensions_Story_TestCase
> +     */
> +    public function given($arguments)
> +    {
> +        return $this->addStep(new PHPUnit_Extensions_Story_Given($arguments));
> +    }
> +
> +    /**
> +     * Adds a "When" step to the scenario.
> +     *
> +     * @param  array $arguments
> +     * @return PHPUnit_Extensions_Story_TestCase
> +     */
> +    public function when($arguments)
> +    {
> +        return $this->addStep(new PHPUnit_Extensions_Story_When($arguments));
> +    }
> +
> +    /**
> +     * Adds a "Then" step to the scenario.
> +     *
> +     * @param  array $arguments
> +     * @return PHPUnit_Extensions_Story_TestCase
> +     */
> +    public function then($arguments)
> +    {
> +        return $this->addStep(new PHPUnit_Extensions_Story_Then($arguments));
> +    }
> +
> +    /**
> +     * Add another step of the same type as the step that was added before.
> +     *
> +     * @param  array $arguments
> +     * @return PHPUnit_Extensions_Story_TestCase
> +     */
> +    public function _and($arguments)
> +    {
> +        $lastCalledStepClass = get_class($this->steps[count($this->steps)-1]);
> +
> +        return $this->addStep(new $lastCalledStepClass($arguments));
> +    }
> +
> +    /**
> +     * Runs this scenario.
> +     *
> +     * @param  array $world
> +     */
> +    public function run(array &$world)
> +    {
> +        foreach ($this->steps as $step)
> +        {
> +            if ($step instanceof PHPUnit_Extensions_Story_Given) {
> +                $this->test->runGiven(
> +                  $world, $step->getAction(), $step->getArguments()
> +                );
> +            }
> +
> +            else if ($step instanceof PHPUnit_Extensions_Story_When) {
> +                $this->test->runWhen(
> +                  $world, $step->getAction(), $step->getArguments()
> +                );
> +            }
> +
> +            else {
> +                $this->test->runThen(
> +                  $world, $step->getAction(), $step->getArguments()
> +                );
> +            }
> +        }
> +    }
> +
> +    /**
> +     * Adds a step to the scenario.
> +     *
> +     * @param  PHPUnit_Extensions_Story_Step $step
> +     * @return PHPUnit_Extensions_Story_TestCase
> +     */
> +    protected function addStep(PHPUnit_Extensions_Story_Step $step)
> +    {
> +        $this->steps[] = $step;
> +
> +        return $this->test;
> +    }
> +
> +    /**
> +     * Returns the steps of this scenario.
> +     *
> +     * @return array
> +     */
> +    public function getSteps()
> +    {
> +        return $this->steps;
> +    }
> +}
>
> === added file 'src/system/libraries/phpunit/PHPUnit/Extensions/Story/Step.php'
> --- src/system/libraries/phpunit/PHPUnit/Extensions/Story/Step.php      1970-01-01 00:00:00 +0000
> +++ src/system/libraries/phpunit/PHPUnit/Extensions/Story/Step.php      2011-01-01 19:31:54 +0000
> @@ -0,0 +1,128 @@
> +<?php
> +/**
> + * PHPUnit
> + *
> + * Copyright (c) 2002-2011, Sebastian Bergmann <sebastian@xxxxxxxxxx>.
> + * 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.
> + *
> + * @package    PHPUnit
> + * @subpackage Extensions_Story
> + * @author     Mattis Stordalen Flister <mattis@xxxxxxx>
> + * @author     Sebastian Bergmann <sebastian@xxxxxxxxxx>
> + * @copyright  2002-2011 Sebastian Bergmann <sebastian@xxxxxxxxxx>
> + * @license    http://www.opensource.org/licenses/bsd-license.php  BSD License
> + * @link       http://www.phpunit.de/
> + * @since      File available since Release 3.3.0
> + */
> +
> +/**
> + * A step of a scenario.
> + *
> + * @package    PHPUnit
> + * @subpackage Extensions_Story
> + * @author     Mattis Stordalen Flister <mattis@xxxxxxx>
> + * @author     Sebastian Bergmann <sebastian@xxxxxxxxxx>
> + * @copyright  2002-2011 Sebastian Bergmann <sebastian@xxxxxxxxxx>
> + * @license    http://www.opensource.org/licenses/bsd-license.php  BSD License
> + * @version    Release: @package_version@
> + * @link       http://www.phpunit.de/
> + * @since      Class available since Release 3.3.0
> + */
> +abstract class PHPUnit_Extensions_Story_Step
> +{
> +    /**
> +     * @var    string
> +     */
> +    protected $action;
> +
> +    /**
> +     * @var    array
> +     */
> +    protected $arguments;
> +
> +    /**
> +     * Constructor.
> +     *
> +     * @param  array $arguments
> +     */
> +    public function __construct(array $arguments)
> +    {
> +        $this->action    = array_shift($arguments);
> +        $this->arguments = $arguments;
> +    }
> +
> +    /**
> +     * Returns this step's action.
> +     *
> +     * @return string
> +     */
> +    public function getAction()
> +    {
> +        return $this->action;
> +    }
> +
> +    /**
> +     * Returns this step's arguments.
> +     *
> +     * @param  boolean $asString
> +     * @return array|string
> +     */
> +    public function getArguments($asString = FALSE)
> +    {
> +        if (!$asString) {
> +            return $this->arguments;
> +        } else {
> +            switch (count($this->arguments)) {
> +                case 0: {
> +                    return '';
> +                }
> +                break;
> +
> +                case 1: {
> +                    return $this->arguments[0];
> +                }
> +                break;
> +
> +                default: {
> +                    return var_export($this->arguments, TRUE);
> +                }
> +            }
> +        }
> +    }
> +
> +    /**
> +     * Returns this step's name.
> +     *
> +     * @return string
> +     */
> +    abstract public function getName();
> +}
>
> === added file 'src/system/libraries/phpunit/PHPUnit/Extensions/Story/TestCase.php'
> --- src/system/libraries/phpunit/PHPUnit/Extensions/Story/TestCase.php  1970-01-01 00:00:00 +0000
> +++ src/system/libraries/phpunit/PHPUnit/Extensions/Story/TestCase.php  2011-01-01 19:31:54 +0000
> @@ -0,0 +1,210 @@
> +<?php
> +/**
> + * PHPUnit
> + *
> + * Copyright (c) 2002-2011, Sebastian Bergmann <sebastian@xxxxxxxxxx>.
> + * 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.
> + *
> + * @package    PHPUnit
> + * @subpackage Extensions_Story
> + * @author     Mattis Stordalen Flister <mattis@xxxxxxx>
> + * @author     Sebastian Bergmann <sebastian@xxxxxxxxxx>
> + * @copyright  2002-2011 Sebastian Bergmann <sebastian@xxxxxxxxxx>
> + * @license    http://www.opensource.org/licenses/bsd-license.php  BSD License
> + * @link       http://www.phpunit.de/
> + * @since      File available since Release 3.3.0
> + */
> +
> +/**
> + * A story test case.
> + *
> + * @package    PHPUnit
> + * @subpackage Extensions_Story
> + * @author     Mattis Stordalen Flister <mattis@xxxxxxx>
> + * @author     Sebastian Bergmann <sebastian@xxxxxxxxxx>
> + * @copyright  2002-2011 Sebastian Bergmann <sebastian@xxxxxxxxxx>
> + * @license    http://www.opensource.org/licenses/bsd-license.php  BSD License
> + * @version    Release: @package_version@
> + * @link       http://www.phpunit.de/
> + * @since      Class available since Release 3.3.0
> + */
> +abstract class PHPUnit_Extensions_Story_TestCase extends PHPUnit_Framework_TestCase
> +{
> +    /**
> +     * @var    PHPUnit_Extensions_Story_Scenario
> +     */
> +    protected $scenario;
> +
> +    /**
> +     * @var    array
> +     */
> +    protected $world = array();
> +
> +    /**
> +     * Constructs a test case with the given name.
> +     *
> +     * @param  string $name
> +     * @param  array  $data
> +     * @param  string $dataName
> +     */
> +    public function __construct($name = NULL, array $data = array(), $dataName = '')
> +    {
> +        parent::__construct($name, $data, $dataName);
> +        $this->scenario = new PHPUnit_Extensions_Story_Scenario($this);
> +    }
> +
> +    /**
> +     * @method PHPUnit_Extensions_Story_Step and($contextOrOutcome)
> +     */
> +    public function __call($command, $arguments)
> +    {
> +        switch ($command) {
> +            case 'and': {
> +                return $this->scenario->_and($arguments);
> +            }
> +            break;
> +
> +            default: {
> +                throw new BadMethodCallException(
> +                  "Method $command not defined."
> +                );
> +            }
> +        }
> +    }
> +
> +    /**
> +     * Returns this test's scenario.
> +     *
> +     * @return PHPUnit_Extensions_Story_Scenario
> +     */
> +    public function getScenario()
> +    {
> +        return $this->scenario;
> +    }
> +
> +    /**
> +     *
> +     *
> +     */
> +    protected function notImplemented($action)
> +    {
> +        if (strstr($action, ' ')) {
> +            $this->markTestIncomplete("step: $action not implemented.");
> +        }
> +
> +        throw new BadMethodCallException("Method $action not defined.");
> +    }
> +
> +    /**
> +     * Adds a "Given" step to the scenario.
> +     *
> +     * @param  array $arguments
> +     * @return PHPUnit_Extensions_Story_TestCase
> +     */
> +    protected function given($context)
> +    {
> +        return $this->scenario->given(func_get_args());
> +    }
> +
> +    /**
> +     * Adds a "When" step to the scenario.
> +     *
> +     * @param  array $arguments
> +     * @return PHPUnit_Extensions_Story_TestCase
> +     */
> +    protected function when($event)
> +    {
> +        return $this->scenario->when(func_get_args());
> +    }
> +
> +    /**
> +     * Adds a "Then" step to the scenario.
> +     *
> +     * @param  array $arguments
> +     * @return PHPUnit_Extensions_Story_TestCase
> +     */
> +    protected function then($outcome)
> +    {
> +        return $this->scenario->then(func_get_args());
> +    }
> +
> +    /**
> +     * Add another step of the same type as the step that was added before.
> +     *
> +     * @param  array $arguments
> +     * @return PHPUnit_Extensions_Story_TestCase
> +     */
> +    protected function _and($contextOrOutcome)
> +    {
> +        return $this->scenario->_and(func_get_args());
> +    }
> +
> +    /**
> +     * Run this test's scenario.
> +     *
> +     * @return mixed
> +     * @throws RuntimeException
> +     */
> +    protected function runTest()
> +    {
> +        $testResult = parent::runTest();
> +        $this->scenario->run($this->world);
> +        return $testResult;
> +    }
> +
> +    /**
> +     * Implementation for "Given" steps.
> +     *
> +     * @param  array  $world
> +     * @param  string $action
> +     * @param  array  $arguments
> +     */
> +    abstract protected function runGiven(&$world, $action, $arguments);
> +
> +    /**
> +     * Implementation for "When" steps.
> +     *
> +     * @param  array  $world
> +     * @param  string $action
> +     * @param  array  $arguments
> +     */
> +    abstract protected function runWhen(&$world, $action, $arguments);
> +
> +    /**
> +     * Implementation for "Then" steps.
> +     *
> +     * @param  array  $world
> +     * @param  string $action
> +     * @param  array  $arguments
> +     */
> +    abstract protected function runThen(&$world, $action, $arguments);
> +}
>
> === added file 'src/system/libraries/phpunit/PHPUnit/Extensions/Story/Then.php'
> --- src/system/libraries/phpunit/PHPUnit/Extensions/Story/Then.php      1970-01-01 00:00:00 +0000
> +++ src/system/libraries/phpunit/PHPUnit/Extensions/Story/Then.php      2011-01-01 19:31:54 +0000
> @@ -0,0 +1,71 @@
> +<?php
> +/**
> + * PHPUnit
> + *
> + * Copyright (c) 2002-2011, Sebastian Bergmann <sebastian@xxxxxxxxxx>.
> + * 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.
> + *
> + * @package    PHPUnit
> + * @subpackage Extensions_Story
> + * @author     Mattis Stordalen Flister <mattis@xxxxxxx>
> + * @author     Sebastian Bergmann <sebastian@xxxxxxxxxx>
> + * @copyright  2002-2011 Sebastian Bergmann <sebastian@xxxxxxxxxx>
> + * @license    http://www.opensource.org/licenses/bsd-license.php  BSD License
> + * @link       http://www.phpunit.de/
> + * @since      File available since Release 3.3.0
> + */
> +
> +/**
> + * A "Then" step.
> + *
> + * @package    PHPUnit
> + * @subpackage Extensions_Story
> + * @author     Mattis Stordalen Flister <mattis@xxxxxxx>
> + * @author     Sebastian Bergmann <sebastian@xxxxxxxxxx>
> + * @copyright  2002-2011 Sebastian Bergmann <sebastian@xxxxxxxxxx>
> + * @license    http://www.opensource.org/licenses/bsd-license.php  BSD License
> + * @version    Release: @package_version@
> + * @link       http://www.phpunit.de/
> + * @since      Class available since Release 3.3.0
> + */
> +class PHPUnit_Extensions_Story_Then extends PHPUnit_Extensions_Story_Step
> +{
> +    /**
> +     * Returns this step's name.
> +     *
> +     * @return string
> +     */
> +    public function getName()
> +    {
> +        return 'Then';
> +    }
> +}
>
> === added file 'src/system/libraries/phpunit/PHPUnit/Extensions/Story/When.php'
> --- src/system/libraries/phpunit/PHPUnit/Extensions/Story/When.php      1970-01-01 00:00:00 +0000
> +++ src/system/libraries/phpunit/PHPUnit/Extensions/Story/When.php      2011-01-01 19:31:54 +0000
> @@ -0,0 +1,71 @@
> +<?php
> +/**
> + * PHPUnit
> + *
> + * Copyright (c) 2002-2011, Sebastian Bergmann <sebastian@xxxxxxxxxx>.
> + * 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.
> + *
> + * @package    PHPUnit
> + * @subpackage Extensions_Story
> + * @author     Mattis Stordalen Flister <mattis@xxxxxxx>
> + * @author     Sebastian Bergmann <sebastian@xxxxxxxxxx>
> + * @copyright  2002-2011 Sebastian Bergmann <sebastian@xxxxxxxxxx>
> + * @license    http://www.opensource.org/licenses/bsd-license.php  BSD License
> + * @link       http://www.phpunit.de/
> + * @since      File available since Release 3.3.0
> + */
> +
> +/**
> + * A "When" step.
> + *
> + * @package    PHPUnit
> + * @subpackage Extensions_Story
> + * @author     Mattis Stordalen Flister <mattis@xxxxxxx>
> + * @author     Sebastian Bergmann <sebastian@xxxxxxxxxx>
> + * @copyright  2002-2011 Sebastian Bergmann <sebastian@xxxxxxxxxx>
> + * @license    http://www.opensource.org/licenses/bsd-license.php  BSD License
> + * @version    Release: @package_version@
> + * @link       http://www.phpunit.de/
> + * @since      Class available since Release 3.3.0
> + */
> +class PHPUnit_Extensions_Story_When extends PHPUnit_Extensions_Story_Step
> +{
> +    /**
> +     * Returns this step's name.
> +     *
> +     * @return string
> +     */
> +    public function getName()
> +    {
> +        return 'When';
> +    }
> +}
>
> === added file 'src/system/libraries/phpunit/PHPUnit/Extensions/TestDecorator.php'
> --- src/system/libraries/phpunit/PHPUnit/Extensions/TestDecorator.php   1970-01-01 00:00:00 +0000
> +++ src/system/libraries/phpunit/PHPUnit/Extensions/TestDecorator.php   2011-01-01 19:31:54 +0000
> @@ -0,0 +1,151 @@
> +<?php
> +/**
> + * PHPUnit
> + *
> + * Copyright (c) 2002-2011, Sebastian Bergmann <sebastian@xxxxxxxxxx>.
> + * 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.
> + *
> + * @package    PHPUnit
> + * @subpackage Extensions
> + * @author     Sebastian Bergmann <sebastian@xxxxxxxxxx>
> + * @copyright  2002-2011 Sebastian Bergmann <sebastian@xxxxxxxxxx>
> + * @license    http://www.opensource.org/licenses/bsd-license.php  BSD License
> + * @link       http://www.phpunit.de/
> + * @since      File available since Release 2.0.0
> + */
> +
> +/**
> + * A Decorator for Tests.
> + *
> + * Use TestDecorator as the base class for defining new
> + * test decorators. Test decorator subclasses can be introduced
> + * to add behaviour before or after a test is run.
> + *
> + * @package    PHPUnit
> + * @subpackage Extensions
> + * @author     Sebastian Bergmann <sebastian@xxxxxxxxxx>
> + * @copyright  2002-2011 Sebastian Bergmann <sebastian@xxxxxxxxxx>
> + * @license    http://www.opensource.org/licenses/bsd-license.php  BSD License
> + * @version    Release: @package_version@
> + * @link       http://www.phpunit.de/
> + * @since      Class available since Release 2.0.0
> + */
> +class PHPUnit_Extensions_TestDecorator extends PHPUnit_Framework_Assert implements PHPUnit_Framework_Test, PHPUnit_Framework_SelfDescribing
> +{
> +    /**
> +     * The Test to be decorated.
> +     *
> +     * @var    object
> +     */
> +    protected $test = NULL;
> +
> +    /**
> +     * Constructor.
> +     *
> +     * @param  PHPUnit_Framework_Test $test
> +     */
> +    public function __construct(PHPUnit_Framework_Test $test)
> +    {
> +        $this->test = $test;
> +    }
> +
> +    /**
> +     * Returns a string representation of the test.
> +     *
> +     * @return string
> +     */
> +    public function toString()
> +    {
> +        return $this->test->toString();
> +    }
> +
> +    /**
> +     * Runs the test and collects the
> +     * result in a TestResult.
> +     *
> +     * @param  PHPUnit_Framework_TestResult $result
> +     */
> +    public function basicRun(PHPUnit_Framework_TestResult $result)
> +    {
> +        $this->test->run($result);
> +    }
> +
> +    /**
> +     * Counts the number of test cases that
> +     * will be run by this test.
> +     *
> +     * @return integer
> +     */
> +    public function count()
> +    {
> +        return count($this->test);
> +    }
> +
> +    /**
> +     * Creates a default TestResult object.
> +     *
> +     * @return PHPUnit_Framework_TestResult
> +     */
> +    protected function createResult()
> +    {
> +        return new PHPUnit_Framework_TestResult;
> +    }
> +
> +    /**
> +     * Returns the test to be run.
> +     *
> +     * @return PHPUnit_Framework_Test
> +     */
> +    public function getTest()
> +    {
> +        return $this->test;
> +    }
> +
> +    /**
> +     * Runs the decorated test and collects the
> +     * result in a TestResult.
> +     *
> +     * @param  PHPUnit_Framework_TestResult $result
> +     * @return PHPUnit_Framework_TestResult
> +     * @throws InvalidArgumentException
> +     */
> +    public function run(PHPUnit_Framework_TestResult $result = NULL)
> +    {
> +        if ($result === NULL) {
> +            $result = $this->createResult();
> +        }
> +
> +        $this->basicRun($result);
> +
> +        return $result;
> +    }
> +}
>
> === added directory 'src/system/libraries/phpunit/PHPUnit/Extensions/TicketListener'
> === added file 'src/system/libraries/phpunit/PHPUnit/Extensions/TicketListener.php'
> --- src/system/libraries/phpunit/PHPUnit/Extensions/TicketListener.php  1970-01-01 00:00:00 +0000
> +++ src/system/libraries/phpunit/PHPUnit/Extensions/TicketListener.php  2011-01-01 19:31:54 +0000
> @@ -0,0 +1,225 @@
> +<?php
> +/**
> + * PHPUnit
> + *
> + * Copyright (c) 2002-2011, Sebastian Bergmann <sebastian@xxxxxxxxxx>.
> + * 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.
> + *
> + * @package    PHPUnit
> + * @subpackage Extensions_TicketListener
> + * @author     Sean Coates <sean@xxxxxxxxxxx>
> + * @author     Raphael Stolt <raphael.stolt@xxxxxxxxx>
> + * @author     Sebastian Bergmann <sebastian@xxxxxxxxxx>
> + * @copyright  2002-2011 Sebastian Bergmann <sebastian@xxxxxxxxxx>
> + * @license    http://www.opensource.org/licenses/bsd-license.php  BSD License
> + * @link       http://www.phpunit.de/
> + * @since      File available since Release 3.4.0
> + */
> +
> +/**
> + * Base class for test listeners that interact with an issue tracker.
> + *
> + * @package    PHPUnit
> + * @subpackage Extensions_TicketListener
> + * @author     Sean Coates <sean@xxxxxxxxxxx>
> + * @author     Sebastian Bergmann <sebastian@xxxxxxxxxx>
> + * @copyright  2002-2011 Sebastian Bergmann <sebastian@xxxxxxxxxx>
> + * @license    http://www.opensource.org/licenses/bsd-license.php  BSD License
> + * @version    Release: @package_version@
> + * @link       http://www.phpunit.de/
> + * @since      Class available since Release 3.4.0
> + */
> +abstract class PHPUnit_Extensions_TicketListener implements PHPUnit_Framework_TestListener
> +{
> +    /**
> +     * @var array
> +     */
> +    protected $ticketCounts = array();
> +
> +    /**
> +     * @var boolean
> +     */
> +    protected $ran = FALSE;
> +
> +    /**
> +     * An error occurred.
> +     *
> +     * @param  PHPUnit_Framework_Test $test
> +     * @param  Exception              $e
> +     * @param  float                  $time
> +     */
> +    public function addError(PHPUnit_Framework_Test $test, Exception $e, $time)
> +    {
> +    }
> +
> +    /**
> +     * A failure occurred.
> +     *
> +     * @param  PHPUnit_Framework_Test                 $test
> +     * @param  PHPUnit_Framework_AssertionFailedError $e
> +     * @param  float                                  $time
> +     */
> +    public function addFailure(PHPUnit_Framework_Test $test, PHPUnit_Framework_AssertionFailedError $e, $time)
> +    {
> +    }
> +
> +    /**
> +     * Incomplete test.
> +     *
> +     * @param  PHPUnit_Framework_Test $test
> +     * @param  Exception              $e
> +     * @param  float                  $time
> +     */
> +    public function addIncompleteTest(PHPUnit_Framework_Test $test, Exception $e, $time)
> +    {
> +    }
> +
> +    /**
> +     * Skipped test.
> +     *
> +     * @param  PHPUnit_Framework_Test $test
> +     * @param  Exception              $e
> +     * @param  float                  $time
> +     * @since  Method available since Release 3.0.0
> +     */
> +    public function addSkippedTest(PHPUnit_Framework_Test $test, Exception $e, $time)
> +    {
> +    }
> +
> +    /**
> +     * A test suite started.
> +     *
> +     * @param  PHPUnit_Framework_TestSuite $suite
> +     * @since  Method available since Release 2.2.0
> +     */
> +    public function startTestSuite(PHPUnit_Framework_TestSuite $suite)
> +    {
> +    }
> +
> +    /**
> +     * A test suite ended.
> +     *
> +     * @param  PHPUnit_Framework_TestSuite $suite
> +     * @since  Method available since Release 2.2.0
> +     */
> +    public function endTestSuite(PHPUnit_Framework_TestSuite $suite)
> +    {
> +    }
> +
> +    /**
> +     * A test started.
> +     *
> +     * @param  PHPUnit_Framework_Test $test
> +     */
> +    public function startTest(PHPUnit_Framework_Test $test)
> +    {
> +        if (!$test instanceof PHPUnit_Framework_Warning) {
> +            if ($this->ran) {
> +                return;
> +            }
> +
> +            $name    = $test->getName();
> +            $tickets = PHPUnit_Util_Test::getTickets(get_class($test), $name);
> +
> +            foreach ($tickets as $ticket) {
> +                $this->ticketCounts[$ticket][$name] = 1;
> +            }
> +
> +            $this->ran = TRUE;
> +        }
> +    }
> +
> +    /**
> +     * A test ended.
> +     *
> +     * @param  PHPUnit_Framework_Test $test
> +     * @param  float                  $time
> +     */
> +    public function endTest(PHPUnit_Framework_Test $test, $time)
> +    {
> +        if (!$test instanceof PHPUnit_Framework_Warning) {
> +            if ($test->getStatus() == PHPUnit_Runner_BaseTestRunner::STATUS_PASSED) {
> +                $ifStatus   = array('assigned', 'new', 'reopened');
> +                $newStatus  = 'closed';
> +                $message    = 'Automatically closed by PHPUnit (test passed).';
> +                $resolution = 'fixed';
> +                $cumulative = TRUE;
> +            }
> +
> +            else if ($test->getStatus() == PHPUnit_Runner_BaseTestRunner::STATUS_FAILURE) {
> +                $ifStatus   = array('closed');
> +                $newStatus  = 'reopened';
> +                $message    = 'Automatically reopened by PHPUnit (test failed).';
> +                $resolution = '';
> +                $cumulative = FALSE;
> +            }
> +
> +            else {
> +                return;
> +            }
> +
> +            $name    = $test->getName();
> +            $tickets = PHPUnit_Util_Test::getTickets(get_class($test), $name);
> +
> +            foreach ($tickets as $ticket) {
> +                // Remove this test from the totals (if it passed).
> +                if ($test->getStatus() == PHPUnit_Runner_BaseTestRunner::STATUS_PASSED) {
> +                    unset($this->ticketCounts[$ticket][$name]);
> +
>



-- 
Jon Phillips
http://rejon.org/
http://fabricatorz.com/
chat/skype: kidproto | irc: rejon
+1.415.830.3884 (sf/global)
+86.187.1003.9974 (china)
+65.8330.5807 (singapore)