From 7234fdbb0cb0dd45ed1d6e7814c91e596126ee25 Mon Sep 17 00:00:00 2001 From: jvoisin Date: Mon, 9 Oct 2017 11:54:11 +0200 Subject: Implement matching on the calltrace (#17) * Implement matching on the calltrace--- .../config/config_disabled_functions_chain.ini | 1 + src/tests/disabled_functions_chain.phpt | 28 ++++++++++++++++++++++ .../disabled_functions_chain_not_matching.phpt | 28 ++++++++++++++++++++++ 3 files changed, 57 insertions(+) create mode 100644 src/tests/config/config_disabled_functions_chain.ini create mode 100644 src/tests/disabled_functions_chain.phpt create mode 100644 src/tests/disabled_functions_chain_not_matching.phpt (limited to 'src/tests') diff --git a/src/tests/config/config_disabled_functions_chain.ini b/src/tests/config/config_disabled_functions_chain.ini new file mode 100644 index 0000000..f47af34 --- /dev/null +++ b/src/tests/config/config_disabled_functions_chain.ini @@ -0,0 +1 @@ +sp.disable_functions.function("outer>inner").drop(); diff --git a/src/tests/disabled_functions_chain.phpt b/src/tests/disabled_functions_chain.phpt new file mode 100644 index 0000000..b25f800 --- /dev/null +++ b/src/tests/disabled_functions_chain.phpt @@ -0,0 +1,28 @@ +--TEST-- +Disable functions by matching the calltrace +--SKIPIF-- + +--INI-- +sp.configuration_file={PWD}/config/config_disabled_functions_chain.ini +--FILE-- + +--EXPECTF-- +I'm before the call to outer +I'm in the outer function, before the call! +[snuffleupagus][0.0.0.0][disabled_function][drop] The call to the function 'outer>inner' in %a/disabled_functions_chain.php:%d has been disabled. +I'm in the outer function, after the call! +I'm after the call to outer diff --git a/src/tests/disabled_functions_chain_not_matching.phpt b/src/tests/disabled_functions_chain_not_matching.phpt new file mode 100644 index 0000000..3a0400a --- /dev/null +++ b/src/tests/disabled_functions_chain_not_matching.phpt @@ -0,0 +1,28 @@ +--TEST-- +Disable functions by matching the calltrace +--SKIPIF-- + +--INI-- +sp.configuration_file={PWD}/config/config_disabled_functions_chain.ini +--FILE-- + +--EXPECTF-- +I'm before the call to outer +I'm in the outer function, before the call! +I'm in the inner function! +I'm in the outer function, after the call! +I'm after the call to outer -- cgit v1.3