You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@shindig.apache.org by ch...@apache.org on 2008/08/02 16:11:44 UTC
svn commit: r681982 [7/27] - in /incubator/shindig/trunk/php: external/
external/PHPUnit/ external/PHPUnit/Extensions/
external/PHPUnit/Extensions/Database/
external/PHPUnit/Extensions/Database/Constraint/
external/PHPUnit/Extensions/Database/DB/ exter...
Added: incubator/shindig/trunk/php/external/PHPUnit/Framework/ComparisonFailure/Type.php
URL: http://svn.apache.org/viewvc/incubator/shindig/trunk/php/external/PHPUnit/Framework/ComparisonFailure/Type.php?rev=681982&view=auto
==============================================================================
--- incubator/shindig/trunk/php/external/PHPUnit/Framework/ComparisonFailure/Type.php (added)
+++ incubator/shindig/trunk/php/external/PHPUnit/Framework/ComparisonFailure/Type.php Sat Aug 2 07:11:35 2008
@@ -0,0 +1,82 @@
+<?php
+/**
+ * PHPUnit
+ *
+ * Copyright (c) 2002-2008, Sebastian Bergmann <sb...@sebastian-bergmann.de>.
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * * Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ *
+ * * Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in
+ * the documentation and/or other materials provided with the
+ * distribution.
+ *
+ * * Neither the name of Sebastian Bergmann nor the names of his
+ * contributors may be used to endorse or promote products derived
+ * from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+ * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+ * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+ * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+ * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
+ * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+ * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ *
+ * @category Testing
+ * @package PHPUnit
+ * @author Jan Borsodi <jb...@ez.no>
+ * @author Sebastian Bergmann <sb...@sebastian-bergmann.de>
+ * @copyright 2002-2008 Sebastian Bergmann <sb...@sebastian-bergmann.de>
+ * @license http://www.opensource.org/licenses/bsd-license.php BSD License
+ * @version SVN: $Id: Type.php 1985 2007-12-26 18:11:55Z sb $
+ * @link http://www.phpunit.de/
+ * @since File available since Release 3.0.0
+ */
+
+require_once 'PHPUnit/Framework.php';
+require_once 'PHPUnit/Util/Filter.php';
+
+PHPUnit_Util_Filter::addFileToFilter(__FILE__, 'PHPUNIT');
+
+/**
+ * Thrown when an assertion for type equality failed.
+ *
+ * @category Testing
+ * @package PHPUnit
+ * @author Jan Borsodi <jb...@ez.no>
+ * @author Sebastian Bergmann <sb...@sebastian-bergmann.de>
+ * @copyright 2002-2008 Sebastian Bergmann <sb...@sebastian-bergmann.de>
+ * @license http://www.opensource.org/licenses/bsd-license.php BSD License
+ * @version Release: 3.2.9
+ * @link http://www.phpunit.de/
+ * @since Class available since Release 3.0.0
+ */
+class PHPUnit_Framework_ComparisonFailure_Type extends PHPUnit_Framework_ComparisonFailure
+{
+ /**
+ * Returns a string describing the type difference between the expected
+ * and the actual value.
+ */
+ public function toString()
+ {
+ return sprintf(
+ '%s does not match expected type "%s".',
+
+ PHPUnit_Util_Type::toString($this->actual),
+ gettype($this->expected)
+ );
+ }
+}
+?>
Added: incubator/shindig/trunk/php/external/PHPUnit/Framework/Constraint.php
URL: http://svn.apache.org/viewvc/incubator/shindig/trunk/php/external/PHPUnit/Framework/Constraint.php?rev=681982&view=auto
==============================================================================
--- incubator/shindig/trunk/php/external/PHPUnit/Framework/Constraint.php (added)
+++ incubator/shindig/trunk/php/external/PHPUnit/Framework/Constraint.php Sat Aug 2 07:11:35 2008
@@ -0,0 +1,164 @@
+<?php
+/**
+ * PHPUnit
+ *
+ * Copyright (c) 2002-2008, Sebastian Bergmann <sb...@sebastian-bergmann.de>.
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * * Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ *
+ * * Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in
+ * the documentation and/or other materials provided with the
+ * distribution.
+ *
+ * * Neither the name of Sebastian Bergmann nor the names of his
+ * contributors may be used to endorse or promote products derived
+ * from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+ * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+ * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+ * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+ * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
+ * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+ * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ *
+ * @category Testing
+ * @package PHPUnit
+ * @author Jan Borsodi <jb...@ez.no>
+ * @author Sebastian Bergmann <sb...@sebastian-bergmann.de>
+ * @copyright 2002-2008 Sebastian Bergmann <sb...@sebastian-bergmann.de>
+ * @license http://www.opensource.org/licenses/bsd-license.php BSD License
+ * @version SVN: $Id: Constraint.php 1985 2007-12-26 18:11:55Z sb $
+ * @link http://www.phpunit.de/
+ * @since File available since Release 3.0.0
+ */
+
+require_once 'PHPUnit/Framework.php';
+require_once 'PHPUnit/Util/Filter.php';
+
+PHPUnit_Util_Filter::addFileToFilter(__FILE__, 'PHPUNIT');
+
+if (!class_exists('PHPUnit_Framework_Constraint', FALSE)) {
+
+/**
+ * Abstract base class for constraints. which are placed upon any value.
+ *
+ * @category Testing
+ * @package PHPUnit
+ * @author Jan Borsodi <jb...@ez.no>
+ * @author Sebastian Bergmann <sb...@sebastian-bergmann.de>
+ * @copyright 2002-2008 Sebastian Bergmann <sb...@sebastian-bergmann.de>
+ * @license http://www.opensource.org/licenses/bsd-license.php BSD License
+ * @version Release: 3.2.9
+ * @link http://www.phpunit.de/
+ * @since Interface available since Release 3.0.0
+ */
+abstract class PHPUnit_Framework_Constraint implements PHPUnit_Framework_SelfDescribing
+{
+ /**
+ * Evaluates the constraint for parameter $other. Returns TRUE if the
+ * constraint is met, FALSE otherwise.
+ *
+ * @param mixed $other Value or object to evaluate.
+ * @return bool
+ * @abstract
+ */
+ abstract public function evaluate($other);
+
+ /**
+ * Creates the appropriate exception for the constraint which can be caught
+ * by the unit test system. This can be called if a call to evaluate() fails.
+ *
+ * @param mixed $other The value passed to evaluate() which failed the
+ * constraint check.
+ * @param string $description A string with extra description of what was
+ * going on while the evaluation failed.
+ * @param boolean $not Flag to indicate negation.
+ * @throws PHPUnit_Framework_ExpectationFailedException
+ */
+ public function fail($other, $description, $not = FALSE)
+ {
+ throw new PHPUnit_Framework_ExpectationFailedException(
+ $this->failureDescription($other, $description, $not),
+ NULL
+ );
+ }
+
+ protected function failureDescription($other, $description, $not)
+ {
+ $failureDescription = sprintf(
+ 'Failed asserting that %s %s.',
+
+ PHPUnit_Util_Type::toString($other),
+ $this->toString()
+ );
+
+ if ($not) {
+ $failureDescription = self::negate($failureDescription);
+ }
+
+ if (!empty($description)) {
+ $failureDescription = $description . "\n" . $failureDescription;
+ }
+
+ return $failureDescription;
+ }
+
+ public static function negate($string)
+ {
+ return str_replace(
+ array(
+ 'contains ',
+ 'exists',
+ 'has ',
+ 'is ',
+ 'matches '
+ ),
+ array(
+ 'does not contain ',
+ 'does not exist',
+ 'does not have ',
+ 'is not ',
+ 'does not match '
+ ),
+ $string
+ );
+ }
+}
+
+}
+
+require_once 'PHPUnit/Framework/Constraint/And.php';
+require_once 'PHPUnit/Framework/Constraint/ArrayHasKey.php';
+require_once 'PHPUnit/Framework/Constraint/Attribute.php';
+require_once 'PHPUnit/Framework/Constraint/ClassHasAttribute.php';
+require_once 'PHPUnit/Framework/Constraint/ClassHasStaticAttribute.php';
+require_once 'PHPUnit/Framework/Constraint/FileExists.php';
+require_once 'PHPUnit/Framework/Constraint/GreaterThan.php';
+require_once 'PHPUnit/Framework/Constraint/IsAnything.php';
+require_once 'PHPUnit/Framework/Constraint/IsEqual.php';
+require_once 'PHPUnit/Framework/Constraint/IsIdentical.php';
+require_once 'PHPUnit/Framework/Constraint/IsInstanceOf.php';
+require_once 'PHPUnit/Framework/Constraint/IsType.php';
+require_once 'PHPUnit/Framework/Constraint/LessThan.php';
+require_once 'PHPUnit/Framework/Constraint/Not.php';
+require_once 'PHPUnit/Framework/Constraint/ObjectHasAttribute.php';
+require_once 'PHPUnit/Framework/Constraint/Or.php';
+require_once 'PHPUnit/Framework/Constraint/PCREMatch.php';
+require_once 'PHPUnit/Framework/Constraint/StringContains.php';
+require_once 'PHPUnit/Framework/Constraint/TraversableContains.php';
+require_once 'PHPUnit/Framework/Constraint/TraversableContainsOnly.php';
+require_once 'PHPUnit/Framework/Constraint/Xor.php';
+?>
Added: incubator/shindig/trunk/php/external/PHPUnit/Framework/Constraint/And.php
URL: http://svn.apache.org/viewvc/incubator/shindig/trunk/php/external/PHPUnit/Framework/Constraint/And.php?rev=681982&view=auto
==============================================================================
--- incubator/shindig/trunk/php/external/PHPUnit/Framework/Constraint/And.php (added)
+++ incubator/shindig/trunk/php/external/PHPUnit/Framework/Constraint/And.php Sat Aug 2 07:11:35 2008
@@ -0,0 +1,142 @@
+<?php
+/**
+ * PHPUnit
+ *
+ * Copyright (c) 2002-2008, Sebastian Bergmann <sb...@sebastian-bergmann.de>.
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * * Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ *
+ * * Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in
+ * the documentation and/or other materials provided with the
+ * distribution.
+ *
+ * * Neither the name of Sebastian Bergmann nor the names of his
+ * contributors may be used to endorse or promote products derived
+ * from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+ * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+ * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+ * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+ * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
+ * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+ * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ *
+ * @category Testing
+ * @package PHPUnit
+ * @author Jan Borsodi <jb...@ez.no>
+ * @author Sebastian Bergmann <sb...@sebastian-bergmann.de>
+ * @copyright 2002-2008 Sebastian Bergmann <sb...@sebastian-bergmann.de>
+ * @license http://www.opensource.org/licenses/bsd-license.php BSD License
+ * @version SVN: $Id: And.php 1985 2007-12-26 18:11:55Z sb $
+ * @link http://www.phpunit.de/
+ * @since File available since Release 3.0.0
+ */
+
+require_once 'PHPUnit/Framework.php';
+require_once 'PHPUnit/Util/Filter.php';
+require_once 'PHPUnit/Util/Type.php';
+
+PHPUnit_Util_Filter::addFileToFilter(__FILE__, 'PHPUNIT');
+
+/**
+ * Logical AND.
+ *
+ * @category Testing
+ * @package PHPUnit
+ * @author Jan Borsodi <jb...@ez.no>
+ * @author Sebastian Bergmann <sb...@sebastian-bergmann.de>
+ * @copyright 2002-2008 Sebastian Bergmann <sb...@sebastian-bergmann.de>
+ * @license http://www.opensource.org/licenses/bsd-license.php BSD License
+ * @version Release: 3.2.9
+ * @link http://www.phpunit.de/
+ * @since Class available since Release 3.0.0
+ */
+class PHPUnit_Framework_Constraint_And extends PHPUnit_Framework_Constraint
+{
+ protected $constraints = array();
+
+ protected $lastConstraint = NULL;
+
+ public function setConstraints(array $constraints)
+ {
+ $this->constraints = array();
+
+ foreach($constraints as $key => $constraint) {
+ if (!($constraint instanceof PHPUnit_Framework_Constraint)) {
+ throw new InvalidArgumentException('All parameters to ' . __CLASS__ . ' must be a constraint object.');
+ }
+
+ $this->constraints[] = $constraint;
+ }
+ }
+
+ /**
+ * Evaluates the constraint for parameter $other. Returns TRUE if the
+ * constraint is met, FALSE otherwise.
+ *
+ * @param mixed $other Value or object to evaluate.
+ * @return bool
+ */
+ public function evaluate($other)
+ {
+ $this->lastConstraint = NULL;
+
+ foreach($this->constraints as $constraint) {
+ $this->lastConstraint = $constraint;
+
+ if (!$constraint->evaluate($other)) {
+ return FALSE;
+ }
+ }
+
+ return TRUE;
+ }
+
+ /**
+ * @param mixed $other The value passed to evaluate() which failed the
+ * constraint check.
+ * @param string $description A string with extra description of what was
+ * going on while the evaluation failed.
+ * @param boolean $not Flag to indicate negation.
+ * @throws PHPUnit_Framework_ExpectationFailedException
+ */
+ public function fail($other, $description, $not = FALSE)
+ {
+ $this->lastConstraint->fail($other, $description, $not);
+ }
+
+ /**
+ * Returns a string representation of the constraint.
+ *
+ * @return string
+ * @access public
+ */
+ public function toString()
+ {
+ $text = '';
+
+ foreach($this->constraints as $key => $constraint) {
+ if ($key > 0) {
+ $text .= ' and ';
+ }
+
+ $text .= $constraint->toString();
+ }
+
+ return $text;
+ }
+}
+?>
Added: incubator/shindig/trunk/php/external/PHPUnit/Framework/Constraint/ArrayHasKey.php
URL: http://svn.apache.org/viewvc/incubator/shindig/trunk/php/external/PHPUnit/Framework/Constraint/ArrayHasKey.php?rev=681982&view=auto
==============================================================================
--- incubator/shindig/trunk/php/external/PHPUnit/Framework/Constraint/ArrayHasKey.php (added)
+++ incubator/shindig/trunk/php/external/PHPUnit/Framework/Constraint/ArrayHasKey.php Sat Aug 2 07:11:35 2008
@@ -0,0 +1,104 @@
+<?php
+/**
+ * PHPUnit
+ *
+ * Copyright (c) 2002-2008, Sebastian Bergmann <sb...@sebastian-bergmann.de>.
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * * Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ *
+ * * Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in
+ * the documentation and/or other materials provided with the
+ * distribution.
+ *
+ * * Neither the name of Sebastian Bergmann nor the names of his
+ * contributors may be used to endorse or promote products derived
+ * from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+ * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+ * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+ * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+ * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
+ * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+ * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ *
+ * @category Testing
+ * @package PHPUnit
+ * @author Jan Borsodi <jb...@ez.no>
+ * @author Sebastian Bergmann <sb...@sebastian-bergmann.de>
+ * @copyright 2002-2008 Sebastian Bergmann <sb...@sebastian-bergmann.de>
+ * @license http://www.opensource.org/licenses/bsd-license.php BSD License
+ * @version SVN: $Id: ArrayHasKey.php 1985 2007-12-26 18:11:55Z sb $
+ * @link http://www.phpunit.de/
+ * @since File available since Release 3.0.0
+ */
+
+require_once 'PHPUnit/Framework.php';
+require_once 'PHPUnit/Util/Filter.php';
+require_once 'PHPUnit/Util/Type.php';
+
+PHPUnit_Util_Filter::addFileToFilter(__FILE__, 'PHPUNIT');
+
+/**
+ * Constraint that asserts that the array it is evaluated for has a given key.
+ *
+ * Uses array_key_exists() to check if the key is found in the input array, if not
+ * found the evaluaton fails.
+ *
+ * The array key is passed in the constructor.
+ *
+ * @category Testing
+ * @package PHPUnit
+ * @author Jan Borsodi <jb...@ez.no>
+ * @author Sebastian Bergmann <sb...@sebastian-bergmann.de>
+ * @copyright 2002-2008 Sebastian Bergmann <sb...@sebastian-bergmann.de>
+ * @license http://www.opensource.org/licenses/bsd-license.php BSD License
+ * @version Release: 3.2.9
+ * @link http://www.phpunit.de/
+ * @since Class available since Release 3.0.0
+ */
+class PHPUnit_Framework_Constraint_ArrayHasKey extends PHPUnit_Framework_Constraint
+{
+ protected $key;
+
+ public function __construct($key)
+ {
+ $this->key = $key;
+ }
+
+ /**
+ * Evaluates the constraint for parameter $other. Returns TRUE if the
+ * constraint is met, FALSE otherwise.
+ *
+ * @param mixed $other Value or object to evaluate.
+ * @return bool
+ */
+ public function evaluate($other)
+ {
+ return array_key_exists($this->key, $other);
+ }
+
+ /**
+ * Returns a string representation of the constraint.
+ *
+ * @return string
+ * @access public
+ */
+ public function toString()
+ {
+ return 'has key ' . PHPUnit_Util_Type::toString($this->key);
+ }
+}
+?>
Added: incubator/shindig/trunk/php/external/PHPUnit/Framework/Constraint/Attribute.php
URL: http://svn.apache.org/viewvc/incubator/shindig/trunk/php/external/PHPUnit/Framework/Constraint/Attribute.php?rev=681982&view=auto
==============================================================================
--- incubator/shindig/trunk/php/external/PHPUnit/Framework/Constraint/Attribute.php (added)
+++ incubator/shindig/trunk/php/external/PHPUnit/Framework/Constraint/Attribute.php Sat Aug 2 07:11:35 2008
@@ -0,0 +1,122 @@
+<?php
+/**
+ * PHPUnit
+ *
+ * Copyright (c) 2002-2008, Sebastian Bergmann <sb...@sebastian-bergmann.de>.
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * * Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ *
+ * * Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in
+ * the documentation and/or other materials provided with the
+ * distribution.
+ *
+ * * Neither the name of Sebastian Bergmann nor the names of his
+ * contributors may be used to endorse or promote products derived
+ * from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+ * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+ * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+ * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+ * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
+ * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+ * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ *
+ * @category Testing
+ * @package PHPUnit
+ * @author Sebastian Bergmann <sb...@sebastian-bergmann.de>
+ * @copyright 2002-2008 Sebastian Bergmann <sb...@sebastian-bergmann.de>
+ * @license http://www.opensource.org/licenses/bsd-license.php BSD License
+ * @version SVN: $Id: Attribute.php 1985 2007-12-26 18:11:55Z sb $
+ * @link http://www.phpunit.de/
+ * @since File available since Release 3.1.0
+ */
+
+require_once 'PHPUnit/Framework.php';
+require_once 'PHPUnit/Util/Filter.php';
+
+PHPUnit_Util_Filter::addFileToFilter(__FILE__, 'PHPUNIT');
+
+/**
+ *
+ *
+ * @category Testing
+ * @package PHPUnit
+ * @author Sebastian Bergmann <sb...@sebastian-bergmann.de>
+ * @copyright 2002-2008 Sebastian Bergmann <sb...@sebastian-bergmann.de>
+ * @license http://www.opensource.org/licenses/bsd-license.php BSD License
+ * @version Release: 3.2.9
+ * @link http://www.phpunit.de/
+ * @since Class available since Release 3.1.0
+ */
+
+class PHPUnit_Framework_Constraint_Attribute extends PHPUnit_Framework_Constraint
+{
+ protected $attributeName;
+ protected $constraint;
+
+ public function __construct(PHPUnit_Framework_Constraint $constraint, $attributeName)
+ {
+ $this->attributeName = $attributeName;
+ $this->constraint = $constraint;
+ }
+
+ /**
+ * Evaluates the constraint for parameter $other. Returns TRUE if the
+ * constraint is met, FALSE otherwise.
+ *
+ * @param mixed $other Value or object to evaluate.
+ * @return bool
+ */
+ public function evaluate($other)
+ {
+ return $this->constraint->evaluate(
+ PHPUnit_Framework_Assert::readAttribute(
+ $other, $this->attributeName
+ )
+ );
+ }
+
+ /**
+ * @param mixed $other The value passed to evaluate() which failed the
+ * constraint check.
+ * @param string $description A string with extra description of what was
+ * going on while the evaluation failed.
+ * @param boolean $not Flag to indicate negation.
+ * @throws PHPUnit_Framework_ExpectationFailedException
+ */
+ public function fail($other, $description, $not = FALSE)
+ {
+ parent::fail(
+ PHPUnit_Framework_Assert::readAttribute(
+ $other, $this->attributeName
+ ),
+ $description,
+ $not
+ );
+ }
+
+ /**
+ * Returns a string representation of the constraint.
+ *
+ * @return string
+ * @access public
+ */
+ public function toString()
+ {
+ return $this->constraint->toString();
+ }
+}
+?>
Added: incubator/shindig/trunk/php/external/PHPUnit/Framework/Constraint/ClassHasAttribute.php
URL: http://svn.apache.org/viewvc/incubator/shindig/trunk/php/external/PHPUnit/Framework/Constraint/ClassHasAttribute.php?rev=681982&view=auto
==============================================================================
--- incubator/shindig/trunk/php/external/PHPUnit/Framework/Constraint/ClassHasAttribute.php (added)
+++ incubator/shindig/trunk/php/external/PHPUnit/Framework/Constraint/ClassHasAttribute.php Sat Aug 2 07:11:35 2008
@@ -0,0 +1,106 @@
+<?php
+/**
+ * PHPUnit
+ *
+ * Copyright (c) 2002-2008, Sebastian Bergmann <sb...@sebastian-bergmann.de>.
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * * Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ *
+ * * Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in
+ * the documentation and/or other materials provided with the
+ * distribution.
+ *
+ * * Neither the name of Sebastian Bergmann nor the names of his
+ * contributors may be used to endorse or promote products derived
+ * from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+ * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+ * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+ * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+ * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
+ * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+ * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ *
+ * @category Testing
+ * @package PHPUnit
+ * @author Sebastian Bergmann <sb...@sebastian-bergmann.de>
+ * @copyright 2002-2008 Sebastian Bergmann <sb...@sebastian-bergmann.de>
+ * @license http://www.opensource.org/licenses/bsd-license.php BSD License
+ * @version SVN: $Id: ClassHasAttribute.php 1985 2007-12-26 18:11:55Z sb $
+ * @link http://www.phpunit.de/
+ * @since File available since Release 3.1.0
+ */
+
+require_once 'PHPUnit/Framework.php';
+require_once 'PHPUnit/Util/Filter.php';
+require_once 'PHPUnit/Util/Type.php';
+
+PHPUnit_Util_Filter::addFileToFilter(__FILE__, 'PHPUNIT');
+
+/**
+ * Constraint that asserts that the class it is evaluated for has a given
+ * attribute.
+ *
+ * The attribute name is passed in the constructor.
+ *
+ * @category Testing
+ * @package PHPUnit
+ * @author Sebastian Bergmann <sb...@sebastian-bergmann.de>
+ * @copyright 2002-2008 Sebastian Bergmann <sb...@sebastian-bergmann.de>
+ * @license http://www.opensource.org/licenses/bsd-license.php BSD License
+ * @version Release: 3.2.9
+ * @link http://www.phpunit.de/
+ * @since Class available since Release 3.1.0
+ */
+class PHPUnit_Framework_Constraint_ClassHasAttribute extends PHPUnit_Framework_Constraint
+{
+ protected $attributeName;
+
+ public function __construct($attributeName)
+ {
+ $this->attributeName = $attributeName;
+ }
+
+ /**
+ * Evaluates the constraint for parameter $other. Returns TRUE if the
+ * constraint is met, FALSE otherwise.
+ *
+ * @param mixed $other Value or object to evaluate.
+ * @return bool
+ */
+ public function evaluate($other)
+ {
+ $class = new ReflectionClass($other);
+
+ return $class->hasProperty($this->attributeName);
+ }
+
+ /**
+ * Returns a string representation of the constraint.
+ *
+ * @return string
+ * @access public
+ */
+ public function toString()
+ {
+ return sprintf(
+ 'has attribute "%s"',
+
+ $this->attributeName
+ );
+ }
+}
+?>
Added: incubator/shindig/trunk/php/external/PHPUnit/Framework/Constraint/ClassHasStaticAttribute.php
URL: http://svn.apache.org/viewvc/incubator/shindig/trunk/php/external/PHPUnit/Framework/Constraint/ClassHasStaticAttribute.php?rev=681982&view=auto
==============================================================================
--- incubator/shindig/trunk/php/external/PHPUnit/Framework/Constraint/ClassHasStaticAttribute.php (added)
+++ incubator/shindig/trunk/php/external/PHPUnit/Framework/Constraint/ClassHasStaticAttribute.php Sat Aug 2 07:11:35 2008
@@ -0,0 +1,90 @@
+<?php
+/**
+ * PHPUnit
+ *
+ * Copyright (c) 2002-2008, Sebastian Bergmann <sb...@sebastian-bergmann.de>.
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * * Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ *
+ * * Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in
+ * the documentation and/or other materials provided with the
+ * distribution.
+ *
+ * * Neither the name of Sebastian Bergmann nor the names of his
+ * contributors may be used to endorse or promote products derived
+ * from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+ * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+ * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+ * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+ * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
+ * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+ * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ *
+ * @category Testing
+ * @package PHPUnit
+ * @author Sebastian Bergmann <sb...@sebastian-bergmann.de>
+ * @copyright 2002-2008 Sebastian Bergmann <sb...@sebastian-bergmann.de>
+ * @license http://www.opensource.org/licenses/bsd-license.php BSD License
+ * @version SVN: $Id: ClassHasStaticAttribute.php 1985 2007-12-26 18:11:55Z sb $
+ * @link http://www.phpunit.de/
+ * @since File available since Release 3.1.0
+ */
+
+require_once 'PHPUnit/Framework.php';
+require_once 'PHPUnit/Util/Filter.php';
+require_once 'PHPUnit/Util/Type.php';
+
+PHPUnit_Util_Filter::addFileToFilter(__FILE__, 'PHPUNIT');
+
+/**
+ * Constraint that asserts that the class it is evaluated for has a given
+ * static attribute.
+ *
+ * The attribute name is passed in the constructor.
+ *
+ * @category Testing
+ * @package PHPUnit
+ * @author Sebastian Bergmann <sb...@sebastian-bergmann.de>
+ * @copyright 2002-2008 Sebastian Bergmann <sb...@sebastian-bergmann.de>
+ * @license http://www.opensource.org/licenses/bsd-license.php BSD License
+ * @version Release: 3.2.9
+ * @link http://www.phpunit.de/
+ * @since Class available since Release 3.1.0
+ */
+class PHPUnit_Framework_Constraint_ClassHasStaticAttribute extends PHPUnit_Framework_Constraint_ClassHasAttribute
+{
+ /**
+ * Evaluates the constraint for parameter $other. Returns TRUE if the
+ * constraint is met, FALSE otherwise.
+ *
+ * @param mixed $other Value or object to evaluate.
+ * @return bool
+ */
+ public function evaluate($other)
+ {
+ $class = new ReflectionClass($other);
+
+ if ($class->hasProperty($this->attributeName)) {
+ $attribute = $class->getProperty($this->attributeName);
+
+ return $attribute->isStatic();
+ } else {
+ return FALSE;
+ }
+ }
+}
+?>
Added: incubator/shindig/trunk/php/external/PHPUnit/Framework/Constraint/FileExists.php
URL: http://svn.apache.org/viewvc/incubator/shindig/trunk/php/external/PHPUnit/Framework/Constraint/FileExists.php?rev=681982&view=auto
==============================================================================
--- incubator/shindig/trunk/php/external/PHPUnit/Framework/Constraint/FileExists.php (added)
+++ incubator/shindig/trunk/php/external/PHPUnit/Framework/Constraint/FileExists.php Sat Aug 2 07:11:35 2008
@@ -0,0 +1,122 @@
+<?php
+/**
+ * PHPUnit
+ *
+ * Copyright (c) 2002-2008, Sebastian Bergmann <sb...@sebastian-bergmann.de>.
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * * Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ *
+ * * Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in
+ * the documentation and/or other materials provided with the
+ * distribution.
+ *
+ * * Neither the name of Sebastian Bergmann nor the names of his
+ * contributors may be used to endorse or promote products derived
+ * from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+ * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+ * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+ * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+ * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
+ * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+ * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ *
+ * @category Testing
+ * @package PHPUnit
+ * @author Jan Borsodi <jb...@ez.no>
+ * @author Sebastian Bergmann <sb...@sebastian-bergmann.de>
+ * @copyright 2002-2008 Sebastian Bergmann <sb...@sebastian-bergmann.de>
+ * @license http://www.opensource.org/licenses/bsd-license.php BSD License
+ * @version SVN: $Id: FileExists.php 1985 2007-12-26 18:11:55Z sb $
+ * @link http://www.phpunit.de/
+ * @since File available since Release 3.0.0
+ */
+
+require_once 'PHPUnit/Framework.php';
+require_once 'PHPUnit/Util/Filter.php';
+
+PHPUnit_Util_Filter::addFileToFilter(__FILE__, 'PHPUNIT');
+
+/**
+ * Constraint that checks if the file(name) that it is evaluated for exists.
+ *
+ * The file path to check is passed as $other in evaluate().
+ *
+ * @category Testing
+ * @package PHPUnit
+ * @author Jan Borsodi <jb...@ez.no>
+ * @author Sebastian Bergmann <sb...@sebastian-bergmann.de>
+ * @copyright 2002-2008 Sebastian Bergmann <sb...@sebastian-bergmann.de>
+ * @license http://www.opensource.org/licenses/bsd-license.php BSD License
+ * @version Release: 3.2.9
+ * @link http://www.phpunit.de/
+ * @since Class available since Release 3.0.0
+ */
+class PHPUnit_Framework_Constraint_FileExists extends PHPUnit_Framework_Constraint
+{
+ /**
+ * Evaluates the constraint for parameter $other. Returns TRUE if the
+ * constraint is met, FALSE otherwise.
+ *
+ * @param mixed $other Value or object to evaluate.
+ * @return bool
+ */
+ public function evaluate($other)
+ {
+ return file_exists($other);
+ }
+
+ /**
+ * @param mixed $other The value passed to evaluate() which failed the
+ * constraint check.
+ * @param string $description A string with extra description of what was
+ * going on while the evaluation failed.
+ * @param boolean $not Flag to indicate negation.
+ * @throws PHPUnit_Framework_ExpectationFailedException
+ */
+ public function fail($other, $description, $not = FALSE)
+ {
+ $failureDescription = sprintf(
+ 'Failed asserting that file "%s" exists.',
+
+ $other
+ );
+
+ if ($not) {
+ $failureDescription = self::negate($failureDescription);
+ }
+
+ if (!empty($description)) {
+ $failureDescription = $description . "\n" . $failureDescription;
+ }
+
+ throw new PHPUnit_Framework_ExpectationFailedException(
+ $failureDescription
+ );
+ }
+
+ /**
+ * Returns a string representation of the constraint.
+ *
+ * @return string
+ * @access public
+ */
+ public function toString()
+ {
+ return 'file exists';
+ }
+}
+?>
Added: incubator/shindig/trunk/php/external/PHPUnit/Framework/Constraint/GreaterThan.php
URL: http://svn.apache.org/viewvc/incubator/shindig/trunk/php/external/PHPUnit/Framework/Constraint/GreaterThan.php?rev=681982&view=auto
==============================================================================
--- incubator/shindig/trunk/php/external/PHPUnit/Framework/Constraint/GreaterThan.php (added)
+++ incubator/shindig/trunk/php/external/PHPUnit/Framework/Constraint/GreaterThan.php Sat Aug 2 07:11:35 2008
@@ -0,0 +1,100 @@
+<?php
+/**
+ * PHPUnit
+ *
+ * Copyright (c) 2002-2008, Sebastian Bergmann <sb...@sebastian-bergmann.de>.
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * * Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ *
+ * * Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in
+ * the documentation and/or other materials provided with the
+ * distribution.
+ *
+ * * Neither the name of Sebastian Bergmann nor the names of his
+ * contributors may be used to endorse or promote products derived
+ * from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+ * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+ * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+ * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+ * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
+ * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+ * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ *
+ * @category Testing
+ * @package PHPUnit
+ * @author Jan Borsodi <jb...@ez.no>
+ * @author Sebastian Bergmann <sb...@sebastian-bergmann.de>
+ * @copyright 2002-2008 Sebastian Bergmann <sb...@sebastian-bergmann.de>
+ * @license http://www.opensource.org/licenses/bsd-license.php BSD License
+ * @version SVN: $Id: GreaterThan.php 1985 2007-12-26 18:11:55Z sb $
+ * @link http://www.phpunit.de/
+ * @since File available since Release 3.0.0
+ */
+
+require_once 'PHPUnit/Framework.php';
+require_once 'PHPUnit/Util/Filter.php';
+require_once 'PHPUnit/Util/Type.php';
+
+PHPUnit_Util_Filter::addFileToFilter(__FILE__, 'PHPUNIT');
+
+/**
+ * Constraint that asserts that the value it is evaluated for is greater
+ * than a given value.
+ *
+ * @category Testing
+ * @package PHPUnit
+ * @author Jan Borsodi <jb...@ez.no>
+ * @author Sebastian Bergmann <sb...@sebastian-bergmann.de>
+ * @copyright 2002-2008 Sebastian Bergmann <sb...@sebastian-bergmann.de>
+ * @license http://www.opensource.org/licenses/bsd-license.php BSD License
+ * @version Release: 3.2.9
+ * @link http://www.phpunit.de/
+ * @since Class available since Release 3.0.0
+ */
+class PHPUnit_Framework_Constraint_GreaterThan extends PHPUnit_Framework_Constraint
+{
+ protected $value;
+
+ public function __construct($value)
+ {
+ $this->value = $value;
+ }
+
+ /**
+ * Evaluates the constraint for parameter $other. Returns TRUE if the
+ * constraint is met, FALSE otherwise.
+ *
+ * @param mixed $other Value or object to evaluate.
+ * @return bool
+ */
+ public function evaluate($other)
+ {
+ return $this->value < $other;
+ }
+
+ /**
+ * Returns a string representation of the constraint.
+ *
+ * @return string
+ * @access public
+ */
+ public function toString()
+ {
+ return 'is greater than ' . PHPUnit_Util_Type::toString($this->value);
+ }
+}
+?>
Added: incubator/shindig/trunk/php/external/PHPUnit/Framework/Constraint/IsAnything.php
URL: http://svn.apache.org/viewvc/incubator/shindig/trunk/php/external/PHPUnit/Framework/Constraint/IsAnything.php?rev=681982&view=auto
==============================================================================
--- incubator/shindig/trunk/php/external/PHPUnit/Framework/Constraint/IsAnything.php (added)
+++ incubator/shindig/trunk/php/external/PHPUnit/Framework/Constraint/IsAnything.php Sat Aug 2 07:11:35 2008
@@ -0,0 +1,102 @@
+<?php
+/**
+ * PHPUnit
+ *
+ * Copyright (c) 2002-2008, Sebastian Bergmann <sb...@sebastian-bergmann.de>.
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * * Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ *
+ * * Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in
+ * the documentation and/or other materials provided with the
+ * distribution.
+ *
+ * * Neither the name of Sebastian Bergmann nor the names of his
+ * contributors may be used to endorse or promote products derived
+ * from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+ * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+ * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+ * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+ * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
+ * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+ * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ *
+ * @category Testing
+ * @package PHPUnit
+ * @author Jan Borsodi <jb...@ez.no>
+ * @author Sebastian Bergmann <sb...@sebastian-bergmann.de>
+ * @copyright 2002-2008 Sebastian Bergmann <sb...@sebastian-bergmann.de>
+ * @license http://www.opensource.org/licenses/bsd-license.php BSD License
+ * @version SVN: $Id: IsAnything.php 1985 2007-12-26 18:11:55Z sb $
+ * @link http://www.phpunit.de/
+ * @since File available since Release 3.0.0
+ */
+
+require_once 'PHPUnit/Framework.php';
+require_once 'PHPUnit/Util/Filter.php';
+
+PHPUnit_Util_Filter::addFileToFilter(__FILE__, 'PHPUNIT');
+
+/**
+ * Constraint that accepts any input value.
+ *
+ * @category Testing
+ * @package PHPUnit
+ * @author Jan Borsodi <jb...@ez.no>
+ * @author Sebastian Bergmann <sb...@sebastian-bergmann.de>
+ * @copyright 2002-2008 Sebastian Bergmann <sb...@sebastian-bergmann.de>
+ * @license http://www.opensource.org/licenses/bsd-license.php BSD License
+ * @version Release: 3.2.9
+ * @link http://www.phpunit.de/
+ * @since Class available since Release 3.0.0
+ */
+class PHPUnit_Framework_Constraint_IsAnything extends PHPUnit_Framework_Constraint
+{
+ /**
+ * Evaluates the constraint for parameter $other. Returns TRUE if the
+ * constraint is met, FALSE otherwise.
+ *
+ * @param mixed $other Value or object to evaluate.
+ * @return bool
+ */
+ public function evaluate($other)
+ {
+ return TRUE;
+ }
+
+ /**
+ * @param mixed $other The value passed to evaluate() which failed the
+ * constraint check.
+ * @param string $description A string with extra description of what was
+ * going on while the evaluation failed.
+ * @param boolean $not Flag to indicate negation.
+ */
+ public function fail($other, $description, $not = FALSE)
+ {
+ }
+
+ /**
+ * Returns a string representation of the constraint.
+ *
+ * @return string
+ * @access public
+ */
+ public function toString()
+ {
+ return 'is anything';
+ }
+}
+?>
Added: incubator/shindig/trunk/php/external/PHPUnit/Framework/Constraint/IsEqual.php
URL: http://svn.apache.org/viewvc/incubator/shindig/trunk/php/external/PHPUnit/Framework/Constraint/IsEqual.php?rev=681982&view=auto
==============================================================================
--- incubator/shindig/trunk/php/external/PHPUnit/Framework/Constraint/IsEqual.php (added)
+++ incubator/shindig/trunk/php/external/PHPUnit/Framework/Constraint/IsEqual.php Sat Aug 2 07:11:35 2008
@@ -0,0 +1,290 @@
+<?php
+/**
+ * PHPUnit
+ *
+ * Copyright (c) 2002-2008, Sebastian Bergmann <sb...@sebastian-bergmann.de>.
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * * Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ *
+ * * Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in
+ * the documentation and/or other materials provided with the
+ * distribution.
+ *
+ * * Neither the name of Sebastian Bergmann nor the names of his
+ * contributors may be used to endorse or promote products derived
+ * from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+ * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+ * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+ * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+ * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
+ * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+ * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ *
+ * @category Testing
+ * @package PHPUnit
+ * @author Kore Nordmann <kn...@ez.no>
+ * @author Sebastian Bergmann <sb...@sebastian-bergmann.de>
+ * @copyright 2002-2008 Sebastian Bergmann <sb...@sebastian-bergmann.de>
+ * @license http://www.opensource.org/licenses/bsd-license.php BSD License
+ * @version SVN: $Id: IsEqual.php 1985 2007-12-26 18:11:55Z sb $
+ * @link http://www.phpunit.de/
+ * @since File available since Release 3.0.0
+ */
+
+require_once 'PHPUnit/Framework.php';
+require_once 'PHPUnit/Util/Filter.php';
+require_once 'PHPUnit/Util/Type.php';
+
+PHPUnit_Util_Filter::addFileToFilter(__FILE__, 'PHPUNIT');
+
+/**
+ * Constraint that checks if one value is equal to another.
+ *
+ * Equality is checked with PHP's == operator, the operator is explained in detail
+ * at {@url http://www.php.net/manual/en/types.comparisons.php}.
+ * Two values are equal if they have the same value disregarding type.
+ *
+ * The expected value is passed in the constructor.
+ *
+ * @category Testing
+ * @package PHPUnit
+ * @author Kore Nordmann <kn...@ez.no>
+ * @author Sebastian Bergmann <sb...@sebastian-bergmann.de>
+ * @copyright 2002-2008 Sebastian Bergmann <sb...@sebastian-bergmann.de>
+ * @license http://www.opensource.org/licenses/bsd-license.php BSD License
+ * @version Release: 3.2.9
+ * @link http://www.phpunit.de/
+ * @since Class available since Release 3.0.0
+ */
+class PHPUnit_Framework_Constraint_IsEqual extends PHPUnit_Framework_Constraint
+{
+ protected $value;
+ protected $delta = 0;
+ protected $maxDepth = 10;
+
+ public function __construct($value, $delta = 0, $maxDepth = 10)
+ {
+ $this->value = $value;
+ $this->delta = $delta;
+ $this->maxDepth = $maxDepth;
+ }
+
+ /**
+ * Evaluates the constraint for parameter $other. Returns TRUE if the
+ * constraint is met, FALSE otherwise.
+ *
+ * @param mixed $other Value or object to evaluate.
+ * @return bool
+ */
+ public function evaluate($other)
+ {
+ return $this->recursiveComparison($this->value, $other);
+ }
+
+ /**
+ * @param mixed $other The value passed to evaluate() which failed the
+ * constraint check.
+ * @param string $description A string with extra description of what was
+ * going on while the evaluation failed.
+ * @param boolean $not Flag to indicate negation.
+ * @throws PHPUnit_Framework_ExpectationFailedException
+ */
+ public function fail($other, $description, $not = FALSE)
+ {
+ $failureDescription = $this->failureDescription(
+ $other,
+ $description,
+ $not
+ );
+
+ if (!$not) {
+ if ($this->value instanceof DOMDocument) {
+ $value = $this->domToText($this->value);
+ } else {
+ $value = $this->value;
+ }
+
+ if ($other instanceof DOMDocument) {
+ $other = $this->domToText($other);
+ }
+
+ throw new PHPUnit_Framework_ExpectationFailedException(
+ $failureDescription,
+ PHPUnit_Framework_ComparisonFailure::diffEqual($value, $other),
+ $description
+ );
+ } else {
+ throw new PHPUnit_Framework_ExpectationFailedException(
+ $failureDescription,
+ NULL
+ );
+ }
+ }
+
+ /**
+ * Returns a string representation of the constraint.
+ *
+ * @return string
+ * @access public
+ */
+ public function toString()
+ {
+ $delta = '';
+
+ if (is_string($this->value)) {
+ if (strpos($this->value, "\n") !== FALSE) {
+ return 'is equal to <text>';
+ } else {
+ return sprintf(
+ 'is equal to <string:%s>',
+
+ $this->value
+ );
+ }
+ } else {
+ if ($this->delta != 0) {
+ $delta = sprintf(
+ ' with delta <%F>',
+
+ $this->delta
+ );
+ }
+
+ return sprintf(
+ 'is equal to %s%s',
+
+ PHPUnit_Util_Type::toString($this->value),
+ $delta
+ );
+ }
+ }
+
+ /**
+ * Perform the actual recursive comparision of two values
+ *
+ * @param mixed $a First value
+ * @param mixed $b Second value
+ * @param int $depth Depth
+ * @return bool
+ */
+ protected function recursiveComparison($a, $b, $depth = 0)
+ {
+ if ($a === $b) {
+ return TRUE;
+ }
+
+ if ($depth >= $this->maxDepth) {
+ return TRUE;
+ }
+
+ if (is_numeric($a) XOR is_numeric($b)) {
+ return FALSE;
+ }
+
+ if (is_array($a) XOR is_array($b)) {
+ return FALSE;
+ }
+
+ if (is_object($a) XOR is_object($b)) {
+ return FALSE;
+ }
+
+ if ($a instanceof DOMDocument) {
+ $a = $this->domToText($a);
+ }
+
+ if ($b instanceof DOMDocument) {
+ $b = $this->domToText($b);
+ }
+
+ if (is_object($a) && is_object($b) &&
+ (get_class($a) !== get_class($b))) {
+ return FALSE;
+ }
+
+ // Normal comparision for scalar values.
+ if ((!is_array($a) && !is_object($a)) ||
+ (!is_array($b) && !is_object($b))) {
+ if (is_numeric($a) && is_numeric($b)) {
+ // Optionally apply delta on numeric values.
+ return $this->numericComparison($a, $b);
+ } else {
+ return ($a == $b);
+ }
+ }
+
+ if (is_object($a)) {
+ $a = (array) $a;
+ $b = (array) $b;
+ }
+
+ foreach ($a as $key => $v) {
+ if (!array_key_exists($key, $b)) {
+ // Abort on missing key in $b.
+ return FALSE;
+ }
+
+ if (!$this->recursiveComparison($a[$key], $b[$key], $depth + 1)) {
+ // FALSE, if child comparision fails.
+ return FALSE;
+ }
+
+ // Unset key to check whether all keys of b are compared.
+ unset($b[$key]);
+ }
+
+ if (count($b)) {
+ // There is something in $b, that is missing in $a.
+ return FALSE;
+ }
+
+ return TRUE;
+ }
+
+ /**
+ * Compares two numeric values - use delta if applieable
+ *
+ * @param mixed $a First value
+ * @param mixed $b Second value
+ * @return bool
+ */
+ protected function numericComparison($a, $b)
+ {
+ if ($this->delta === FALSE) {
+ return ($a == $b);
+ } else {
+ return (abs($a - $b) <= $this->delta);
+ }
+ }
+
+ /**
+ * Returns the normalized, whitespace-cleaned, and indented textual
+ * representation of a DOMDocument.
+ *
+ * @param DOMDocument $document
+ * @return string
+ */
+ protected function domToText(DOMDocument $document)
+ {
+ $document->formatOutput = true;
+ $document->preserveWhiteSpace = false;
+ $document->normalizeDocument();
+
+ return $document->saveXML();
+ }
+}
+?>
Added: incubator/shindig/trunk/php/external/PHPUnit/Framework/Constraint/IsIdentical.php
URL: http://svn.apache.org/viewvc/incubator/shindig/trunk/php/external/PHPUnit/Framework/Constraint/IsIdentical.php?rev=681982&view=auto
==============================================================================
--- incubator/shindig/trunk/php/external/PHPUnit/Framework/Constraint/IsIdentical.php (added)
+++ incubator/shindig/trunk/php/external/PHPUnit/Framework/Constraint/IsIdentical.php Sat Aug 2 07:11:35 2008
@@ -0,0 +1,136 @@
+<?php
+/**
+ * PHPUnit
+ *
+ * Copyright (c) 2002-2008, Sebastian Bergmann <sb...@sebastian-bergmann.de>.
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * * Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ *
+ * * Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in
+ * the documentation and/or other materials provided with the
+ * distribution.
+ *
+ * * Neither the name of Sebastian Bergmann nor the names of his
+ * contributors may be used to endorse or promote products derived
+ * from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+ * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+ * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+ * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+ * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
+ * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+ * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ *
+ * @category Testing
+ * @package PHPUnit
+ * @author Jan Borsodi <jb...@ez.no>
+ * @author Sebastian Bergmann <sb...@sebastian-bergmann.de>
+ * @copyright 2002-2008 Sebastian Bergmann <sb...@sebastian-bergmann.de>
+ * @license http://www.opensource.org/licenses/bsd-license.php BSD License
+ * @version SVN: $Id: IsIdentical.php 1985 2007-12-26 18:11:55Z sb $
+ * @link http://www.phpunit.de/
+ * @since File available since Release 3.0.0
+ */
+
+require_once 'PHPUnit/Framework.php';
+require_once 'PHPUnit/Util/Filter.php';
+require_once 'PHPUnit/Util/Type.php';
+
+PHPUnit_Util_Filter::addFileToFilter(__FILE__, 'PHPUNIT');
+
+/**
+ * Constraint that asserts that one value is identical to another.
+ *
+ * Identical check is performed with PHP's === operator, the operator is explained
+ * in detail at {@url http://www.php.net/manual/en/types.comparisons.php}.
+ * Two values are identical if they have the same value and are of the same type.
+ *
+ * The expected value is passed in the constructor.
+ *
+ * @category Testing
+ * @package PHPUnit
+ * @author Jan Borsodi <jb...@ez.no>
+ * @author Sebastian Bergmann <sb...@sebastian-bergmann.de>
+ * @copyright 2002-2008 Sebastian Bergmann <sb...@sebastian-bergmann.de>
+ * @license http://www.opensource.org/licenses/bsd-license.php BSD License
+ * @version Release: 3.2.9
+ * @link http://www.phpunit.de/
+ * @since Class available since Release 3.0.0
+ */
+class PHPUnit_Framework_Constraint_IsIdentical extends PHPUnit_Framework_Constraint
+{
+ protected $value;
+
+ public function __construct($value)
+ {
+ $this->value = $value;
+ }
+
+ /**
+ * Evaluates the constraint for parameter $other. Returns TRUE if the
+ * constraint is met, FALSE otherwise.
+ *
+ * @param mixed $other Value or object to evaluate.
+ * @return bool
+ */
+ public function evaluate($other)
+ {
+ return $this->value === $other;
+ }
+
+ /**
+ * @param mixed $other The value passed to evaluate() which failed the
+ * constraint check.
+ * @param string $description A string with extra description of what was
+ * going on while the evaluation failed.
+ * @param boolean $not Flag to indicate negation.
+ * @throws PHPUnit_Framework_ExpectationFailedException
+ */
+ public function fail($other, $description, $not = FALSE)
+ {
+ $failureDescription = $this->failureDescription(
+ $other,
+ $description,
+ $not
+ );
+
+ if (!$not) {
+ throw new PHPUnit_Framework_ExpectationFailedException(
+ $failureDescription,
+ PHPUnit_Framework_ComparisonFailure::diffIdentical($this->value, $other),
+ $description
+ );
+ } else {
+ throw new PHPUnit_Framework_ExpectationFailedException(
+ $failureDescription,
+ NULL,
+ $description
+ );
+ }
+ }
+
+ /**
+ * Returns a string representation of the constraint.
+ *
+ * @return string
+ * @access public
+ */
+ public function toString()
+ {
+ return 'is identical to ' . PHPUnit_Util_Type::toString($this->value);
+ }
+}
+?>
Added: incubator/shindig/trunk/php/external/PHPUnit/Framework/Constraint/IsInstanceOf.php
URL: http://svn.apache.org/viewvc/incubator/shindig/trunk/php/external/PHPUnit/Framework/Constraint/IsInstanceOf.php?rev=681982&view=auto
==============================================================================
--- incubator/shindig/trunk/php/external/PHPUnit/Framework/Constraint/IsInstanceOf.php (added)
+++ incubator/shindig/trunk/php/external/PHPUnit/Framework/Constraint/IsInstanceOf.php Sat Aug 2 07:11:35 2008
@@ -0,0 +1,132 @@
+<?php
+/**
+ * PHPUnit
+ *
+ * Copyright (c) 2002-2008, Sebastian Bergmann <sb...@sebastian-bergmann.de>.
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * * Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ *
+ * * Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in
+ * the documentation and/or other materials provided with the
+ * distribution.
+ *
+ * * Neither the name of Sebastian Bergmann nor the names of his
+ * contributors may be used to endorse or promote products derived
+ * from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+ * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+ * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+ * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+ * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
+ * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+ * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ *
+ * @category Testing
+ * @package PHPUnit
+ * @author Jan Borsodi <jb...@ez.no>
+ * @author Sebastian Bergmann <sb...@sebastian-bergmann.de>
+ * @copyright 2002-2008 Sebastian Bergmann <sb...@sebastian-bergmann.de>
+ * @license http://www.opensource.org/licenses/bsd-license.php BSD License
+ * @version SVN: $Id: IsInstanceOf.php 1985 2007-12-26 18:11:55Z sb $
+ * @link http://www.phpunit.de/
+ * @since File available since Release 3.0.0
+ */
+
+require_once 'PHPUnit/Framework.php';
+require_once 'PHPUnit/Util/Filter.php';
+require_once 'PHPUnit/Util/Type.php';
+
+PHPUnit_Util_Filter::addFileToFilter(__FILE__, 'PHPUNIT');
+
+/**
+ * Constraint that asserts that the object it is evaluated for is an instance
+ * of a given class.
+ *
+ * The expected class name is passed in the constructor.
+ *
+ * @category Testing
+ * @package PHPUnit
+ * @author Jan Borsodi <jb...@ez.no>
+ * @author Sebastian Bergmann <sb...@sebastian-bergmann.de>
+ * @copyright 2002-2008 Sebastian Bergmann <sb...@sebastian-bergmann.de>
+ * @license http://www.opensource.org/licenses/bsd-license.php BSD License
+ * @version Release: 3.2.9
+ * @link http://www.phpunit.de/
+ * @since Class available since Release 3.0.0
+ */
+class PHPUnit_Framework_Constraint_IsInstanceOf extends PHPUnit_Framework_Constraint
+{
+ protected $className;
+
+ public function __construct($className)
+ {
+ $this->className = $className;
+ }
+
+ /**
+ * Evaluates the constraint for parameter $other. Returns TRUE if the
+ * constraint is met, FALSE otherwise.
+ *
+ * @param mixed $other Value or object to evaluate.
+ * @return bool
+ */
+ public function evaluate($other)
+ {
+ return ($other instanceof $this->className);
+ }
+
+ /**
+ * Creates the appropriate exception for the constraint which can be caught
+ * by the unit test system. This can be called if a call to evaluate() fails.
+ *
+ * @param mixed $other The value passed to evaluate() which failed the
+ * constraint check.
+ * @param string $description A string with extra description of what was
+ * going on while the evaluation failed.
+ * @param boolean $not Flag to indicate negation.
+ * @throws PHPUnit_Framework_ExpectationFailedException
+ */
+ public function fail($other, $description, $not = FALSE)
+ {
+ throw new PHPUnit_Framework_ExpectationFailedException(
+ sprintf(
+ '%sFailed asserting that %s is %san instance of class "%s".',
+
+ !empty($description) ? $description . "\n" : '',
+ PHPUnit_Util_Type::toString($other, TRUE),
+ $not ? 'not ' : '',
+ $this->className
+ ),
+ NULL
+ );
+ }
+
+ /**
+ * Returns a string representation of the constraint.
+ *
+ * @return string
+ * @access public
+ */
+ public function toString()
+ {
+ return sprintf(
+ 'is instance of class "%s"',
+
+ $this->className
+ );
+ }
+}
+?>
Added: incubator/shindig/trunk/php/external/PHPUnit/Framework/Constraint/IsType.php
URL: http://svn.apache.org/viewvc/incubator/shindig/trunk/php/external/PHPUnit/Framework/Constraint/IsType.php?rev=681982&view=auto
==============================================================================
--- incubator/shindig/trunk/php/external/PHPUnit/Framework/Constraint/IsType.php (added)
+++ incubator/shindig/trunk/php/external/PHPUnit/Framework/Constraint/IsType.php Sat Aug 2 07:11:35 2008
@@ -0,0 +1,169 @@
+<?php
+/**
+ * PHPUnit
+ *
+ * Copyright (c) 2002-2008, Sebastian Bergmann <sb...@sebastian-bergmann.de>.
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * * Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ *
+ * * Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in
+ * the documentation and/or other materials provided with the
+ * distribution.
+ *
+ * * Neither the name of Sebastian Bergmann nor the names of his
+ * contributors may be used to endorse or promote products derived
+ * from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+ * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+ * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+ * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+ * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
+ * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+ * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ *
+ * @category Testing
+ * @package PHPUnit
+ * @author Jan Borsodi <jb...@ez.no>
+ * @author Sebastian Bergmann <sb...@sebastian-bergmann.de>
+ * @copyright 2002-2008 Sebastian Bergmann <sb...@sebastian-bergmann.de>
+ * @license http://www.opensource.org/licenses/bsd-license.php BSD License
+ * @version SVN: $Id: IsType.php 1985 2007-12-26 18:11:55Z sb $
+ * @link http://www.phpunit.de/
+ * @since File available since Release 3.0.0
+ */
+
+require_once 'PHPUnit/Framework.php';
+require_once 'PHPUnit/Util/Filter.php';
+
+PHPUnit_Util_Filter::addFileToFilter(__FILE__, 'PHPUNIT');
+
+/**
+ * Constraint that asserts that the value it is evaluated for is of a
+ * specified type.
+ *
+ * The expected value is passed in the constructor.
+ *
+ * @category Testing
+ * @package PHPUnit
+ * @author Jan Borsodi <jb...@ez.no>
+ * @author Sebastian Bergmann <sb...@sebastian-bergmann.de>
+ * @copyright 2002-2008 Sebastian Bergmann <sb...@sebastian-bergmann.de>
+ * @license http://www.opensource.org/licenses/bsd-license.php BSD License
+ * @version Release: 3.2.9
+ * @link http://www.phpunit.de/
+ * @since Class available since Release 3.0.0
+ */
+class PHPUnit_Framework_Constraint_IsType extends PHPUnit_Framework_Constraint
+{
+ protected $type;
+
+ public function __construct($type)
+ {
+ switch ($type) {
+ case 'numeric':
+ case 'integer':
+ case 'int':
+ case 'float':
+ case 'string':
+ case 'boolean':
+ case 'bool':
+ case 'null':
+ case 'array':
+ case 'object':
+ case 'resource': {
+ break;
+ }
+
+ default: {
+ throw new InvalidArgumentException(
+ sprintf(
+ 'Type specified for PHPUnit_Framework_Constraint_IsType <%s> is not a valid type.',
+
+ $type
+ )
+ );
+ }
+ }
+
+ $this->type = $type;
+ }
+
+ /**
+ * Evaluates the constraint for parameter $other. Returns TRUE if the
+ * constraint is met, FALSE otherwise.
+ *
+ * @param mixed $other Value or object to evaluate.
+ * @return bool
+ */
+ public function evaluate($other)
+ {
+ switch ($this->type) {
+ case 'numeric': {
+ return is_numeric($other);
+ }
+
+ case 'integer':
+ case 'int': {
+ return is_integer($other);
+ }
+
+ case 'float': {
+ return is_float($other);
+ }
+
+ case 'string': {
+ return is_string($other);
+ }
+
+ case 'boolean':
+ case 'bool': {
+ return is_bool($other);
+ }
+
+ case 'null': {
+ return is_null($other);
+ }
+
+ case 'array': {
+ return is_array($other);
+ }
+
+ case 'object': {
+ return is_object($other);
+ }
+
+ case 'resource': {
+ return is_resource($other);
+ }
+ }
+ }
+
+ /**
+ * Returns a string representation of the constraint.
+ *
+ * @return string
+ * @access public
+ */
+ public function toString()
+ {
+ return sprintf(
+ 'is of type "%s"',
+
+ $this->type
+ );
+ }
+}
+?>
Added: incubator/shindig/trunk/php/external/PHPUnit/Framework/Constraint/LessThan.php
URL: http://svn.apache.org/viewvc/incubator/shindig/trunk/php/external/PHPUnit/Framework/Constraint/LessThan.php?rev=681982&view=auto
==============================================================================
--- incubator/shindig/trunk/php/external/PHPUnit/Framework/Constraint/LessThan.php (added)
+++ incubator/shindig/trunk/php/external/PHPUnit/Framework/Constraint/LessThan.php Sat Aug 2 07:11:35 2008
@@ -0,0 +1,100 @@
+<?php
+/**
+ * PHPUnit
+ *
+ * Copyright (c) 2002-2008, Sebastian Bergmann <sb...@sebastian-bergmann.de>.
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * * Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ *
+ * * Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in
+ * the documentation and/or other materials provided with the
+ * distribution.
+ *
+ * * Neither the name of Sebastian Bergmann nor the names of his
+ * contributors may be used to endorse or promote products derived
+ * from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+ * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+ * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+ * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+ * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
+ * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+ * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ *
+ * @category Testing
+ * @package PHPUnit
+ * @author Jan Borsodi <jb...@ez.no>
+ * @author Sebastian Bergmann <sb...@sebastian-bergmann.de>
+ * @copyright 2002-2008 Sebastian Bergmann <sb...@sebastian-bergmann.de>
+ * @license http://www.opensource.org/licenses/bsd-license.php BSD License
+ * @version SVN: $Id: LessThan.php 1985 2007-12-26 18:11:55Z sb $
+ * @link http://www.phpunit.de/
+ * @since File available since Release 3.0.0
+ */
+
+require_once 'PHPUnit/Framework.php';
+require_once 'PHPUnit/Util/Filter.php';
+require_once 'PHPUnit/Util/Type.php';
+
+PHPUnit_Util_Filter::addFileToFilter(__FILE__, 'PHPUNIT');
+
+/**
+ * Constraint that asserts that the value it is evaluated for is less than
+ * a given value.
+ *
+ * @category Testing
+ * @package PHPUnit
+ * @author Jan Borsodi <jb...@ez.no>
+ * @author Sebastian Bergmann <sb...@sebastian-bergmann.de>
+ * @copyright 2002-2008 Sebastian Bergmann <sb...@sebastian-bergmann.de>
+ * @license http://www.opensource.org/licenses/bsd-license.php BSD License
+ * @version Release: 3.2.9
+ * @link http://www.phpunit.de/
+ * @since Class available since Release 3.0.0
+ */
+class PHPUnit_Framework_Constraint_LessThan extends PHPUnit_Framework_Constraint
+{
+ protected $value;
+
+ public function __construct($value)
+ {
+ $this->value = $value;
+ }
+
+ /**
+ * Evaluates the constraint for parameter $other. Returns TRUE if the
+ * constraint is met, FALSE otherwise.
+ *
+ * @param mixed $other Value or object to evaluate.
+ * @return bool
+ */
+ public function evaluate($other)
+ {
+ return $this->value > $other;
+ }
+
+ /**
+ * Returns a string representation of the constraint.
+ *
+ * @return string
+ * @access public
+ */
+ public function toString()
+ {
+ return 'is less than ' . PHPUnit_Util_Type::toString($this->value);
+ }
+}
+?>
Added: incubator/shindig/trunk/php/external/PHPUnit/Framework/Constraint/Not.php
URL: http://svn.apache.org/viewvc/incubator/shindig/trunk/php/external/PHPUnit/Framework/Constraint/Not.php?rev=681982&view=auto
==============================================================================
--- incubator/shindig/trunk/php/external/PHPUnit/Framework/Constraint/Not.php (added)
+++ incubator/shindig/trunk/php/external/PHPUnit/Framework/Constraint/Not.php Sat Aug 2 07:11:35 2008
@@ -0,0 +1,129 @@
+<?php
+/**
+ * PHPUnit
+ *
+ * Copyright (c) 2002-2008, Sebastian Bergmann <sb...@sebastian-bergmann.de>.
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * * Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ *
+ * * Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in
+ * the documentation and/or other materials provided with the
+ * distribution.
+ *
+ * * Neither the name of Sebastian Bergmann nor the names of his
+ * contributors may be used to endorse or promote products derived
+ * from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+ * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+ * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+ * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+ * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
+ * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+ * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ *
+ * @category Testing
+ * @package PHPUnit
+ * @author Jan Borsodi <jb...@ez.no>
+ * @author Sebastian Bergmann <sb...@sebastian-bergmann.de>
+ * @copyright 2002-2008 Sebastian Bergmann <sb...@sebastian-bergmann.de>
+ * @license http://www.opensource.org/licenses/bsd-license.php BSD License
+ * @version SVN: $Id: Not.php 1985 2007-12-26 18:11:55Z sb $
+ * @link http://www.phpunit.de/
+ * @since File available since Release 3.0.0
+ */
+
+require_once 'PHPUnit/Framework.php';
+require_once 'PHPUnit/Util/Filter.php';
+
+PHPUnit_Util_Filter::addFileToFilter(__FILE__, 'PHPUNIT');
+
+/**
+ * Logical NOT.
+ *
+ * @category Testing
+ * @package PHPUnit
+ * @author Jan Borsodi <jb...@ez.no>
+ * @author Sebastian Bergmann <sb...@sebastian-bergmann.de>
+ * @copyright 2002-2008 Sebastian Bergmann <sb...@sebastian-bergmann.de>
+ * @license http://www.opensource.org/licenses/bsd-license.php BSD License
+ * @version Release: 3.2.9
+ * @link http://www.phpunit.de/
+ * @since Class available since Release 3.0.0
+ */
+
+class PHPUnit_Framework_Constraint_Not extends PHPUnit_Framework_Constraint
+{
+ protected $constraint;
+
+ public function __construct($constraint)
+ {
+ if (!($constraint instanceof PHPUnit_Framework_Constraint)) {
+ $constraint = new PHPUnit_Framework_Constraint_IsEqual($constraint);
+ }
+
+ $this->constraint = $constraint;
+ }
+
+ /**
+ * Evaluates the constraint for parameter $other. Returns TRUE if the
+ * constraint is met, FALSE otherwise.
+ *
+ * @param mixed $other Value or object to evaluate.
+ * @return bool
+ */
+ public function evaluate($other)
+ {
+ return !$this->constraint->evaluate($other);
+ }
+
+ /**
+ * @param mixed $other The value passed to evaluate() which failed the
+ * constraint check.
+ * @param string $description A string with extra description of what was
+ * going on while the evaluation failed.
+ * @param boolean $not Flag to indicate negation.
+ * @throws PHPUnit_Framework_ExpectationFailedException
+ */
+ public function fail($other, $description, $not = FALSE)
+ {
+ $this->constraint->fail($other, $description, TRUE);
+ }
+
+ /**
+ * Returns a string representation of the constraint.
+ *
+ * @return string
+ * @access public
+ */
+ public function toString()
+ {
+ switch (get_class($this->constraint)) {
+ case 'PHPUnit_Framework_Constraint_And':
+ case 'PHPUnit_Framework_Constraint_Not':
+ case 'PHPUnit_Framework_Constraint_Or': {
+ return 'not( ' . $this->constraint->toString() . ' )';
+ }
+ break;
+
+ default: {
+ return PHPUnit_Framework_Constraint::negate(
+ $this->constraint->toString()
+ );
+ }
+ }
+ }
+}
+?>
Added: incubator/shindig/trunk/php/external/PHPUnit/Framework/Constraint/ObjectHasAttribute.php
URL: http://svn.apache.org/viewvc/incubator/shindig/trunk/php/external/PHPUnit/Framework/Constraint/ObjectHasAttribute.php?rev=681982&view=auto
==============================================================================
--- incubator/shindig/trunk/php/external/PHPUnit/Framework/Constraint/ObjectHasAttribute.php (added)
+++ incubator/shindig/trunk/php/external/PHPUnit/Framework/Constraint/ObjectHasAttribute.php Sat Aug 2 07:11:35 2008
@@ -0,0 +1,84 @@
+<?php
+/**
+ * PHPUnit
+ *
+ * Copyright (c) 2002-2008, Sebastian Bergmann <sb...@sebastian-bergmann.de>.
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * * Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ *
+ * * Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in
+ * the documentation and/or other materials provided with the
+ * distribution.
+ *
+ * * Neither the name of Sebastian Bergmann nor the names of his
+ * contributors may be used to endorse or promote products derived
+ * from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+ * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+ * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+ * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+ * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
+ * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+ * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ *
+ * @category Testing
+ * @package PHPUnit
+ * @author Sebastian Bergmann <sb...@sebastian-bergmann.de>
+ * @copyright 2002-2008 Sebastian Bergmann <sb...@sebastian-bergmann.de>
+ * @license http://www.opensource.org/licenses/bsd-license.php BSD License
+ * @version SVN: $Id: ObjectHasAttribute.php 1985 2007-12-26 18:11:55Z sb $
+ * @link http://www.phpunit.de/
+ * @since File available since Release 3.0.0
+ */
+
+require_once 'PHPUnit/Framework.php';
+require_once 'PHPUnit/Util/Filter.php';
+require_once 'PHPUnit/Util/Type.php';
+
+PHPUnit_Util_Filter::addFileToFilter(__FILE__, 'PHPUNIT');
+
+/**
+ * Constraint that asserts that the object it is evaluated for has a given
+ * attribute.
+ *
+ * The attribute name is passed in the constructor.
+ *
+ * @category Testing
+ * @package PHPUnit
+ * @author Sebastian Bergmann <sb...@sebastian-bergmann.de>
+ * @copyright 2002-2008 Sebastian Bergmann <sb...@sebastian-bergmann.de>
+ * @license http://www.opensource.org/licenses/bsd-license.php BSD License
+ * @version Release: 3.2.9
+ * @link http://www.phpunit.de/
+ * @since Class available since Release 3.0.0
+ */
+class PHPUnit_Framework_Constraint_ObjectHasAttribute extends PHPUnit_Framework_Constraint_ClassHasAttribute
+{
+ /**
+ * Evaluates the constraint for parameter $other. Returns TRUE if the
+ * constraint is met, FALSE otherwise.
+ *
+ * @param mixed $other Value or object to evaluate.
+ * @return bool
+ */
+ public function evaluate($other)
+ {
+ $object = new ReflectionObject($other);
+
+ return $object->hasProperty($this->attributeName);
+ }
+}
+?>