Changeset 276

Show
Ignore:
Timestamp:
10/07/06 00:48:25 (2 years ago)
Author:
laurentj
Message:

- fix d'erreurs strict dans simpletest
- corrections de bugs dans junittestcase::assertComplexIdenticalStr pour les tests
- corrections de bugs dans les tests unitaires sur les daos (mais toujours pas de bug dans les dao, ouf ! :-)

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • trunk/build/manifests/testapp.mn

    r256 r276  
    6363  utdao.class.php 
    6464  utdao2.class.php 
     65  utdao_conditions.class.php 
    6566cd testapp/modules/unittest/locales/fr_FR 
    6667  testunit.ISO-8859-1.properties 
  • trunk/lib/simpletest/authentication.php

    r275 r276  
    1010     */ 
    1111    require_once(dirname(__FILE__) . '/http.php'); 
    12      
     12 
    1313    /** 
    1414     *    Represents a single security realm's identity. 
     
    1717     */ 
    1818    class SimpleRealm { 
    19         var $_type; 
    20         var $_root; 
    21         var $_username; 
    22         var $_password; 
    23          
     19        protected $_type; 
     20        protected $_root; 
     21        protected $_username; 
     22        protected $_password; 
     23 
    2424        /** 
    2525         *    Starts with the initial entry directory. 
     
    3636            $this->_password = false; 
    3737        } 
    38          
     38 
    3939        /** 
    4040         *    Adds another location to the realm. 
     
    4545            $this->_root = $this->_getCommonPath($this->_root, $url->getPath()); 
    4646        } 
    47          
     47 
    4848        /** 
    4949         *    Finds the common starting path. 
     
    6363            return implode('/', $first) . '/'; 
    6464        } 
    65          
     65 
    6666        /** 
    6767         *    Sets the identity to try within this realm. 
     
    7474            $this->_password = $password; 
    7575        } 
    76          
     76 
    7777        /** 
    7878         *    Accessor for current identity. 
     
    8383            return $this->_username; 
    8484        } 
    85          
     85 
    8686        /** 
    8787         *    Accessor for current identity. 
     
    9292            return $this->_password; 
    9393        } 
    94          
     94 
    9595        /** 
    9696         *    Test to see if the URL is within the directory 
     
    109109            return false; 
    110110        } 
    111          
     111 
    112112        /** 
    113113         *    Tests to see if one string is a substring of 
     
    123123        } 
    124124    } 
    125      
     125 
    126126    /** 
    127127     *    Manages security realms. 
     
    130130     */ 
    131131    class SimpleAuthenticator { 
    132         var $_realms; 
    133          
     132        protected $_realms; 
     133 
    134134        /** 
    135135         *    Clears the realms. 
     
    139139            $this->restartSession(); 
    140140        } 
    141          
     141 
    142142        /** 
    143143         *    Starts with no realms set up. 
     
    147147            $this->_realms = array(); 
    148148        } 
    149          
     149 
    150150        /** 
    151151         *    Adds a new realm centered the current URL. 
     
    167167            $this->_realms[$url->getHost()][$realm] = new SimpleRealm($type, $url); 
    168168        } 
    169          
     169 
    170170        /** 
    171171         *    Sets the current identity to be presented 
     
    182182            } 
    183183        } 
    184          
     184 
    185185        /** 
    186186         *    Finds the name of the realm by comparing URLs. 
     
    200200            return false; 
    201201        } 
    202          
     202 
    203203        /** 
    204204         *    Presents the appropriate headers for this location. 
     
    219219            $this->addBasicHeaders($request, $username, $password); 
    220220        } 
    221          
     221 
    222222        /** 
    223223         *    Presents the appropriate headers for this 
  • trunk/lib/simpletest/encoding.php

    r275 r276  
    66     *  @version        $Id: encoding.php,v 1.17 2005/07/20 13:41:40 lastcraft Exp $ 
    77     */ 
    8       
     8 
    99    /**#@+ 
    1010     *  include other SimpleTest class files 
     
    1919     */ 
    2020    class SimpleEncodedPair { 
    21         var $_key; 
    22         var $_value; 
    23          
     21        protected $_key; 
     22        protected $_value; 
     23 
    2424        /** 
    2525         *    Stashes the data for rendering later. 
     
    3131            $this->_value = $value; 
    3232        } 
    33          
     33 
    3434        /** 
    3535         *    The pair as a single string. 
     
    4040            return $this->_key . '=' . urlencode($this->_value); 
    4141        } 
    42          
     42 
    4343        /** 
    4444         *    The MIME part as a string. 
     
    5252            return $part; 
    5353        } 
    54          
     54 
    5555        /** 
    5656         *    Is this the value we are looking for? 
     
    6262            return $key == $this->_key; 
    6363        } 
    64          
     64 
    6565        /** 
    6666         *    Is this the value we are looking for? 
     
    7171            return $this->_key; 
    7272        } 
    73          
     73 
    7474        /** 
    7575         *    Is this the value we are looking for? 
     
    9191        var $_content; 
    9292        var $_filename; 
    93          
     93 
    9494        /** 
    9595         *    Stashes the data for rendering later. 
     
    103103            $this->_filename = $filename; 
    104104        } 
    105          
     105 
    106106        /** 
    107107         *    The pair as a single string. 
     
    112112            return ''; 
    113113        } 
    114          
     114 
    115115        /** 
    116116         *    The MIME part as a string. 
     
    126126            return $part; 
    127127        } 
    128          
     128 
    129129        /** 
    130130         *    Attempts to figure out the MIME type from the 
     
    139139            return 'application/octet-stream'; 
    140140        } 
    141          
     141 
    142142        /** 
    143143         *    Tests each character is in the range 0-127. 
     
    153153            return true; 
    154154        } 
    155          
     155 
    156156        /** 
    157157         *    Is this the value we are looking for? 
     
    163163            return $key == $this->_key; 
    164164        } 
    165          
     165 
    166166        /** 
    167167         *    Is this the value we are looking for? 
     
    172172            return $this->_key; 
    173173        } 
    174          
     174 
    175175        /** 
    176176         *    Is this the value we are looking for? 
     
    191191    class SimpleEncoding { 
    192192        var $_request; 
    193          
     193 
    194194        /** 
    195195         *    Starts empty. 
     
    206206            $this->merge($query); 
    207207        } 
    208          
     208 
    209209        /** 
    210210         *    Empties the request of parameters. 
     
    214214            $this->_request = array(); 
    215215        } 
    216          
     216 
    217217        /** 
    218218         *    Adds a parameter to the query. 
     
    233233            } 
    234234        } 
    235          
     235 
    236236        /** 
    237237         *    Adds a new value into the request. 
     
    243243            $this->_request[] = new SimpleEncodedPair($key, $value); 
    244244        } 
    245          
     245 
    246246        /** 
    247247         *    Adds a MIME part to the query. Does nothing for a 
     
    255255            $this->_request[] = new SimpleAttachment($key, $content, $filename); 
    256256        } 
    257          
     257 
    258258        /** 
    259259         *    Adds a set of parameters to this query. 
     
    271271            } 
    272272        } 
    273          
     273 
    274274        /** 
    275275         *    Accessor for single value. 
     
    294294            } 
    295295        } 
    296          
     296 
    297297        /** 
    298298         *    Accessor for listing of pairs. 
     
    303303            return $this->_request; 
    304304        } 
    305          
     305 
    306306        /** 
    307307         *    Renders the query string as a URL encoded 
     
    320320        } 
    321321    } 
    322      
     322 
    323323    /** 
    324324     *    Bundle of GET parameters. Can include 
     
    328328     */ 
    329329    class SimpleGetEncoding extends SimpleEncoding { 
    330          
     330 
    331331        /** 
    332332         *    Starts empty. 
     
    339339            $this->SimpleEncoding($query); 
    340340        } 
    341          
     341 
    342342        /** 
    343343         *    HTTP request method. 
     
    348348            return 'GET'; 
    349349        } 
    350          
     350 
    351351        /** 
    352352         *    Writes no extra headers. 
     
    356356        function writeHeadersTo(&$socket) { 
    357357        } 
    358          
     358 
    359359        /** 
    360360         *    No data is sent to the socket as the data is encoded into 
     
    365365        function writeTo(&$socket) { 
    366366        } 
    367          
     367 
    368368        /** 
    369369         *    Renders the query string as a URL encoded 
     
    376376        } 
    377377    } 
    378      
     378 
    379379    /** 
    380380     *    Bundle of URL parameters for a HEAD request. 
     
    383383     */ 
    384384    class SimpleHeadEncoding extends SimpleGetEncoding { 
    385          
     385 
    386386        /** 
    387387         *    Starts empty. 
     
    394394            $this->SimpleGetEncoding($query); 
    395395        } 
    396          
     396 
    397397        /** 
    398398         *    HTTP request method. 
     
    404404        } 
    405405    } 
    406      
     406 
    407407    /** 
    408408     *    Bundle of POST parameters. Can include 
     
    412412     */ 
    413413    class SimplePostEncoding extends SimpleEncoding { 
    414          
     414 
    415415        /** 
    416416         *    Starts empty. 
     
    423423            $this->SimpleEncoding($query); 
    424424        } 
    425          
     425 
    426426        /** 
    427427         *    HTTP request method. 
     
    432432            return 'POST'; 
    433433        } 
    434          
     434 
    435435        /** 
    436436         *    Dispatches the form headers down the socket. 
     
    442442            $socket->write("Content-Type: application/x-www-form-urlencoded\r\n"); 
    443443        } 
    444          
     444 
    445445        /** 
    446446         *    Dispatches the form data down the socket. 
     
    451451            $socket->write($this->_encode()); 
    452452        } 
    453          
     453 
    454454        /** 
    455455         *    Renders the query string as a URL encoded 
     
    462462        } 
    463463    } 
    464      
     464 
    465465    /** 
    466466     *    Bundle of POST parameters in the multipart 
     
    471471    class SimpleMultipartEncoding extends SimplePostEncoding { 
    472472        var $_boundary; 
    473          
     473 
    474474        /** 
    475475         *    Starts empty. 
     
    483483            $this->_boundary = ($boundary === false ? uniqid('st') : $boundary); 
    484484        } 
    485          
     485 
    486486        /** 
    487487         *    Dispatches the form headers down the socket. 
     
    493493            $socket->write("Content-Type: multipart/form-data, boundary=" . $this->_boundary . "\r\n"); 
    494494        } 
    495          
     495 
    496496        /** 
    497497         *    Dispatches the form data down the socket. 
     
    502502            $socket->write($this->_encode()); 
    503503        } 
    504          
     504 
    505505        /** 
    506506         *    Renders the query string as a URL encoded 
  • trunk/lib/simpletest/errors.php

    r275 r276  
    5959     */ 
    6060    class SimpleErrorQueue { 
    61         var $_queue; 
     61        protected $_queue; 
    6262 
    6363        /** 
     
    122122         *    @static 
    123123         */ 
    124         function &instance() { 
     124        static function &instance() { 
    125125            static $queue = false; 
    126126            if (! $queue) { 
     
    138138         *    @static 
    139139         */ 
    140         function getSeverityAsString($severity) { 
     140        static function getSeverityAsString($severity) { 
    141141            static $map = array( 
    142142                    E_STRICT => 'E_STRICT', 
     
    175175                error_log("$label: $message in $filename on line $line"); 
    176176            } 
    177             $queue = &SimpleErrorQueue::instance(); 
     177            $queue = SimpleErrorQueue::instance(); 
    178178            $queue->add($severity, $message, $filename, $line, $super_globals); 
    179179            set_error_handler('simpleTestErrorHandler'); 
  • trunk/lib/simpletest/expectation.php

    r275 r276  
    66     *    @version    $Id: expectation.php,v 1.43 2006/02/05 02:04:24 lastcraft Exp $ 
    77     */ 
    8       
     8 
    99    /**#@+ 
    1010     *    include other SimpleTest class files 
     
    1313    require_once(dirname(__FILE__) . '/compatibility.php'); 
    1414    /**#@-*/ 
    15      
     15 
    1616    /** 
    1717     *    Assertion that can display failure information. 
     
    2222     */ 
    2323    class SimpleExpectation { 
    24         var $_dumper; 
    25         var $_message; 
    26          
     24        protected $_dumper; 
     25        protected $_message; 
     26 
    2727        /** 
    2828         *    Creates a dumper for displaying values and sets 
     
    3131         */ 
    3232        function SimpleExpectation($message = '%s') { 
    33             $this->_dumper = &new SimpleDumper(); 
     33            $this->_dumper = new SimpleDumper(); 
    3434            $this->_message = $message; 
    3535        } 
    36          
     36 
    3737        /** 
    3838         *    Tests the expectation. True if correct. 
     
    4444        function test($compare) { 
    4545        } 
    46          
     46 
    4747        /** 
    4848         *    Returns a human readable test message. 
     
    5555        function testMessage($compare) { 
    5656        } 
    57          
     57 
    5858        /** 
    5959         *    Overlays the generated message onto the stored user 
     
    6767            return sprintf($this->_message, $this->testMessage($compare)); 
    6868        } 
    69          
     69 
    7070        /** 
    7171         *    Accessor for the dumper. 
     
    7676            return $this->_dumper; 
    7777        } 
    78          
     78 
    7979        /** 
    8080         *    Test to see if a value is an expectation object. 
     
    9292        } 
    9393    } 
    94      
     94 
    9595    /** 
    9696     *    Test for equality. 
     
    9999     */ 
    100100    class EqualExpectation extends SimpleExpectation { 
    101         var $_value; 
    102          
     101        protected $_value; 
     102 
    103103        /** 
    104104         *    Sets the value to compare against. 
     
    111111            $this->_value = $value; 
    112112        } 
    113          
     113 
    114114        /** 
    115115         *    Tests the expectation. True if it matches the 
     
    122122            return (($this->_value == $compare) && ($compare == $this->_value)); 
    123123        } 
    124          
     124 
    125125        /** 
    126126         *    Returns a human readable test message. 
     
    148148        } 
    149149    } 
    150      
     150 
    151151    /** 
    152152     *    Test for inequality. 
     
    155155     */ 
    156156    class NotEqualExpectation extends EqualExpectation { 
    157          
     157 
    158158        /** 
    159159         *    Sets the value to compare against. 
     
    165165            $this->EqualExpectation($value, $message); 
    166166        } 
    167          
     167 
    168168        /** 
    169169         *    Tests the expectation. True if it differs from the 
     
    176176            return ! parent::test($compare); 
    177177        } 
    178          
     178 
    179179        /** 
    180180         *    Returns a human readable test message. 
     
    196196        } 
    197197    } 
    198      
     198 
    199199    /** 
    200200     *    Test for being within a range. 
     
    203203     */ 
    204204    class WithinMarginExpectation extends SimpleExpectation { 
    205         var $_upper; 
    206         var $_lower; 
    207          
     205        protected $_upper; 
     206        protected $_lower; 
     207 
    208208        /** 
    209209         *    Sets the value to compare against and the fuzziness of 
     
    219219            $this->_lower = $value - $margin; 
    220220        } 
    221          
     221 
    222222        /** 
    223223         *    Tests the expectation. True if it matches the 
     
    230230            return (($compare <= $this->_upper) && ($compare >= $this->_lower)); 
    231231        } 
    232          
     232 
    233233        /** 
    234234         *    Returns a human readable test message. 
     
    245245            } 
    246246        } 
    247          
     247 
    248248        /** 
    249249         *    Creates a the message for being within the range. 
     
    255255                    $this->_dumper->describeValue($this->_upper) . "]"; 
    256256        } 
    257          
     257 
    258258        /** 
    259259         *    Creates a the message for being within the range. 
     
    271271        } 
    272272    } 
    273      
     273 
    274274    /** 
    275275     *    Test for being outside of a range. 
     
    278278     */ 
    279279    class OutsideMarginExpectation extends WithinMarginExpectation { 
    280          
     280 
    281281        /** 
    282282         *    Sets the value to compare against and the fuzziness of 
     
    290290            $this->WithinMarginExpectation($value, $margin, $message); 
    291291        } 
    292          
     292 
    293293        /** 
    294294         *    Tests the expectation. True if it matches the 
     
    301301            return ! parent::test($compare); 
    302302        } 
    303          
     303 
    304304        /** 
    305305         *    Returns a human readable test message. 
     
    317317        } 
    318318    } 
    319      
     319 
    320320    /** 
    321321     *    Test for identity. 
     
    324324     */ 
    325325    class IdenticalExpectation extends EqualExpectation { 
    326          
     326 
    327327        /** 
    328328         *    Sets the value to compare against. 
     
    334334            $this->EqualExpectation($value, $message); 
    335335        } 
    336          
     336 
    337337        /** 
    338338         *    Tests the expectation. True if it exactly 
     
    345345            return SimpleTestCompatibility::isIdentical($this->_getValue(), $compare); 
    346346        } 
    347          
     347 
    348348        /** 
    349349         *    Returns a human readable test message. 
     
    365365        } 
    366366    } 
    367      
     367 
    368368    /** 
    369369     *    Test for non-identity. 
     
    372372     */ 
    373373    class NotIdenticalExpectation extends IdenticalExpectation { 
    374          
     374 
    375375        /** 
    376376         *    Sets the value to compare against. 
     
    382382            $this->IdenticalExpectation($value, $message); 
    383383        } 
    384          
     384 
    385385        /** 
    386386         *    Tests the expectation. True if it differs from the 
     
    393393            return ! parent::test($compare); 
    394394        } 
    395          
     395 
    396396        /** 
    397397         *    Returns a human readable test message. 
     
    411411        } 
    412412    } 
    413      
     413 
    414414    /** 
    415415     *    Test for a pattern using Perl regex rules. 
     
    418418     */ 
    419419    class PatternExpectation extends SimpleExpectation { 
    420         var $_pattern; 
    421          
     420        protected $_pattern; 
     421 
    422422        /** 
    423423         *    Sets the value to compare against. 
     
    430430            $this->_pattern = $pattern; 
    431431        } 
    432          
     432 
    433433        /** 
    434434         *    Accessor for the pattern. 
     
    439439            return $this->_pattern; 
    440440        } 
    441          
     441 
    442442        /** 
    443443         *    Tests the expectation. True if the Perl regex 
     
    450450            return (boolean)preg_match($this->_getPattern(), $compare); 
    451451        } 
    452          
     452 
    453453        /** 
    454454         *    Returns a human readable test message. 
     
    468468            } 
    469469        } 
    470          
     470 
    471471        /** 
    472472         *    Describes a pattern match including the string 
     
    488488        } 
    489489    } 
    490      
     490 
    491491    /** 
    492492     *      @deprecated 
     
    494494    class WantedPatternExpectation extends PatternExpectation { 
    495495    } 
    496      
     496 
    497497    /** 
    498498     *    Fail if a pattern is detected within the 
     
    502502     */ 
    503503    class NoPatternExpectation extends PatternExpectation { 
    504          
     504 
    505505        /** 
    506506         *    Sets the reject pattern 
     
    512512            $this->PatternExpectation($pattern, $message); 
    513513        } 
    514          
     514 
    515515        /** 
    516516         *    Tests the expectation. False if the Perl regex 
     
    523523            return ! parent::test($compare); 
    524524        } 
    525          
     525 
    526526        /** 
    527527         *    Returns a human readable test message. 
     
    542542        } 
    543543    } 
    544      
     544 
    545545    /** 
    546546     *    @package SimpleTest 
     
    550550    class UnwantedPatternExpectation extends NoPatternExpectation { 
    551551    } 
    552      
     552 
    553553    /** 
    554554     *    Tests either type or class name if it's an object. 
     
    557557     */ 
    558558    class IsAExpectation extends SimpleExpectation { 
    559         var $_type; 
    560          
     559        protected $_type; 
     560 
    561561        /** 
    562562         *    Sets the type to compare with. 
     
    569569            $this->_type = $type; 
    570570        } 
    571          
     571 
    572572        /** 
    573573         *    Accessor for type to check against. 
     
    578578            return $this->_type; 
    579579        } 
    580          
     580 
    581581        /** 
    582582         *    Tests the expectation. True if the type or 
     
    626626        } 
    627627    } 
    628      
     628 
    629629    /** 
    630630     *    Tests either type or class name if it's an object. 
     
    634634     */ 
    635635    class NotAExpectation extends IsAExpectation { 
    636         var $_type; 
    637          
     636        protected $_type; 
     637 
    638638        /** 
    639639         *    Sets the type to compare with. 
     
    645645            $this->IsAExpectation($type, $message); 
    646646        } 
    647          
     647 
    648648        /** 
    649649         *    Tests the expectation. False if the type or 
     
    677677     */ 
    678678    class MethodExistsExpectation extends SimpleExpectation { 
    679         var $_method; 
    680          
     679        protected $_method; 
     680 
    681681        /** 
    682682         *    Sets the value to compare against. 
     
    690690            $this->_method = &$method; 
    691691        } 
    692          
     692 
    693693        /** 
    694694         *    Tests the expectation. True if the method exists in the test object. 
     
    700700            return (boolean)(is_object($compare) && method_exists($compare, $this->_method)); 
    701701        } 
    702          
     702 
    703703        /** 
    704704         *    Returns a human readable test message. 
  • trunk/lib/simpletest/invoker.php

    r275 r276  
    2929     */ 
    3030    class SimpleInvoker { 
    31         var $_test_case; 
     31        protected $_test_case; 
    3232 
    3333        /** 
     
    8888     */ 
    8989    class SimpleInvokerDecorator { 
    90         var $_invoker; 
     90        protected $_invoker; 
    9191 
    9292        /** 
  • trunk/lib/simpletest/parser.php

    r275 r276  
    2626    } 
    2727    /**#@-*/ 
    28      
     28 
    2929    /** 
    3030     *    Compounded regular expression. Any of 
     
    3535     */ 
    3636    class ParallelRegex { 
    37         var $_patterns; 
    38         var $_labels; 
    39         var $_regex; 
    40         var $_case; 
    41          
     37        protected $_patterns; 
     38        protected $_labels; 
     39        protected $_regex; 
     40        protected $_case; 
     41 
    4242        /** 
    4343         *    Constructor. Starts with no patterns. 
     
    5252            $this->_regex = null; 
    5353        } 
    54          
     54 
    5555        /** 
    5656         *    Adds a pattern with an optional label. 
     
    6767            $this->_regex = null; 
    6868        } 
    69          
     69 
    7070        /** 
    7171         *    Attempts to match all patterns at once against 
     
    9393            return true; 
    9494        } 
    95          
     95 
    9696        /** 
    9797         *    Compounds the patterns into a single 
     
    114114            return $this->_regex; 
    115115        }