first commit
This commit is contained in:
		
							
								
								
									
										9
									
								
								vendor/sebastian/recursion-context/.gitignore
									
									
									
									
										vendored
									
									
										Normal file
									
								
							
							
						
						
									
										9
									
								
								vendor/sebastian/recursion-context/.gitignore
									
									
									
									
										vendored
									
									
										Normal file
									
								
							@ -0,0 +1,9 @@
 | 
			
		||||
.idea
 | 
			
		||||
phpunit.xml
 | 
			
		||||
composer.lock
 | 
			
		||||
composer.phar
 | 
			
		||||
vendor/
 | 
			
		||||
cache.properties
 | 
			
		||||
build/LICENSE
 | 
			
		||||
build/README.md
 | 
			
		||||
build/*.tgz
 | 
			
		||||
							
								
								
									
										21
									
								
								vendor/sebastian/recursion-context/.travis.yml
									
									
									
									
										vendored
									
									
										Normal file
									
								
							
							
						
						
									
										21
									
								
								vendor/sebastian/recursion-context/.travis.yml
									
									
									
									
										vendored
									
									
										Normal file
									
								
							@ -0,0 +1,21 @@
 | 
			
		||||
language: php
 | 
			
		||||
 | 
			
		||||
php:
 | 
			
		||||
  - 5.3.3
 | 
			
		||||
  - 5.3
 | 
			
		||||
  - 5.4
 | 
			
		||||
  - 5.5
 | 
			
		||||
  - 5.6
 | 
			
		||||
  - hhvm
 | 
			
		||||
 | 
			
		||||
sudo: false
 | 
			
		||||
 | 
			
		||||
before_script:
 | 
			
		||||
  - composer self-update
 | 
			
		||||
  - composer install --no-interaction --prefer-source --dev
 | 
			
		||||
 | 
			
		||||
script: ./vendor/bin/phpunit
 | 
			
		||||
 | 
			
		||||
notifications:
 | 
			
		||||
  email: false
 | 
			
		||||
  irc: "irc.freenode.org#phpunit"
 | 
			
		||||
							
								
								
									
										33
									
								
								vendor/sebastian/recursion-context/LICENSE
									
									
									
									
										vendored
									
									
										Normal file
									
								
							
							
						
						
									
										33
									
								
								vendor/sebastian/recursion-context/LICENSE
									
									
									
									
										vendored
									
									
										Normal file
									
								
							@ -0,0 +1,33 @@
 | 
			
		||||
Recursion Context
 | 
			
		||||
 | 
			
		||||
Copyright (c) 2002-2015, Sebastian Bergmann <sebastian@phpunit.de>.
 | 
			
		||||
All rights reserved.
 | 
			
		||||
 | 
			
		||||
Redistribution and use in source and binary forms, with or without
 | 
			
		||||
modification, are permitted provided that the following conditions
 | 
			
		||||
are met:
 | 
			
		||||
 | 
			
		||||
 * Redistributions of source code must retain the above copyright
 | 
			
		||||
   notice, this list of conditions and the following disclaimer.
 | 
			
		||||
 | 
			
		||||
 * Redistributions in binary form must reproduce the above copyright
 | 
			
		||||
   notice, this list of conditions and the following disclaimer in
 | 
			
		||||
   the documentation and/or other materials provided with the
 | 
			
		||||
   distribution.
 | 
			
		||||
 | 
			
		||||
 * Neither the name of Sebastian Bergmann nor the names of his
 | 
			
		||||
   contributors may be used to endorse or promote products derived
 | 
			
		||||
   from this software without specific prior written permission.
 | 
			
		||||
 | 
			
		||||
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
 | 
			
		||||
"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
 | 
			
		||||
LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
 | 
			
		||||
FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
 | 
			
		||||
COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
 | 
			
		||||
INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
 | 
			
		||||
BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
 | 
			
		||||
LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
 | 
			
		||||
CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
 | 
			
		||||
LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
 | 
			
		||||
ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
 | 
			
		||||
POSSIBILITY OF SUCH DAMAGE.
 | 
			
		||||
							
								
								
									
										14
									
								
								vendor/sebastian/recursion-context/README.md
									
									
									
									
										vendored
									
									
										Normal file
									
								
							
							
						
						
									
										14
									
								
								vendor/sebastian/recursion-context/README.md
									
									
									
									
										vendored
									
									
										Normal file
									
								
							@ -0,0 +1,14 @@
 | 
			
		||||
# Recursion Context
 | 
			
		||||
 | 
			
		||||
...
 | 
			
		||||
 | 
			
		||||
## Installation
 | 
			
		||||
 | 
			
		||||
You can add this library as a local, per-project dependency to your project using [Composer](https://getcomposer.org/):
 | 
			
		||||
 | 
			
		||||
    composer require sebastian/recursion-context
 | 
			
		||||
 | 
			
		||||
If you only need this library during development, for instance to run your project's test suite, then you should add it as a development-time dependency:
 | 
			
		||||
 | 
			
		||||
    composer require --dev sebastian/recursion-context
 | 
			
		||||
 | 
			
		||||
							
								
								
									
										27
									
								
								vendor/sebastian/recursion-context/build.xml
									
									
									
									
										vendored
									
									
										Normal file
									
								
							
							
						
						
									
										27
									
								
								vendor/sebastian/recursion-context/build.xml
									
									
									
									
										vendored
									
									
										Normal file
									
								
							@ -0,0 +1,27 @@
 | 
			
		||||
<?xml version="1.0" encoding="UTF-8"?>
 | 
			
		||||
<project name="recursion-context">
 | 
			
		||||
 <target name="clean" description="Cleanup build artifacts">
 | 
			
		||||
  <delete dir="${basedir}/vendor"/>
 | 
			
		||||
  <delete file="${basedir}/composer.lock"/>
 | 
			
		||||
 </target>
 | 
			
		||||
 | 
			
		||||
 <target name="composer" depends="clean" description="Install dependencies with Composer">
 | 
			
		||||
  <tstamp>
 | 
			
		||||
   <format property="thirty.days.ago" pattern="MM/dd/yyyy hh:mm aa" offset="-30" unit="day"/>
 | 
			
		||||
  </tstamp>
 | 
			
		||||
  <delete>
 | 
			
		||||
   <fileset dir="${basedir}">
 | 
			
		||||
    <include name="composer.phar" />
 | 
			
		||||
    <date datetime="${thirty.days.ago}" when="before"/>
 | 
			
		||||
   </fileset>
 | 
			
		||||
  </delete>
 | 
			
		||||
 | 
			
		||||
  <get src="https://getcomposer.org/composer.phar" dest="${basedir}/composer.phar" skipexisting="true"/>
 | 
			
		||||
 | 
			
		||||
  <exec executable="php">
 | 
			
		||||
   <arg value="composer.phar"/>
 | 
			
		||||
   <arg value="install"/>
 | 
			
		||||
  </exec>
 | 
			
		||||
 </target>
 | 
			
		||||
</project>
 | 
			
		||||
 | 
			
		||||
							
								
								
									
										36
									
								
								vendor/sebastian/recursion-context/composer.json
									
									
									
									
										vendored
									
									
										Normal file
									
								
							
							
						
						
									
										36
									
								
								vendor/sebastian/recursion-context/composer.json
									
									
									
									
										vendored
									
									
										Normal file
									
								
							@ -0,0 +1,36 @@
 | 
			
		||||
{
 | 
			
		||||
    "name": "sebastian/recursion-context",
 | 
			
		||||
    "description": "Provides functionality to recursively process PHP variables",
 | 
			
		||||
    "homepage": "http://www.github.com/sebastianbergmann/recursion-context",
 | 
			
		||||
    "license": "BSD-3-Clause",
 | 
			
		||||
    "authors": [
 | 
			
		||||
        {
 | 
			
		||||
            "name": "Sebastian Bergmann",
 | 
			
		||||
            "email": "sebastian@phpunit.de"
 | 
			
		||||
        },
 | 
			
		||||
        {
 | 
			
		||||
            "name": "Jeff Welch",
 | 
			
		||||
            "email": "whatthejeff@gmail.com"
 | 
			
		||||
        },
 | 
			
		||||
        {
 | 
			
		||||
            "name": "Adam Harvey",
 | 
			
		||||
            "email": "aharvey@php.net"
 | 
			
		||||
        }
 | 
			
		||||
    ],
 | 
			
		||||
    "require": {
 | 
			
		||||
        "php": ">=5.3.3"
 | 
			
		||||
    },
 | 
			
		||||
    "require-dev": {
 | 
			
		||||
        "phpunit/phpunit": "~4.4"
 | 
			
		||||
    },
 | 
			
		||||
    "autoload": {
 | 
			
		||||
        "classmap": [
 | 
			
		||||
            "src/"
 | 
			
		||||
        ]
 | 
			
		||||
    },
 | 
			
		||||
    "extra": {
 | 
			
		||||
        "branch-alias": {
 | 
			
		||||
            "dev-master": "2.0.x-dev"
 | 
			
		||||
        }
 | 
			
		||||
    }
 | 
			
		||||
}
 | 
			
		||||
							
								
								
									
										20
									
								
								vendor/sebastian/recursion-context/phpunit.xml.dist
									
									
									
									
										vendored
									
									
										Normal file
									
								
							
							
						
						
									
										20
									
								
								vendor/sebastian/recursion-context/phpunit.xml.dist
									
									
									
									
										vendored
									
									
										Normal file
									
								
							@ -0,0 +1,20 @@
 | 
			
		||||
<?xml version="1.0" encoding="UTF-8"?>
 | 
			
		||||
<phpunit backupGlobals="false"
 | 
			
		||||
         bootstrap="vendor/autoload.php"
 | 
			
		||||
         beStrictAboutTestsThatDoNotTestAnything="true"
 | 
			
		||||
         beStrictAboutOutputDuringTests="true"
 | 
			
		||||
         beStrictAboutTodoAnnotatedTests="true"
 | 
			
		||||
         checkForUnintentionallyCoveredCode="true"
 | 
			
		||||
         forceCoversAnnotation="true"
 | 
			
		||||
         verbose="true">
 | 
			
		||||
<testsuites>
 | 
			
		||||
  <testsuite name="recursion-context">
 | 
			
		||||
   <directory>tests</directory>
 | 
			
		||||
  </testsuite>
 | 
			
		||||
 </testsuites>
 | 
			
		||||
 <filter>
 | 
			
		||||
  <whitelist addUncoveredFilesFromWhitelist="true" processUncoveredFilesFromWhitelist="true">
 | 
			
		||||
   <directory>src</directory>
 | 
			
		||||
  </whitelist>
 | 
			
		||||
 </filter>
 | 
			
		||||
</phpunit>
 | 
			
		||||
							
								
								
									
										167
									
								
								vendor/sebastian/recursion-context/src/Context.php
									
									
									
									
										vendored
									
									
										Normal file
									
								
							
							
						
						
									
										167
									
								
								vendor/sebastian/recursion-context/src/Context.php
									
									
									
									
										vendored
									
									
										Normal file
									
								
							@ -0,0 +1,167 @@
 | 
			
		||||
<?php
 | 
			
		||||
/*
 | 
			
		||||
 * This file is part of the Recursion Context package.
 | 
			
		||||
 *
 | 
			
		||||
 * (c) Sebastian Bergmann <sebastian@phpunit.de>
 | 
			
		||||
 *
 | 
			
		||||
 * For the full copyright and license information, please view the LICENSE
 | 
			
		||||
 * file that was distributed with this source code.
 | 
			
		||||
 */
 | 
			
		||||
 | 
			
		||||
