Annotation of embedaddon/php/ext/spl/tests/SplObjectStorage_offsetGet_invalid_parameter.phpt, revision 1.1.1.1

1.1       misho       1: --TEST--
                      2: Check that SplObjectStorage::offsetGet generate a warning and return NULL when passed non-object param
                      3: --CREDITS--
                      4: PHPNW Testfest 2009 - Simon Westcott (swestcott@gmail.com)
                      5: --FILE--
                      6: <?php
                      7: 
                      8: $data_provider = array(
                      9:        array(),
                     10:        true,
                     11:        "string",
                     12:        12345,
                     13:        1.2345,
                     14:        NULL
                     15: );
                     16: 
                     17: foreach($data_provider as $input) {
                     18: 
                     19:        $s = new SplObjectStorage();
                     20:        $o1 = new stdClass();
                     21:        $s[$o1] = 'some_value';
                     22: 
                     23:        var_dump($s->offsetGet($input));
                     24: }
                     25: 
                     26: ?>
                     27: --EXPECTF--
                     28: Warning: SplObjectStorage::offsetGet() expects parameter 1 to be object, array given in %s on line %d
                     29: NULL
                     30: 
                     31: Warning: SplObjectStorage::offsetGet() expects parameter 1 to be object, boolean given in %s on line %d
                     32: NULL
                     33: 
                     34: Warning: SplObjectStorage::offsetGet() expects parameter 1 to be object, %unicode_string_optional% given in %s on line %d
                     35: NULL
                     36: 
                     37: Warning: SplObjectStorage::offsetGet() expects parameter 1 to be object, integer given in %s on line %d
                     38: NULL
                     39: 
                     40: Warning: SplObjectStorage::offsetGet() expects parameter 1 to be object, double given in %s on line %d
                     41: NULL
                     42: 
                     43: Warning: SplObjectStorage::offsetGet() expects parameter 1 to be object, null given in %s on line %d
                     44: NULL
                     45: 

FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>