aboutsummaryrefslogtreecommitdiffhomepage
path: root/crates/shirabe/tests/platform
diff options
context:
space:
mode:
authornsfisis <nsfisis@gmail.com>2026-06-24 00:47:20 +0900
committernsfisis <nsfisis@gmail.com>2026-06-24 00:47:53 +0900
commit340164c64e90d44b1bdf620b514166db1f76cc98 (patch)
tree86195fe5ff8582b64e0324e9f40619e36c04948f /crates/shirabe/tests/platform
parent8fe3390d064303b86133a1d2983144a4818a7121 (diff)
downloadphp-shirabe-340164c64e90d44b1bdf620b514166db1f76cc98.tar.gz
php-shirabe-340164c64e90d44b1bdf620b514166db1f76cc98.tar.zst
php-shirabe-340164c64e90d44b1bdf620b514166db1f76cc98.zip
test: port more unimplemented tests
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Diffstat (limited to 'crates/shirabe/tests/platform')
-rw-r--r--crates/shirabe/tests/platform/hhvm_detector_test.rs27
1 files changed, 23 insertions, 4 deletions
diff --git a/crates/shirabe/tests/platform/hhvm_detector_test.rs b/crates/shirabe/tests/platform/hhvm_detector_test.rs
index 12a966a..f0a8550 100644
--- a/crates/shirabe/tests/platform/hhvm_detector_test.rs
+++ b/crates/shirabe/tests/platform/hhvm_detector_test.rs
@@ -4,7 +4,7 @@ use shirabe::platform::hhvm_detector::HhvmDetector;
use shirabe::util::Platform;
use shirabe::util::ProcessExecutor;
use shirabe_external_packages::symfony::process::ExecutableFinder;
-use shirabe_php_shim::{PhpMixed, defined};
+use shirabe_php_shim::{PhpMixed, constant, defined};
use shirabe_semver::version_parser::VersionParser;
fn set_up() -> HhvmDetector {
@@ -13,11 +13,16 @@ fn set_up() -> HhvmDetector {
hhvm_detector
}
+#[ignore]
#[test]
-#[ignore = "requires HHVM_VERSION_ID constant, which the shim does not define"]
fn test_hhvm_version_when_executing_in_hhvm() {
- let _hhvm_detector = set_up();
- todo!()
+ let mut hhvm_detector = set_up();
+ if !defined("HHVM_VERSION_ID") {
+ // markTestSkipped('Not running with HHVM')
+ return;
+ }
+ let version = hhvm_detector.get_version();
+ assert_eq!(version_id_to_version(), version);
}
#[ignore]
@@ -66,3 +71,17 @@ fn test_hhvm_version_when_executing_in_php() {
VersionParser.normalize(&detected_version, None).unwrap()
);
}
+
+fn version_id_to_version() -> Option<String> {
+ if !defined("HHVM_VERSION_ID") {
+ return None;
+ }
+
+ let hhvm_version_id = constant("HHVM_VERSION_ID").as_int().unwrap();
+ Some(format!(
+ "{}.{}.{}",
+ hhvm_version_id / 10000,
+ (hhvm_version_id / 100) % 100,
+ hhvm_version_id % 100,
+ ))
+}