php-src/ext/ffi/tests/301-win32.phpt
Christoph M. Becker 280485adc1 Improve FFI test suite for Windows
We add Windows support to four existing test cases, extract some useful
utility functions, and use them to simplify further test cases.

We also remove the Windows specific code from preload.inc, since
preloading isn't supported on Windows anyway.
2020-03-18 16:53:06 +01:00

29 lines
565 B
PHP

--TEST--
FFI 301: FFI loading on Windows
--SKIPIF--
<?php require_once('skipif.inc'); ?>
<?php if (substr(PHP_OS, 0, 3) != 'WIN') die('skip for Windows only'); ?>
--INI--
ffi.enable=1
--FILE--
<?php
require_once('utils.inc');
$fn = __DIR__ . "/300-win32.h";
$cont = str_replace(
"PHP_DLL_NAME",
ffi_get_php_dll_name(),
file_get_contents("$fn.in")
);
file_put_contents($fn, $cont);
$ffi = FFI::load($fn);
$ffi->php_printf("Hello World from %s!\n", "PHP");
?>
--CLEAN--
<?php
$fn = __DIR__ . "/300-win32.h";
unlink($fn);
?>
--EXPECT--
Hello World from PHP!