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

1.1       misho       1: --TEST--
                      2: SPL: FixedArray: std operations
                      3: --INI--
                      4: allow_call_time_pass_reference=1
                      5: --FILE--
                      6: <?php
                      7: $a = new SplFixedArray(0);
                      8: // errors
                      9: try {
                     10:     $a[0] = "value1";
                     11: } catch (RuntimeException $e) {
                     12:     echo "Exception: ".$e->getMessage()."\n";
                     13: }
                     14: try {
                     15:     var_dump($a["asdf"]);
                     16: } catch (RuntimeException $e) {
                     17:     echo "Exception: ".$e->getMessage()."\n";
                     18: }
                     19: try {
                     20:     unset($a[-1]);
                     21: } catch (RuntimeException $e) {
                     22:     echo "Exception: ".$e->getMessage()."\n";
                     23: }
                     24: $a->setSize(10);
                     25: 
                     26: 
                     27: $a[0] = "value0";
                     28: $a[1] = "value1";
                     29: $a[2] = "value2";
                     30: $a[3] = "value3";
                     31: $ref = "value4";
                     32: $ref2 =&$ref;
                     33: $a[4] = $ref;
                     34: $ref = "value5";
                     35: 
                     36: unset($a[1]);
                     37: 
                     38: var_dump($a[0], $a[2], $a[3], $a[4]);
                     39: 
                     40: // countable
                     41: 
                     42: var_dump(count($a), $a->getSize(), count($a) == $a->getSize());
                     43: 
                     44: // clonable
                     45: $b = clone $a;
                     46: $a[0] = "valueNew";
                     47: var_dump($b[0]);
                     48: ?>
                     49: ===DONE===
                     50: --EXPECTF--
                     51: Exception: Index invalid or out of range
                     52: Exception: Index invalid or out of range
                     53: Exception: Index invalid or out of range
                     54: string(6) "value0"
                     55: string(6) "value2"
                     56: string(6) "value3"
                     57: string(6) "value4"
                     58: int(10)
                     59: int(10)
                     60: bool(true)
                     61: string(6) "value0"
                     62: ===DONE===

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