Skip to content

Commit 2574e0b

Browse files
joelwurtzXenira
andauthored
chore(test): fix embed test on php 8.4 (#396)
* chore(test): fix embed test on php 8.4 * docs: add comment explaining int param --------- Co-authored-by: Xenira <[email protected]>
1 parent 93508b6 commit 2574e0b

File tree

2 files changed

+11
-2
lines changed

2 files changed

+11
-2
lines changed

src/embed/mod.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -255,7 +255,7 @@ mod tests {
255255
#[test]
256256
#[should_panic]
257257
fn test_panic() {
258-
Embed::run(|| {
258+
Embed::run::<(), _>(|| {
259259
panic!("test panic");
260260
});
261261
}

tests/module.rs

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,8 @@
22
#![cfg(feature = "embed")]
33
extern crate ext_php_rs;
44

5+
use cfg_if::cfg_if;
6+
57
use ext_php_rs::embed::Embed;
68
use ext_php_rs::ffi::zend_register_module_ex;
79
use ext_php_rs::prelude::*;
@@ -10,7 +12,14 @@ use ext_php_rs::prelude::*;
1012
fn test_module() {
1113
Embed::run(|| {
1214
// Allow to load the module
13-
unsafe { zend_register_module_ex(get_module()) };
15+
cfg_if! {
16+
if #[cfg(php84)] {
17+
// Register as temporary (2) module
18+
unsafe { zend_register_module_ex(get_module(), 2) };
19+
} else {
20+
unsafe { zend_register_module_ex(get_module()) };
21+
}
22+
}
1423

1524
let result = Embed::eval("$foo = hello_world('foo');");
1625

0 commit comments

Comments
 (0)