pickles/vendors/php-test-helpers/tests/set_new_overload_multiple.phpt
Joshua Sherman 8f3c623e5d Added php-test-helpers to the vendors directory
Seemed easier than trying to figure out how to force the prompt to accept the
unknown IP (perhaps not possible at all as it is part of SSH?). `yes` didn't
work, unfortunately.
2014-01-12 16:25:52 -05:00

33 lines
659 B
PHP
Executable file

--TEST--
set_new_overload() can be called multiple times and unset_new_overload() works
--SKIPIF--
<?php
if (!extension_loaded('test_helpers')) die('skip test_helpers extension not loaded');
?>
--FILE--
<?php
class Foo1 {}
class Foo2 {}
class Bar {}
function callback1($className) {
return 'Foo1';
}
function callback2($className) {
return 'foo2';
}
var_dump(set_new_overload('callback1'));
var_dump(get_class(new Bar));
var_dump(set_new_overload('callback2'));
var_dump(get_class(new Bar));
var_dump(unset_new_overload());
var_dump(get_class(new Bar));
--EXPECT--
bool(true)
string(4) "Foo1"
bool(true)
string(4) "Foo2"
bool(true)
string(3) "Bar"