Skip to content

Commit b18237b

Browse files
mikeland73claude
andauthored
[tests] Fix tests (#2833)
## Summary New php.ds doesn't have Vector anymore. Fix by using Seq instead. ## Test plan - [x] Scheduled `cli-tests` workflow passes the PHP testscript. 🤖 Generated with [Claude Code](https://claude.com/claude-code) --------- Co-authored-by: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
1 parent 3d8f5f3 commit b18237b

7 files changed

Lines changed: 174 additions & 7 deletions

File tree

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
# PHP with the `ds` extension
2+
3+
A minimal Devbox project that installs PHP 8.5 and the [`ds`](https://www.php.net/manual/en/book.ds.php)
4+
extension and exercises `\Ds\Seq` from a short PHP script.
5+
6+
## Run it
7+
8+
```sh
9+
devbox run run_test
10+
```
11+
12+
The script verifies that `ds` is loaded with `extension_loaded('ds')` and then
13+
constructs a `\Ds\Seq`, iterating its elements.
Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
[global]
2+
pid = ${PHPFPM_PID_FILE}
3+
error_log = ${PHPFPM_ERROR_LOG_FILE}
4+
daemonize = yes
5+
6+
[www]
7+
; user = www-data
8+
; group = www-data
9+
listen = 127.0.0.1:${PHPFPM_PORT}
10+
; listen.owner = www-data
11+
; listen.group = www-data
12+
pm = dynamic
13+
pm.max_children = 5
14+
pm.start_servers = 2
15+
pm.min_spare_servers = 1
16+
pm.max_spare_servers = 3
17+
chdir = /
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
[php]
2+
3+
; Put your php.ini directives here. For the latest default php.ini file, see https://github.com/php/php-src/blob/master/php.ini-production
4+
5+
; memory_limit = 128M
6+
; expose_php = Off
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
{
2+
"packages": [
3+
"php@8.5",
4+
"php85Extensions.ds@latest"
5+
],
6+
"shell": {
7+
"scripts": {
8+
"run_test": "php index.php"
9+
}
10+
}
11+
}
Lines changed: 106 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,106 @@
1+
{
2+
"lockfile_version": "1",
3+
"packages": {
4+
"github:NixOS/nixpkgs/nixpkgs-unstable": {
5+
"last_modified": "2026-04-27T06:11:55Z",
6+
"resolved": "github:NixOS/nixpkgs/6368eda62c9775c38ef7f714b2555a741c20c72d?lastModified=1777270315&narHash=sha256-yKB4G6cKsQsWN7M6rZGk6gkJPDNPIzT05y4qzRyCDlI%3D"
7+
},
8+
"php85Extensions.ds@latest": {
9+
"last_modified": "2026-05-08T21:03:27Z",
10+
"resolved": "github:NixOS/nixpkgs/b3da656039dc7a6240f27b2ef8cc6a3ef3bccae7#php85Extensions.ds",
11+
"source": "devbox-search",
12+
"version": "2.0.0",
13+
"systems": {
14+
"aarch64-darwin": {
15+
"outputs": [
16+
{
17+
"name": "out",
18+
"path": "/nix/store/bljpapdpa4amfjbv8nj7dv240xqgqq6y-php-ds-2.0.0",
19+
"default": true
20+
}
21+
],
22+
"store_path": "/nix/store/bljpapdpa4amfjbv8nj7dv240xqgqq6y-php-ds-2.0.0"
23+
},
24+
"aarch64-linux": {
25+
"outputs": [
26+
{
27+
"name": "out",
28+
"path": "/nix/store/q2i8szhr19yn31brcymy5rwdyavq94fj-php-ds-2.0.0",
29+
"default": true
30+
}
31+
],
32+
"store_path": "/nix/store/q2i8szhr19yn31brcymy5rwdyavq94fj-php-ds-2.0.0"
33+
},
34+
"x86_64-darwin": {
35+
"outputs": [
36+
{
37+
"name": "out",
38+
"path": "/nix/store/sspk4hlrds9f7nzmzs2j520fgr5bjq56-php-ds-2.0.0",
39+
"default": true
40+
}
41+
],
42+
"store_path": "/nix/store/sspk4hlrds9f7nzmzs2j520fgr5bjq56-php-ds-2.0.0"
43+
},
44+
"x86_64-linux": {
45+
"outputs": [
46+
{
47+
"name": "out",
48+
"path": "/nix/store/hv2x77zg3v0qyhshwz592iiqr8inv0qm-php-ds-2.0.0",
49+
"default": true
50+
}
51+
],
52+
"store_path": "/nix/store/hv2x77zg3v0qyhshwz592iiqr8inv0qm-php-ds-2.0.0"
53+
}
54+
}
55+
},
56+
"php@8.5": {
57+
"last_modified": "2026-05-08T21:03:27Z",
58+
"plugin_version": "0.0.3",
59+
"resolved": "github:NixOS/nixpkgs/b3da656039dc7a6240f27b2ef8cc6a3ef3bccae7#php85",
60+
"source": "devbox-search",
61+
"version": "8.5.6",
62+
"systems": {
63+
"aarch64-darwin": {
64+
"outputs": [
65+
{
66+
"name": "out",
67+
"path": "/nix/store/5rvi873nrynml14fxp1vjm62hsanyjq2-php-with-extensions-8.5.6",
68+
"default": true
69+
}
70+
],
71+
"store_path": "/nix/store/5rvi873nrynml14fxp1vjm62hsanyjq2-php-with-extensions-8.5.6"
72+
},
73+
"aarch64-linux": {
74+
"outputs": [
75+
{
76+
"name": "out",
77+
"path": "/nix/store/46lzqw9gb5asd4d21yx8xx9njzp1mv78-php-with-extensions-8.5.6",
78+
"default": true
79+
}
80+
],
81+
"store_path": "/nix/store/46lzqw9gb5asd4d21yx8xx9njzp1mv78-php-with-extensions-8.5.6"
82+
},
83+
"x86_64-darwin": {
84+
"outputs": [
85+
{
86+
"name": "out",
87+
"path": "/nix/store/cnjm1ipj0law6766022cbcjg7d1j43a5-php-with-extensions-8.5.6",
88+
"default": true
89+
}
90+
],
91+
"store_path": "/nix/store/cnjm1ipj0law6766022cbcjg7d1j43a5-php-with-extensions-8.5.6"
92+
},
93+
"x86_64-linux": {
94+
"outputs": [
95+
{
96+
"name": "out",
97+
"path": "/nix/store/vjvqkq61yamwrmj04cpf1nvrms7xjzhc-php-with-extensions-8.5.6",
98+
"default": true
99+
}
100+
],
101+
"store_path": "/nix/store/vjvqkq61yamwrmj04cpf1nvrms7xjzhc-php-with-extensions-8.5.6"
102+
}
103+
}
104+
}
105+
}
106+
}
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
<?php
2+
3+
if (!extension_loaded('ds')) {
4+
fwrite(STDERR, "ds extension is not enabled\n");
5+
exit(1);
6+
}
7+
8+
$seq = new \Ds\Seq(["hello", "world"]);
9+
10+
echo "Original sequence elements\n";
11+
foreach ($seq as $idx => $elem) {
12+
echo "idx: $idx and elem: $elem\n";
13+
}
14+
echo "done\n";

testscripts/languages/php.test.txt

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,19 @@
11
exec devbox run php index.php
22
stdout 'done\n'
33

4-
exec devbox rm php83Extensions.ds
4+
exec devbox rm php85Extensions.ds
55
exec devbox run php index.php
66
stdout 'ds extension is not enabled'
77

8-
exec devbox add php83Extensions.ds
8+
exec devbox add php85Extensions.ds
99
exec devbox run php index.php
1010
stdout 'done\n'
1111

1212
-- devbox.json --
1313
{
1414
"packages": [
15-
"php@latest",
16-
"php83Extensions.ds@latest"
15+
"php@8.5",
16+
"php85Extensions.ds@latest"
1717
]
1818
}
1919

@@ -26,10 +26,10 @@ if (!extension_loaded('ds')) {
2626
exit(0);
2727
}
2828

29-
$vec = new \Ds\Vector(["hello", "world"]);
29+
$seq = new \Ds\Seq(["hello", "world"]);
3030

31-
echo("Original vector elements\n");
32-
foreach ($vec as $idx => $elem) {
31+
echo("Original sequence elements\n");
32+
foreach ($seq as $idx => $elem) {
3333
echo("idx: $idx and elem: $elem\n");
3434
}
3535
echo("done\n");

0 commit comments

Comments
 (0)