Skip to content

Commit 973ed3d

Browse files
authored
Add test(s) for php-8.2-apcu (#34515)
🤖 generated for as part of [expanding package test coverage](#13623) Signed-off-by: Josh Wolf <josh@wolfs.io>
1 parent c657fa0 commit 973ed3d

File tree

1 file changed

+58
-0
lines changed

1 file changed

+58
-0
lines changed

php-8.2-apcu.yaml

+58
Original file line numberDiff line numberDiff line change
@@ -58,3 +58,61 @@ update:
5858
strip-prefix: v
5959
tag-filter: v
6060
use-tag: true
61+
62+
test:
63+
pipeline:
64+
- name: "Check if extension is loaded"
65+
runs: |
66+
php -m | grep -i "apcu"
67+
- name: "Verify extension version"
68+
runs: |
69+
php -r 'echo phpversion("apcu");'
70+
- name: "Test basic cache storage and retrieval"
71+
runs: |
72+
php -d apc.enable_cli=1 -r '
73+
if (!apcu_store("test_key", "test_value")) exit(1);
74+
$value = apcu_fetch("test_key");
75+
if ($value !== "test_value") exit(1);
76+
echo "Success";
77+
'
78+
- name: "Test cache exists functionality"
79+
runs: |
80+
php -d apc.enable_cli=1 -r '
81+
if (!apcu_store("check_key", "check_value")) exit(1);
82+
if (!apcu_exists("check_key")) exit(1);
83+
if (apcu_exists("nonexistent_key")) exit(1);
84+
echo "Success";
85+
'
86+
- name: "Test cache deletion"
87+
runs: |
88+
php -d apc.enable_cli=1 -r '
89+
if (!apcu_store("delete_key", "delete_value")) exit(1);
90+
if (!apcu_delete("delete_key")) exit(1);
91+
if (apcu_exists("delete_key")) exit(1);
92+
echo "Success";
93+
'
94+
- name: "Test cache clearing"
95+
runs: |
96+
php -d apc.enable_cli=1 -r '
97+
if (!apcu_store("clear_key", "clear_value")) exit(1);
98+
if (!apcu_clear_cache()) exit(1);
99+
if (apcu_exists("clear_key")) exit(1);
100+
echo "Success";
101+
'
102+
- name: "Test increment/decrement operations"
103+
runs: |
104+
php -d apc.enable_cli=1 -r '
105+
if (!apcu_store("counter", 5)) exit(1);
106+
if (apcu_inc("counter") !== 6) exit(1);
107+
if (apcu_dec("counter") !== 5) exit(1);
108+
echo "Success";
109+
'
110+
- name: "Verify configuration file"
111+
runs: |
112+
grep -q "^extension=apcu.so" /etc/php/conf.d/apcu.ini
113+
- name: "Verify APCu is enabled in CLI"
114+
runs: |
115+
php -d apc.enable_cli=1 -r '
116+
if (!ini_get("apc.enable_cli")) exit(1);
117+
echo "APCu CLI mode enabled";
118+
'

0 commit comments

Comments
 (0)