]> granicus.if.org Git - php/commitdiff
Adding tests for the negative results of array_column()
authorBen Ramsey <ramsey@php.net>
Sat, 14 Apr 2012 04:43:04 +0000 (23:43 -0500)
committerBen Ramsey <ramsey@php.net>
Fri, 11 Jan 2013 20:16:19 +0000 (14:16 -0600)
ext/standard/tests/array/array_column.phpt

index 08df3b8df9c15a48d14e437fe22a1f00d6b4dd07..8beb0c23c012c921a407976618ae0f91fd4b43b8 100644 (file)
@@ -82,6 +82,14 @@ $numericCols = array(
 );
 var_dump(array_column($numericCols, 1));
 
+echo "\n*** Testing failure to find specified column ***\n";
+var_dump(array_column($numericCols, 2));
+var_dump(array_column($numericCols, 'foo'));
+
+echo "\n*** Testing single dimensional array ***\n";
+$singleDimension = array('foo', 'bar', 'baz');
+var_dump(array_column($singleDimension, 1));
+
 echo "Done\n";
 ?>
 --EXPECTF--
@@ -135,4 +143,14 @@ array(3) {
   [2]=>
   string(3) "333"
 }
+
+*** Testing failure to find specified column ***
+array(0) {
+}
+array(0) {
+}
+
+*** Testing single dimensional array ***
+array(0) {
+}
 Done