Skip to content

Commit fa6bb9b

Browse files
committed
Unit Tests for phpGH-16551
1 parent 1cdf3fa commit fa6bb9b

File tree

4 files changed

+96
-0
lines changed

4 files changed

+96
-0
lines changed

ext/opcache/tests/gt16551_001.phpt

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
--TEST--
2+
GH-16551: opcache file cache read only: generate file cache
3+
--INI--
4+
opcache.enable=1
5+
opcache.enable_cli=1
6+
opcache.jit=disable
7+
opcache.jit_buffer_size=0
8+
opcache.file_cache="{TMP}"
9+
--EXTENSIONS--
10+
opcache
11+
--CONFLICTS--
12+
opcache_file_cache
13+
--FILE--
14+
<?php
15+
16+
$file = __DIR__ . '/gt16551_999.inc';
17+
18+
opcache_compile_file($file);
19+
20+
var_dump(
21+
opcache_is_script_cached($file)
22+
);
23+
24+
var_dump(
25+
opcache_is_script_cached_in_file_cache($file)
26+
);
27+
28+
?>
29+
--EXPECT--
30+
bool(true)
31+
bool(true)

ext/opcache/tests/gt16551_002.phpt

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
--TEST--
2+
GH-16551: opcache file cache read only: read file cache
3+
--INI--
4+
opcache.enable=1
5+
opcache.enable_cli=1
6+
opcache.jit=disable
7+
opcache.jit_buffer_size=0
8+
opcache.file_cache="{TMP}"
9+
opcache.file_cache_read_only=1
10+
--EXTENSIONS--
11+
opcache
12+
--CONFLICTS--
13+
opcache_file_cache
14+
--FILE--
15+
<?php
16+
17+
$file = __DIR__ . '/gt16551_999.inc';
18+
19+
var_dump(
20+
opcache_is_script_cached_in_file_cache($file)
21+
);
22+
23+
require $file;
24+
25+
?>
26+
--EXPECT--
27+
bool(true)
28+
9

ext/opcache/tests/gt16551_003.phpt

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
--TEST--
2+
GH-16551: opcache file cache read only: read file cache with limited checks
3+
--INI--
4+
opcache.enable=1
5+
opcache.enable_cli=1
6+
opcache.jit=disable
7+
opcache.jit_buffer_size=0
8+
opcache.file_cache="{TMP}"
9+
opcache.file_cache_read_only=1
10+
opcache.revalidate_freq=0
11+
opcache.enable_file_override=true
12+
opcache.validate_timestamps=false
13+
opcache.file_cache_consistency_checks=false
14+
--EXTENSIONS--
15+
opcache
16+
--CONFLICTS--
17+
opcache_file_cache
18+
--FILE--
19+
<?php
20+
21+
$file = __DIR__ . '/gt16551_999.inc';
22+
23+
var_dump(
24+
opcache_is_script_cached_in_file_cache($file)
25+
);
26+
27+
require $file;
28+
29+
?>
30+
--EXPECT--
31+
bool(true)
32+
9

ext/opcache/tests/gt16551_999.inc

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
<?php
2+
3+
$a = 4+5;
4+
5+
echo $a . "\n";

0 commit comments

Comments
 (0)