Annotation of embedaddon/php/ext/spl/tests/arrayObject_asort_basic1.phpt, revision 1.1.1.2
1.1 misho 1: --TEST--
2: SPL: Test ArrayObject::asort() function : basic functionality with array based store
3: --FILE--
4: <?php
5: /* Prototype : int ArrayObject::asort()
6: * Description: proto int ArrayIterator::asort()
7: * Sort the entries by values.
8: * Source code: ext/spl/spl_array.c
9: * Alias to functions:
10: */
11:
12: echo "*** Testing ArrayObject::asort() : basic functionality ***\n";
13:
14: $ao1 = new ArrayObject(array(4,2,3));
15: $ao2 = new ArrayObject(array('a'=>4,'b'=>2,'c'=>3));
16: var_dump($ao1->asort());
17: var_dump($ao1);
18: var_dump($ao2->asort('blah'));
19: var_dump($ao2);
1.1.1.2 ! misho 20: var_dump($ao2->asort(SORT_NUMERIC));
! 21: var_dump($ao2);
1.1 misho 22: ?>
23: ===DONE===
24: --EXPECTF--
25: *** Testing ArrayObject::asort() : basic functionality ***
26: bool(true)
1.1.1.2 ! misho 27: object(ArrayObject)#%d (1) {
1.1 misho 28: ["storage":"ArrayObject":private]=>
29: array(3) {
30: [1]=>
31: int(2)
32: [2]=>
33: int(3)
34: [0]=>
35: int(4)
36: }
37: }
1.1.1.2 ! misho 38:
! 39: Warning: asort() expects parameter 2 to be long, string given in %sarrayObject_asort_basic1.php on line %d
! 40: bool(false)
! 41: object(ArrayObject)#%d (1) {
! 42: ["storage":"ArrayObject":private]=>
! 43: array(3) {
! 44: ["a"]=>
! 45: int(4)
! 46: ["b"]=>
! 47: int(2)
! 48: ["c"]=>
! 49: int(3)
! 50: }
! 51: }
1.1 misho 52: bool(true)
1.1.1.2 ! misho 53: object(ArrayObject)#%d (1) {
1.1 misho 54: ["storage":"ArrayObject":private]=>
55: array(3) {
56: ["b"]=>
57: int(2)
58: ["c"]=>
59: int(3)
60: ["a"]=>
61: int(4)
62: }
63: }
64: ===DONE===
FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>