diff --git a/ext/opcache/tests/preload.inc b/ext/opcache/tests/preload.inc index 91603d459f3..af20c4947f8 100644 --- a/ext/opcache/tests/preload.inc +++ b/ext/opcache/tests/preload.inc @@ -22,3 +22,18 @@ abstract class c { class x extends c implements a, b { function foo() { } } + +trait T1 { + static function foo() { + var_dump(__METHOD__); + } +} +trait T2 { + use T1; + static function bar() { + var_dump(__METHOD__); + } +} +class Y { + use T2; +} diff --git a/ext/opcache/tests/preload_003.phpt b/ext/opcache/tests/preload_003.phpt new file mode 100644 index 00000000000..b8083879670 --- /dev/null +++ b/ext/opcache/tests/preload_003.phpt @@ -0,0 +1,19 @@ +--TEST-- +Preloading classes linked with traits +--INI-- +opcache.enable=1 +opcache.enable_cli=1 +opcache.optimization_level=-1 +opcache.preload={PWD}/preload.inc +--SKIPIF-- + +--FILE-- + +OK +--EXPECT-- +string(7) "T1::foo" +string(7) "T2::bar" +OK