aboutsummaryrefslogtreecommitdiffhomepage
path: root/crates/shirabe/tests/util/ini_helper_test.rs
diff options
context:
space:
mode:
Diffstat (limited to 'crates/shirabe/tests/util/ini_helper_test.rs')
-rw-r--r--crates/shirabe/tests/util/ini_helper_test.rs35
1 files changed, 34 insertions, 1 deletions
diff --git a/crates/shirabe/tests/util/ini_helper_test.rs b/crates/shirabe/tests/util/ini_helper_test.rs
index e214a78..59dc967 100644
--- a/crates/shirabe/tests/util/ini_helper_test.rs
+++ b/crates/shirabe/tests/util/ini_helper_test.rs
@@ -1,7 +1,40 @@
//! ref: composer/tests/Composer/Test/Util/IniHelperTest.php
use shirabe::util::ini_helper::IniHelper;
-use shirabe_php_shim::{PATH_SEPARATOR, putenv};
+use shirabe::util::platform::Platform;
+use shirabe_php_shim::{PATH_SEPARATOR, getenv, putenv};
+
+#[allow(dead_code)]
+fn set_up() -> TearDown {
+ // Register our name with XdebugHandler.
+ // TODO: XdebugHandler is the external composer/xdebug-handler package and is not ported.
+ todo!();
+ // Save current state
+ #[allow(unreachable_code)]
+ let env_original = getenv("COMPOSER_ORIGINAL_INIS");
+ TearDown { env_original }
+}
+
+#[allow(dead_code)]
+fn tear_down(env_original: &Option<String>) {
+ // Restore original state
+ if let Some(env_original) = env_original {
+ putenv(&format!("COMPOSER_ORIGINAL_INIS={env_original}"));
+ } else {
+ Platform::clear_env("COMPOSER_ORIGINAL_INIS");
+ }
+}
+
+#[allow(dead_code)]
+struct TearDown {
+ env_original: Option<String>,
+}
+
+impl Drop for TearDown {
+ fn drop(&mut self) {
+ tear_down(&self.env_original);
+ }
+}
fn set_env(paths: &[&str]) {
putenv(&format!(