Skip to content

Commit e3e6870

Browse files
committed
fix agent unit tests (#994)
PHP's build system received a fix for 'out of tree' builds. This broke build of agent's unit tests which require agent's source directory to be in the include search path. Working agent's unit tests showed that `test_function_debug_name` needed its expectations tweaked - closures are named differently on PHP 8.4.
1 parent a8b9fbb commit e3e6870

File tree

2 files changed

+7
-0
lines changed

2 files changed

+7
-0
lines changed

agent/config.m4

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -239,6 +239,9 @@ if test "$PHP_NEWRELIC" = "yes"; then
239239
dnl Define $(PHP_CONFIG) so we can call it when building tests.
240240
PHP_SUBST(PHP_CONFIG)
241241

242+
dnl Make sure we include the source directory in the include search path.
243+
PHP_ADD_INCLUDE([$abs_srcdir], [1])
244+
242245
dnl Include the Makefile.frag, which we use to handle build time
243246
dnl dependencies.
244247
PHP_ADD_MAKEFILE_FRAGMENT

agent/tests/test_agent.c

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -142,7 +142,11 @@ static void test_function_debug_name(TSRMLS_D) {
142142
func = nr_php_zval_to_function(closure TSRMLS_CC);
143143
name = nr_php_function_debug_name(func);
144144

145+
#if ZEND_MODULE_API_NO < ZEND_8_4_X_API_NO
145146
tlib_pass_if_str_equal("closure", "{closure} declared at -:1", name);
147+
#else
148+
tlib_pass_if_str_equal("closure", "{closure:-:1} declared at -:1", name);
149+
#endif
146150

147151
nr_php_zval_free(&closure);
148152
nr_free(name);

0 commit comments

Comments
 (0)