cvs: pear /PHPUnit2 package.xml /PHPUnit2/Framework/Constraint IsEqual.php /PHPUnit2/Util Array.php

From: Date: Sun, 26 Feb 2006 10:19:19 +0000
Subject: cvs: pear /PHPUnit2 package.xml /PHPUnit2/Framework/Constraint IsEqual.php /PHPUnit2/Util Array.php
Groups: php.pear.cvs 
Request: Send a blank email to pear-cvs+get-38632@lists.php.net to get a copy of this message
sebastian Sun Feb 26 10:19:19 2006 UTC Added files: /pear/PHPUnit2/Util Array.php Modified files: /pear/PHPUnit2/Framework/Constraint IsEqual.php /pear/PHPUnit2 package.xml Log: PHPUnit2_Framework_Constraint_IsEqual::sortArrayRecursively() -> PHPUnit2_Util_Array::sortRecursively() http://cvs.php.net/viewcvs.cgi/pear/PHPUnit2/Framework/Constraint/IsEqual.php?r1=1.5&r2=1.6&diff_format=u Index: pear/PHPUnit2/Framework/Constraint/IsEqual.php diff -u pear/PHPUnit2/Framework/Constraint/IsEqual.php:1.5 pear/PHPUnit2/Framework/Constraint/IsEqual.php:1.6 --- pear/PHPUnit2/Framework/Constraint/IsEqual.php:1.5 Sat Jan 21 12:01:00 2006 +++ pear/PHPUnit2/Framework/Constraint/IsEqual.php Sun Feb 26 10:19:19 2006 @@ -42,7 +42,7 @@ * Sebastian Bergmann <sb@sebastian-bergmann.de> * @copyright 2002-2006 Sebastian Bergmann <sb@sebastian-bergmann.de> * @license http://www.opensource.org/licenses/bsd-license.php BSD License - * @version CVS: $Id: IsEqual.php,v 1.5 2006/01/21 12:01:00 sebastian Exp $ + * @version CVS: $Id: IsEqual.php,v 1.6 2006/02/26 10:19:19 sebastian Exp $ * @link http://pear.php.net/package/PHPUnit2 * @since File available since Release 3.0.0 */ @@ -54,6 +54,7 @@ array( 'PHPUnit2_Framework_Constraint', 'PHPUnit2_Framework_ExpectationFailedException', + 'PHPUnit2_Util_Array', ) ); @@ -102,8 +103,8 @@ if (is_array($this->value)) { if (is_array($other)) { - $other = $this->sortArrayRecursively($other); - $value = $this->sortArrayRecursively($this->value); + $other = PHPUnit2_Util_Array::sortRecursively($other); + $value = PHPUnit2_Util_Array::sortRecursively($this->value); $equal = (serialize($value) == serialize($other)); } } @@ -139,26 +140,6 @@ } /** - * Sorts an array recursively by its keys. - * - * @param array $array - * @access private - * @author Adam Maccabee Trachtenberg <adam@trachtenberg.com> - */ - private function sortArrayRecursively(Array $array) - { - ksort($array); - - foreach($array as $k => $v) { - if (is_array($v)) { - $array[$k] = $this->sortArrayRecursively($array[$k]); - } - } - - return $array; - } - - /** * Returns a string representation of the constraint. * * @return string http://cvs.php.net/viewcvs.cgi/pear/PHPUnit2/package.xml?r1=1.173&r2=1.174&diff_format=u Index: pear/PHPUnit2/package.xml diff -u pear/PHPUnit2/package.xml:1.173 pear/PHPUnit2/package.xml:1.174 --- pear/PHPUnit2/package.xml:1.173 Sun Feb 26 06:44:46 2006 +++ pear/PHPUnit2/package.xml Sun Feb 26 10:19:19 2006 @@ -606,6 +606,9 @@ </file> </dir> + <file name="Array.php"> + <replace type="package-info" from="@package_version@" to="version"/> + </file> <file name="Classloader.php"> <replace type="package-info" from="@package_version@" to="version"/> </file> http://cvs.php.net/viewcvs.cgi/pear/PHPUnit2/Util/Array.php?view=markup&rev=1.1 Index: pear/PHPUnit2/Util/Array.php +++ pear/PHPUnit2/Util/Array.php <?php /* vim: set expandtab tabstop=4 shiftwidth=4 softtabstop=4: */ /** * PHP Version 5 * * Copyright (c) 2002-2006, 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, STRIC * 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 PHPUnit2 * @author Sebastian Bergmann <sb@sebastian-bergmann.de> * @copyright 2002-2006 Sebastian Bergmann <sb@sebastian-bergmann.de> * @license http://www.opensource.org/licenses/bsd-license.php BSD License * @version CVS: $Id: Array.php,v 1.1 2006/02/26 10:19:19 sebastian Exp $ * @link http://pear.php.net/package/PHPUnit2 * @since File available since Release 3.0.0 */ require_once 'PHPUnit2/Util/Filter.php'; PHPUnit2_Util_Filter::addFileToFilter(__FILE__); /** * Array helpers. * * @category Testing * @package PHPUnit2 * @author Sebastian Bergmann <sb@sebastian-bergmann.de> * @copyright 2002-2006 Sebastian Bergmann <sb@sebastian-bergmann.de> * @license http://www.opensource.org/licenses/bsd-license.php BSD License * @version Release: @package_version@ * @link http://pear.php.net/package/PHPUnit2 * @since Class available since Release 3.0.0 */ class PHPUnit2_Util_Array { /** * Sorts an array recursively by its keys. * * @param array $array * @access private * @author Adam Maccabee Trachtenberg <adam@trachtenberg.com> */ public static function sortRecursively(Array $array) { ksort($array); foreach($array as $k => $v) { if (is_array($v)) { $array[$k] = self::sortRecursively($array[$k]); } } return $array; } } /* * Local variables: * tab-width: 4 * c-basic-offset: 4 * c-hanging-comment-ender-p: nil * End: */ ?>

« previous php.pear.cvs (#38632) next »