Skip to content

Commit e210c08

Browse files
committed
Add test case for opcache revalidation in cli
1 parent eaa7380 commit e210c08

File tree

1 file changed

+42
-0
lines changed

1 file changed

+42
-0
lines changed
Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
--TEST--
2+
opcache revalidation should work properly in CLI mode
3+
--EXTENSIONS--
4+
opcache
5+
--INI--
6+
opcache.enable=1
7+
opcache.enable_cli=1
8+
opcache.validate_timestamps=1
9+
opcache.revalidate_freq=1
10+
--FILE--
11+
<?php
12+
$file = __DIR__ . DIRECTORY_SEPARATOR . pathinfo(__FILE__, PATHINFO_FILENAME) . '.inc';
13+
14+
file_put_contents($file, <<<PHP
15+
<?php
16+
return 42;
17+
PHP);
18+
19+
var_dump(opcache_invalidate($file));
20+
21+
var_dump(include $file);
22+
23+
file_put_contents($file, <<<PHP
24+
<?php
25+
return 1234;
26+
PHP);
27+
28+
var_dump(include $file);
29+
30+
sleep(2);
31+
touch($file);
32+
33+
var_dump(include $file);
34+
35+
@unlink($file);
36+
37+
?>
38+
--EXPECT--
39+
bool(true)
40+
int(42)
41+
int(42)
42+
int(1234)

0 commit comments

Comments
 (0)