return $n * $n;
}
}
-var_dump( array_map(array('SimpleClass', 'square'), array(1, 2)) );
+function test($cb, $args) {
+ echo join('::', $cb) . "\n";
+ var_dump(array_map($cb, $args));
+}
+test(array('SimpleClass', 'square'), array(1, 2));
echo "\n-- simple class with private variable and method --\n";
class SimpleClassPri
return $var + $n;
}
}
-var_dump( array_map(array('SimpleClassPri', 'add'), array(1)) );
+test(array('SimpleClassPri', 'add'), array(1));
echo "\n-- simple class with protected variable and method --\n";
class SimpleClassPro
return $var1 * $n;
}
}
-var_dump( array_map(array('SimpleClassPro', 'mul'), array(2)) );
+test(array('SimpleClassPro', 'mul'), array(2));
-echo "\n-- class without members --";
+echo "\n-- class without members --\n";
class EmptyClass
{
}
-var_dump( array_map(array('EmptyClass'), array(1, 2)) );
+test(array('EmptyClass'), array(1, 2));
-echo "\n-- abstract class --";
+echo "\n-- abstract class --\n";
abstract class AbstractClass
{
protected $var2 = 5;
echo "defined in child";
}
}
-var_dump( array_map(array('ChildClass', 'emptyFunction'), array(1, 2)) );
+test(array('ChildClass', 'emptyFunction'), array(1, 2));
-echo "\n-- class with final method --";
+echo "\n-- class with final method --\n";
class FinalClass
{
private $var4;
echo "This function can't be overloaded";
}
}
-var_dump( array_map(array('FinalClass', 'finalMethod'), array(1, 2)) );
+test(array('FinalClass', 'finalMethod'), array(1, 2));
echo "\n-- class with static members --\n";
class StaticClass
return array($n);
}
}
-var_dump( array_map(array('StaticClass', 'square'), array(1, 2)) );
-var_dump( array_map(array('StaticClass', 'cube'), array(2)) );
-var_dump( array_map(array('StaticClass', 'retVal'), array(3, 4)) );
+test(array('StaticClass', 'square'), array(1, 2));
+test(array('StaticClass', 'cube'), array(2));
+test(array('StaticClass', 'retVal'), array(3, 4));
-echo "-- class implementing an interface --\n";
+echo "\n-- class implementing an interface --\n";
interface myInterface
{
public function toImplement();
return 1;
}
}
-var_dump( array_map(array('InterClass', 'square'), array(1, 2)));
+test(array('InterClass', 'square'), array(1, 2));
-echo "Done";
?>
+===DONE===
+<?php exit(0); ?>
--EXPECTF--
*** Testing array_map() : object functionality ***
-- simple class with public variable and method --
+SimpleClass::square
-Strict Standards: array_map() expects parameter 1 to be a valid callback, non-static method SimpleClass::square() should not be called statically in %s on line %d
+Strict Standards: array_map() expects parameter 1 to be a valid callback, non-static method SimpleClass::square() should not be called statically in %sarray_map_object1.php on line %d
-Strict Standards: Non-static method SimpleClass::square() should not be called statically in %s on line %d
+Strict Standards: Non-static method SimpleClass::square() should not be called statically in %sarray_map_object1.php on line %d
-Strict Standards: Non-static method SimpleClass::square() should not be called statically in %s on line %d
+Strict Standards: Non-static method SimpleClass::square() should not be called statically in %sarray_map_object1.php on line %d
array(2) {
[0]=>
int(1)
}
-- simple class with private variable and method --
+SimpleClassPri::add
-Warning: array_map() expects parameter 1 to be a valid callback, cannot access private method SimpleClassPri::add() in %s on line %d
+Warning: array_map() expects parameter 1 to be a valid callback, cannot access private method SimpleClassPri::add() in %sarray_map_object1.php on line %d
NULL
-- simple class with protected variable and method --
+SimpleClassPro::mul
-Warning: array_map() expects parameter 1 to be a valid callback, cannot access protected method SimpleClassPro::mul() in %s on line %d
+Warning: array_map() expects parameter 1 to be a valid callback, cannot access protected method SimpleClassPro::mul() in %sarray_map_object1.php on line %d
NULL
-- class without members --
-Warning: array_map() expects parameter 1 to be a valid callback, array must have exactly two members in %s on line %d
-NULL
-
--- abstract class --
-Strict Standards: array_map() expects parameter 1 to be a valid callback, non-static method ChildClass::emptyFunction() should not be called statically in %s on line %d
-
-Strict Standards: Non-static method ChildClass::emptyFunction() should not be called statically in %s on line %d
-defined in child
-Strict Standards: Non-static method ChildClass::emptyFunction() should not be called statically in %s on line %d
-defined in childarray(2) {
- [0]=>
- NULL
- [1]=>
- NULL
-}
-
--- class with final method --
-Strict Standards: array_map() expects parameter 1 to be a valid callback, non-static method FinalClass::finalMethod() should not be called statically in %s on line %d
-
-Strict Standards: Non-static method FinalClass::finalMethod() should not be called statically in %s on line %d
-This function can't be overloaded
-Strict Standards: Non-static method FinalClass::finalMethod() should not be called statically in %s on line %d
-This function can't be overloadedarray(2) {
- [0]=>
- NULL
- [1]=>
- NULL
-}
-
--- class with static members --
-array(2) {
- [0]=>
- int(1)
- [1]=>
- int(4)
-}
-
-Warning: array_map() expects parameter 1 to be a valid callback, cannot access private method StaticClass::cube() in %s on line %d
-NULL
+EmptyClass
-Warning: array_map() expects parameter 1 to be a valid callback, cannot access protected method StaticClass::retVal() in %s on line %d
-NULL
--- class implementing an interface --
-array(2) {
- [0]=>
- int(1)
- [1]=>
- int(4)
-}
-Done
---UEXPECTF--
-*** Testing array_map() : object functionality ***
--- simple class with public variable and method --
-
-Strict Standards: array_map() expects parameter 1 to be a valid callback, non-static method SimpleClass::square() should not be called statically in %s on line %d
-
-Strict Standards: Non-static method SimpleClass::square() should not be called statically in %s on line %d
-
-Strict Standards: Non-static method SimpleClass::square() should not be called statically in %s on line %d
-array(2) {
- [0]=>
- int(1)
- [1]=>
- int(4)
-}
-
--- simple class with private variable and method --
-
-Warning: array_map() expects parameter 1 to be a valid callback, cannot access private method SimpleClassPri::add() in %s on line %d
-NULL
-
--- simple class with protected variable and method --
-
-Warning: array_map() expects parameter 1 to be a valid callback, cannot access protected method SimpleClassPro::mul() in %s on line %d
-NULL
-
--- class without members --
-Warning: array_map() expects parameter 1 to be a valid callback, array must have exactly two members in %s on line %d
+Warning: array_map() expects parameter 1 to be a valid callback, array must have exactly two members in %sarray_map_object1.php on line %d
NULL
-- abstract class --
-Strict Standards: array_map() expects parameter 1 to be a valid callback, non-static method ChildClass::emptyFunction() should not be called statically in %s on line %d
+ChildClass::emptyFunction
+
+Strict Standards: array_map() expects parameter 1 to be a valid callback, non-static method ChildClass::emptyFunction() should not be called statically in %sarray_map_object1.php on line %d
-Strict Standards: Non-static method ChildClass::emptyFunction() should not be called statically in %s on line %d
+Strict Standards: Non-static method ChildClass::emptyFunction() should not be called statically in %sarray_map_object1.php on line %d
defined in child
-Strict Standards: Non-static method ChildClass::emptyFunction() should not be called statically in %s on line %d
+Strict Standards: Non-static method ChildClass::emptyFunction() should not be called statically in %sarray_map_object1.php on line %d
defined in childarray(2) {
[0]=>
NULL
}
-- class with final method --
-Strict Standards: array_map() expects parameter 1 to be a valid callback, non-static method FinalClass::finalMethod() should not be called statically in %s on line %d
+FinalClass::finalMethod
-Strict Standards: Non-static method FinalClass::finalMethod() should not be called statically in %s on line %d
+Strict Standards: array_map() expects parameter 1 to be a valid callback, non-static method FinalClass::finalMethod() should not be called statically in %sarray_map_object1.php on line %d
+
+Strict Standards: Non-static method FinalClass::finalMethod() should not be called statically in %sarray_map_object1.php on line %d
This function can't be overloaded
-Strict Standards: Non-static method FinalClass::finalMethod() should not be called statically in %s on line %d
+Strict Standards: Non-static method FinalClass::finalMethod() should not be called statically in %sarray_map_object1.php on line %d
This function can't be overloadedarray(2) {
[0]=>
NULL
}
-- class with static members --
+StaticClass::square
array(2) {
[0]=>
int(1)
[1]=>
int(4)
}
+StaticClass::cube
-Warning: array_map() expects parameter 1 to be a valid callback, cannot access private method StaticClass::cube() in %s on line %d
+Warning: array_map() expects parameter 1 to be a valid callback, cannot access private method StaticClass::cube() in %sarray_map_object1.php on line %d
NULL
+StaticClass::retVal
-Warning: array_map() expects parameter 1 to be a valid callback, cannot access protected method StaticClass::retVal() in %s on line %d
+Warning: array_map() expects parameter 1 to be a valid callback, cannot access protected method StaticClass::retVal() in %sarray_map_object1.php on line %d
NULL
+
-- class implementing an interface --
+InterClass::square
array(2) {
[0]=>
int(1)
[1]=>
int(4)
}
-Done
+===DONE===