Re: PHPUnit bugs/fixes

From: Date: Tue, 13 Aug 2002 02:08:45 +0000
Subject: Re: PHPUnit bugs/fixes
References: 1  Groups: php.pear.dev 
Request: Send a blank email to pear-dev+get-8340@lists.php.net to get a copy of this message
obviously - if they are failing like this - the default behaviour is actually 100% correct for a 'anally retentive' unit test :) I guess you are looking for a more 'loose' match there. eg. a == rather than a === yeah - looks like a recursive foreach is about the only solution there.. regards alan Wolfram Kriesing wrote:
i was using PHPUnit for some testing, 2 problems occured comparing arrays using
    serialize($expected) != serilaize($actual)
is not succedding because of 1. the order of the keys is not the same
    ksort($expected);
    ksort($actual);
    serialize($expected) != serilaize($actual)
this helps 2.
    even if the values are the same the types might not be
    see:
    a:6:{s:10:"address_id";i:0;    s:10:"company_id";i:0;  ...
    a:6:{s:10:"address_id";s:1:"0";s:10:"company_id";s:1:"0";  ...
    one solutions would be
    the array has to be foreach'ed to set all the types to 'string'
    and compare it then, that should work
any easier ways?


« previous php.pear.dev (#8340) next »