php-src/ext/zend_test/tests/observer_closure_02.phpt
Bob Weinand e7462bff19
Run one testsuite with observers enabled in CI (#13869)
Signed-off-by: Bob Weinand <bobwei9@hotmail.com>
2024-04-02 18:11:02 +02:00

37 lines
645 B
PHP

--TEST--
Observer: Observability of fake closures
--EXTENSIONS--
zend_test
--INI--
zend_test.observer.enabled=1
zend_test.observer.show_output=1
zend_test.observer.observe_all=1
--FILE--
<?php
class Foo
{
public function bar()
{
echo 'Called as fake closure.' . PHP_EOL;
}
}
$callable = [new Foo(), 'bar'];
$closure = \Closure::fromCallable($callable);
$closure();
echo 'DONE' . PHP_EOL;
?>
--EXPECTF--
<!-- init '%s' -->
<file '%s'>
<!-- init Closure::fromCallable() -->
<Closure::fromCallable>
</Closure::fromCallable>
<!-- init Foo::bar() -->
<Foo::bar>
Called as fake closure.
</Foo::bar>
DONE
</file '%s'>