namespace SebastianBergmann\RecursionContext;
 | 
			
		||||
 | 
			
		||||
/**
 | 
			
		||||
 * A context containing previously processed arrays and objects
 | 
			
		||||
 * when recursively processing a value.
 | 
			
		||||
 */
 | 
			
		||||
final class Context
 | 
			
		||||
{
 | 
			
		||||
    /**
 | 
			
		||||
     * @var array[]
 | 
			
		||||
     */
 | 
			
		||||
    private $arrays;
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
     * @var \SplObjectStorage
 | 
			
		||||
     */
 | 
			
		||||
    private $objects;
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
     * Initialises the context
 | 
			
		||||
     */
 | 
			
		||||
    public function __construct()
 | 
			
		||||
    {
 | 
			
		||||
        $this->arrays  = array();
 | 
			
		||||
        $this->objects = new \SplObjectStorage;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
     * Adds a value to the context.
 | 
			
		||||
     *
 | 
			
		||||
     * @param array|object $value The value to add.
 | 
			
		||||
     *
 | 
			
		||||
     * @return int|string The ID of the stored value, either as a string or integer.
 | 
			
		||||
     *
 | 
			
		||||
     * @throws InvalidArgumentException Thrown if $value is not an array or object
 | 
			
		||||
     */
 | 
			
		||||
    public function add(&$value)
 | 
			
		||||
    {
 | 
			
		||||
        if (is_array($value)) {
 | 
			
		||||
            return $this->addArray($value);
 | 
			
		||||
        } elseif (is_object($value)) {
 | 
			
		||||
            return $this->addObject($value);
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        throw new InvalidArgumentException(
 | 
			
		||||
            'Only arrays and objects are supported'
 | 
			
		||||
        );
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
     * Checks if the given value exists within the context.
 | 
			
		||||
     *
 | 
			
		||||
     * @param array|object $value The value to check.
 | 
			
		||||
     *
 | 
			
		||||
     * @return int|string|false The string or integer ID of the stored value if it has already been seen, or false if the value is not stored.
 | 
			
		||||
     *
 | 
			
		||||
     * @throws InvalidArgumentException Thrown if $value is not an array or object
 | 
			
		||||
     */
 | 
			
		||||
    public function contains(&$value)
 | 
			
		||||
    {
 | 
			
		||||
        if (is_array($value)) {
 | 
			
		||||
            return $this->containsArray($value);
 | 
			
		||||
        } elseif (is_object($value)) {
 | 
			
		||||
            return $this->containsObject($value);
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        throw new InvalidArgumentException(
 | 
			
		||||
            'Only arrays and objects are supported'
 | 
			
		||||
        );
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
     * @param array $array
 | 
			
		||||
     *
 | 
			
		||||
     * @return bool|int
 | 
			
		||||
     */
 | 
			
		||||
    private function addArray(array &$array)
 | 
			
		||||
    {
 | 
			
		||||
        $key = $this->containsArray($array);
 | 
			
		||||
 | 
			
		||||
        if ($key !== false) {
 | 
			
		||||
            return $key;
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        $key            = count($this->arrays);
 | 
			
		||||
        $this->arrays[] = &$array;
 | 
			
		||||
 | 
			
		||||
        if (!isset($array[PHP_INT_MAX]) && !isset($array[PHP_INT_MAX - 1])) {
 | 
			
		||||
            $array[] = $key;
 | 
			
		||||
            $array[] = $this->objects;
 | 
			
		||||
        } else { /* cover the improbable case too */
 | 
			
		||||
            do {
 | 
			
		||||
                $key = random_int(PHP_INT_MIN, PHP_INT_MAX);
 | 
			
		||||
            } while (isset($array[$key]));
 | 
			
		||||
 | 
			
		||||
            $array[$key] = $key;
 | 
			
		||||
 | 
			
		||||
            do {
 | 
			
		||||
                $key = random_int(PHP_INT_MIN, PHP_INT_MAX);
 | 
			
		||||
            } while (isset($array[$key]));
 | 
			
		||||
 | 
			
		||||
            $array[$key] = $this->objects;
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        return $key;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
     * @param object $object
 | 
			
		||||
     *
 | 
			
		||||
     * @return string
 | 
			
		||||
     */
 | 
			
		||||
    private function addObject($object)
 | 
			
		||||
    {
 | 
			
		||||
        if (!$this->objects->contains($object)) {
 | 
			
		||||
            $this->objects->attach($object);
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        return spl_object_hash($object);
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
     * @param array $array
 | 
			
		||||
     *
 | 
			
		||||
     * @return int|false
 | 
			
		||||
     */
 | 
			
		||||
    private function containsArray(array &$array)
 | 
			
		||||
    {
 | 
			
		||||
        $end = array_slice($array, -2);
 | 
			
		||||
 | 
			
		||||
        return isset($end[1]) && $end[1] === $this->objects ? $end[0] : false;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
     * @param object $value
 | 
			
		||||
     *
 | 
			
		||||
     * @return string|false
 | 
			
		||||
     */
 | 
			
		||||
    private function containsObject($value)
 | 
			
		||||
    {
 | 
			
		||||
        if ($this->objects->contains($value)) {
 | 
			
		||||
            return spl_object_hash($value);
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        return false;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    public function __destruct()
 | 
			
		||||
    {
 | 
			
		||||
        foreach ($this->arrays as &$array) {
 | 
			
		||||
            if (is_array($array)) {
 | 
			
		||||
                array_pop($array);
 | 
			
		||||
                array_pop($array);
 | 
			
		||||
            }
 | 
			
		||||
        }
 | 
			
		||||
    }
 | 
			
		||||
}
 | 
			
		||||
							
								
								
									
										17
									
								
								vendor/sebastian/recursion-context/src/Exception.php
									
									
									
									
										vendored
									
									
										Normal file
									
								
							
							
						
						
									
										17
									
								
								vendor/sebastian/recursion-context/src/Exception.php
									
									
									
									
										vendored
									
									
										Normal file
									
								
							@ -0,0 +1,17 @@
 | 
			
		||||
<?php
 | 
			
		||||
/*
 | 
			
		||||
 * This file is part of the Recursion Context package.
 | 
			
		||||
 *
 | 
			
		||||
 * (c) Sebastian Bergmann <sebastian@phpunit.de>
 | 
			
		||||
 *
 | 
			
		||||
 * For the full copyright and license information, please view the LICENSE
 | 
			
		||||
 * file that was distributed with this source code.
 | 
			
		||||
 */
 | 
			
		||||
 | 
			
		||||
namespace SebastianBergmann\RecursionContext;
 | 
			
		||||
 | 
			
		||||
/**
 | 
			
		||||
 */
 | 
			
		||||
interface Exception
 | 
			
		||||
{
 | 
			
		||||
}
 | 
			
		||||
							
								
								
									
										17
									
								
								vendor/sebastian/recursion-context/src/InvalidArgumentException.php
									
									
									
									
										vendored
									
									
										Normal file
									
								
							
							
						
						
									
										17
									
								
								vendor/sebastian/recursion-context/src/InvalidArgumentException.php
									
									
									
									
										vendored
									
									
										Normal file
									
								
							@ -0,0 +1,17 @@
 | 
			
		||||
<?php
 | 
			
		||||
/*
 | 
			
		||||
 * This file is part of the Recursion Context package.
 | 
			
		||||
 *
 | 
			
		||||
 * (c) Sebastian Bergmann <sebastian@phpunit.de>
 | 
			
		||||
 *
 | 
			
		||||
 * For the full copyright and license information, please view the LICENSE
 | 
			
		||||
 * file that was distributed with this source code.
 | 
			
		||||
 */
 | 
			
		||||
 | 
			
		||||
namespace SebastianBergmann\RecursionContext;
 | 
			
		||||
 | 
			
		||||
/**
 | 
			
		||||
 */
 | 
			
		||||
final class InvalidArgumentException extends \InvalidArgumentException implements Exception
 | 
			
		||||
{
 | 
			
		||||
}
 | 
			
		||||
							
								
								
									
										144
									
								
								vendor/sebastian/recursion-context/tests/ContextTest.php
									
									
									
									
										vendored
									
									
										Normal file
									
								
							
							
						
						
									
										144
									
								
								vendor/sebastian/recursion-context/tests/ContextTest.php
									
									
									
									
										vendored
									
									
										Normal file
									
								
							@ -0,0 +1,144 @@
 | 
			
		||||
<?php
 | 
			
		||||
/*
 | 
			
		||||
 * This file is part of the Recursion Context package.
 | 
			
		||||
 *
 | 
			
		||||
 * (c) Sebastian Bergmann <sebastian@phpunit.de>
 | 
			
		||||
 *
 | 
			
		||||
 * For the full copyright and license information, please view the LICENSE
 | 
			
		||||
 * file that was distributed with this source code.
 | 
			
		||||
 */
 | 
			
		||||
 | 
			
		||||
namespace SebastianBergmann\RecursionContext;
 | 
			
		||||
 | 
			
		||||
use PHPUnit_Framework_TestCase;
 | 
			
		||||
 | 
			
		||||
/**
 | 
			
		||||
 * @covers SebastianBergmann\RecursionContext\Context
 | 
			
		||||
 */
 | 
			
		||||
class ContextTest extends PHPUnit_Framework_TestCase
 | 
			
		||||
{
 | 
			
		||||
    /**
 | 
			
		||||
     * @var \SebastianBergmann\RecursionContext\Context
 | 
			
		||||
     */
 | 
			
		||||
    private $context;
 | 
			
		||||
 | 
			
		||||
    protected function setUp()
 | 
			
		||||
    {
 | 
			
		||||
        $this->context = new Context();
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    public function failsProvider()
 | 
			
		||||
    {
 | 
			
		||||
        return array(
 | 
			
		||||
            array(true),
 | 
			
		||||
            array(false),
 | 
			
		||||
            array(null),
 | 
			
		||||
            array('string'),
 | 
			
		||||
            array(1),
 | 
			
		||||
            array(1.5),
 | 
			
		||||
            array(fopen('php://memory', 'r'))
 | 
			
		||||
        );
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    public function valuesProvider()
 | 
			
		||||
    {
 | 
			
		||||
        $obj2      = new \stdClass();
 | 
			
		||||
        $obj2->foo = 'bar';
 | 
			
		||||
 | 
			
		||||
        $obj3 = (object) array(1,2,"Test\r\n",4,5,6,7,8);
 | 
			
		||||
 | 
			
		||||
        $obj = new \stdClass();
 | 
			
		||||
        //@codingStandardsIgnoreStart
 | 
			
		||||
        $obj->null = null;
 | 
			
		||||
        //@codingStandardsIgnoreEnd
 | 
			
		||||
        $obj->boolean     = true;
 | 
			
		||||
        $obj->integer     = 1;
 | 
			
		||||
        $obj->double      = 1.2;
 | 
			
		||||
        $obj->string      = '1';
 | 
			
		||||
        $obj->text        = "this\nis\na\nvery\nvery\nvery\nvery\nvery\nvery\rlong\n\rtext";
 | 
			
		||||
        $obj->object      = $obj2;
 | 
			
		||||
        $obj->objectagain = $obj2;
 | 
			
		||||
        $obj->array       = array('foo' => 'bar');
 | 
			
		||||
        $obj->array2      = array(1,2,3,4,5,6);
 | 
			
		||||
        $obj->array3      = array($obj, $obj2, $obj3);
 | 
			
		||||
        $obj->self        = $obj;
 | 
			
		||||
 | 
			
		||||
        $storage = new \SplObjectStorage();
 | 
			
		||||
        $storage->attach($obj2);
 | 
			
		||||
        $storage->foo = $obj2;
 | 
			
		||||
 | 
			
		||||
        return array(
 | 
			
		||||
            array($obj, spl_object_hash($obj)),
 | 
			
		||||
            array($obj2, spl_object_hash($obj2)),
 | 
			
		||||
            array($obj3, spl_object_hash($obj3)),
 | 
			
		||||
            array($storage, spl_object_hash($storage)),
 | 
			
		||||
            array($obj->array, 0),
 | 
			
		||||
            array($obj->array2, 0),
 | 
			
		||||
            array($obj->array3, 0)
 | 
			
		||||
        );
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
     * @covers       SebastianBergmann\RecursionContext\Context::add
 | 
			
		||||
     * @uses         SebastianBergmann\RecursionContext\InvalidArgumentException
 | 
			
		||||
     * @dataProvider failsProvider
 | 
			
		||||
     */
 | 
			
		||||
    public function testAddFails($value)
 | 
			
		||||
    {
 | 
			
		||||
        $this->setExpectedException(
 | 
			
		||||
          'SebastianBergmann\\RecursionContext\\Exception',
 | 
			
		||||
          'Only arrays and objects are supported'
 | 
			
		||||
        );
 | 
			
		||||
        $this->context->add($value);
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
     * @covers       SebastianBergmann\RecursionContext\Context::contains
 | 
			
		||||
     * @uses         SebastianBergmann\RecursionContext\InvalidArgumentException
 | 
			
		||||
     * @dataProvider failsProvider
 | 
			
		||||
     */
 | 
			
		||||
    public function testContainsFails($value)
 | 
			
		||||
    {
 | 
			
		||||
        $this->setExpectedException(
 | 
			
		||||
          'SebastianBergmann\\RecursionContext\\Exception',
 | 
			
		||||
          'Only arrays and objects are supported'
 | 
			
		||||
        );
 | 
			
		||||
        $this->context->contains($value);
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
     * @covers       SebastianBergmann\RecursionContext\Context::add
 | 
			
		||||
     * @dataProvider valuesProvider
 | 
			
		||||
     */
 | 
			
		||||
    public function testAdd($value, $key)
 | 
			
		||||
    {
 | 
			
		||||
        $this->assertEquals($key, $this->context->add($value));
 | 
			
		||||
 | 
			
		||||
        // Test we get the same key on subsequent adds
 | 
			
		||||
        $this->assertEquals($key, $this->context->add($value));
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
     * @covers       SebastianBergmann\RecursionContext\Context::contains
 | 
			
		||||
     * @uses         SebastianBergmann\RecursionContext\Context::add
 | 
			
		||||
     * @depends      testAdd
 | 
			
		||||
     * @dataProvider valuesProvider
 | 
			
		||||
     */
 | 
			
		||||
    public function testContainsFound($value, $key)
 | 
			
		||||
    {
 | 
			
		||||
        $this->context->add($value);
 | 
			
		||||
        $this->assertEquals($key, $this->context->contains($value));
 | 
			
		||||
 | 
			
		||||
        // Test we get the same key on subsequent calls
 | 
			
		||||
        $this->assertEquals($key, $this->context->contains($value));
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
     * @covers       SebastianBergmann\RecursionContext\Context::contains
 | 
			
		||||
     * @dataProvider valuesProvider
 | 
			
		||||
     */
 | 
			
		||||
    public function testContainsNotFound($value)
 | 
			
		||||
    {
 | 
			
		||||
        $this->assertFalse($this->context->contains($value));
 | 
			
		||||
    }
 | 
			
		||||
}
 | 
			
		||||
		Reference in New Issue
	
	Block a user