diff options
| author | nsfisis <nsfisis@gmail.com> | 2026-08-09 05:59:40 +0900 |
|---|---|---|
| committer | nsfisis <nsfisis@gmail.com> | 2026-08-09 05:59:40 +0900 |
| commit | f3d60c7836da0d50d59a22cfd6e4692e3dc75581 (patch) | |
| tree | eafdc0bdd8a05b11e5a511d7ab4bb48a5e42609e /crates/shirabe/tests | |
| parent | a6fc2831562fa83b8f20a3b8285b87102c1775d8 (diff) | |
| download | php-shirabe-f3d60c7836da0d50d59a22cfd6e4692e3dc75581.tar.gz php-shirabe-f3d60c7836da0d50d59a22cfd6e4692e3dc75581.tar.zst php-shirabe-f3d60c7836da0d50d59a22cfd6e4692e3dc75581.zip | |
test(console): cover the dev build warning branch
The deadline is a constant baked in at build time, so PHP's define() of
COMPOSER_DEV_WARNING_TIME cannot make Application take that branch.
Application now holds the deadline in a field that __set_dev_warning_time
overrides, letting testDevWarning run instead of staying ignored. The
define() shim, whose only caller was that test, goes away with it.
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Diffstat (limited to 'crates/shirabe/tests')
| -rw-r--r-- | crates/shirabe/tests/application_test.rs | 7 |
1 files changed, 2 insertions, 5 deletions
diff --git a/crates/shirabe/tests/application_test.rs b/crates/shirabe/tests/application_test.rs index 794a4352..4e8a0f05 100644 --- a/crates/shirabe/tests/application_test.rs +++ b/crates/shirabe/tests/application_test.rs @@ -17,7 +17,7 @@ use shirabe_external_packages::symfony::console::input::array_input::ArrayInput; use shirabe_external_packages::symfony::console::input::input_interface::InputInterface; use shirabe_external_packages::symfony::console::output::buffered_output::BufferedOutput; use shirabe_external_packages::symfony::console::output::output_interface::OutputInterface; -use shirabe_php_shim::{PHP_EOL, PHP_SERVER, PhpMixed, define, defined, time}; +use shirabe_php_shim::{PHP_EOL, PHP_SERVER, PhpMixed, time}; fn set_up() { Platform::put_env("COMPOSER_DISABLE_XDEBUG_WARN", "1"); @@ -35,7 +35,6 @@ impl Drop for TearDown { } } -#[ignore = "the dev warning deadline is a Rust constant baked in by build.rs, so a runtime define() of COMPOSER_DEV_WARNING_TIME cannot make Application take the warning branch"] #[test] fn test_dev_warning() { let _tear_down = TearDown; @@ -43,9 +42,7 @@ fn test_dev_warning() { let application = ApplicationHandle::new("Composer".to_string(), "".to_string()).unwrap(); - if !defined("COMPOSER_DEV_WARNING_TIME") { - define("COMPOSER_DEV_WARNING_TIME", PhpMixed::Int(time() - 1)); - } + application.__set_dev_warning_time(Some(time() - 1)); let output = std::rc::Rc::new(std::cell::RefCell::new(BufferedOutput::new( None, false, None, |
