diff options
| author | Lorry Tar Creator <lorry-tar-importer@baserock.org> | 2013-03-14 05:42:27 +0000 |
|---|---|---|
| committer | <> | 2013-04-03 16:25:08 +0000 |
| commit | c4dd7a1a684490673e25aaf4fabec5df138854c4 (patch) | |
| tree | 4d57c44caae4480efff02b90b9be86f44bf25409 /ext/spl/tests/arrayObject_asort_basic1.phpt | |
| download | php2-master.tar.gz | |
Imported from /home/lorry/working-area/delta_php2/php-5.4.13.tar.bz2.HEADphp-5.4.13master
Diffstat (limited to 'ext/spl/tests/arrayObject_asort_basic1.phpt')
| -rw-r--r-- | ext/spl/tests/arrayObject_asort_basic1.phpt | 64 |
1 files changed, 64 insertions, 0 deletions
diff --git a/ext/spl/tests/arrayObject_asort_basic1.phpt b/ext/spl/tests/arrayObject_asort_basic1.phpt new file mode 100644 index 0000000..53df1d5 --- /dev/null +++ b/ext/spl/tests/arrayObject_asort_basic1.phpt @@ -0,0 +1,64 @@ +--TEST-- +SPL: Test ArrayObject::asort() function : basic functionality with array based store +--FILE-- +<?php +/* Prototype : int ArrayObject::asort() + * Description: proto int ArrayIterator::asort() + * Sort the entries by values. + * Source code: ext/spl/spl_array.c + * Alias to functions: + */ + +echo "*** Testing ArrayObject::asort() : basic functionality ***\n"; + +$ao1 = new ArrayObject(array(4,2,3)); +$ao2 = new ArrayObject(array('a'=>4,'b'=>2,'c'=>3)); +var_dump($ao1->asort()); +var_dump($ao1); +var_dump($ao2->asort('blah')); +var_dump($ao2); +var_dump($ao2->asort(SORT_NUMERIC)); +var_dump($ao2); +?> +===DONE=== +--EXPECTF-- +*** Testing ArrayObject::asort() : basic functionality *** +bool(true) +object(ArrayObject)#%d (1) { + ["storage":"ArrayObject":private]=> + array(3) { + [1]=> + int(2) + [2]=> + int(3) + [0]=> + int(4) + } +} + +Warning: asort() expects parameter 2 to be long, string given in %sarrayObject_asort_basic1.php on line %d +bool(false) +object(ArrayObject)#%d (1) { + ["storage":"ArrayObject":private]=> + array(3) { + ["a"]=> + int(4) + ["b"]=> + int(2) + ["c"]=> + int(3) + } +} +bool(true) +object(ArrayObject)#%d (1) { + ["storage":"ArrayObject":private]=> + array(3) { + ["b"]=> + int(2) + ["c"]=> + int(3) + ["a"]=> + int(4) + } +} +===DONE=== |
