From 1c0d655e12a1a52c8ea909cb87b0c6a0c7a63a4c Mon Sep 17 00:00:00 2001 From: Xenira <1288524+Xenira@users.noreply.github.com> Date: Tue, 22 Oct 2024 23:19:01 +0200 Subject: [PATCH] test(globals): add integration tests Refs: #331 --- tests/src/integration/globals.php | 8 ++++++ tests/src/integration/globals.rs | 4 +++ tests/src/lib.rs | 44 ++++++++++++++++++++++++++++++- 3 files changed, 55 insertions(+), 1 deletion(-) create mode 100644 tests/src/integration/globals.php create mode 100644 tests/src/integration/globals.rs diff --git a/tests/src/integration/globals.php b/tests/src/integration/globals.php new file mode 100644 index 000000000..119845cdd --- /dev/null +++ b/tests/src/integration/globals.php @@ -0,0 +1,8 @@ + &mut ZendObject { a } +// GLOBALS +#[php_function] +pub fn test_globals_http_get() -> ZBox { + ProcessGlobals::get().http_get_vars().to_owned() +} + +#[php_function] +pub fn test_globals_http_post() -> ZBox { + ProcessGlobals::get().http_post_vars().to_owned() +} + +#[php_function] +pub fn test_globals_http_cookie() -> ZBox { + ProcessGlobals::get().http_cookie_vars().to_owned() +} + +#[php_function] +pub fn test_globals_http_server() -> ZBox { + println!("{:?}", ProcessGlobals::get().http_server_vars()); + ProcessGlobals::get().http_server_vars().unwrap().to_owned() +} + +#[php_function] +pub fn test_globals_http_request() -> ZBox { + ProcessGlobals::get() + .http_request_vars() + .unwrap() + .to_owned() +} + +#[php_function] +pub fn test_globals_http_files() -> ZBox { + ProcessGlobals::get().http_files_vars().to_owned() +} + #[php_function] pub fn test_closure() -> Closure { Closure::wrap(Box::new(|a| a) as Box String>) @@ -179,6 +220,7 @@ mod integration { mod callable; mod class; mod closure; + mod globals; mod nullable; mod number; mod object;