Skip to content

Commit cf22dcc

Browse files
authored
[flakes] add php extensions testscript (#701)
## Summary convert the `examples/testdata/php/php-extensions` into a `testscript` so that automated tests run it. ## How was it tested? - in code, enabled flakes feature flag - ran `go test ./testscripts/... -count=1` (the count=1 is to bust the test cache) - as a sanity check, commented out the Definitions lines in `flake.nix.tmpl` and ensured that the test failed.
1 parent e6fcf5d commit cf22dcc

File tree

4 files changed

+34
-45
lines changed

4 files changed

+34
-45
lines changed

examples/testdata/php/php-extensions/devbox.d/php81/php-fpm.conf

Lines changed: 0 additions & 17 deletions
This file was deleted.

examples/testdata/php/php-extensions/devbox.json

Lines changed: 0 additions & 13 deletions
This file was deleted.

examples/testdata/php/php-extensions/index.php

Lines changed: 0 additions & 15 deletions
This file was deleted.

testscripts/languages/php.test.txt

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
exec devbox run -- php index.php
2+
stdout 'done\n'
3+
4+
-- devbox.json --
5+
{
6+
"packages": [
7+
"php81",
8+
"php81Packages.composer",
9+
"php81Extensions.ds"
10+
],
11+
"shell": {
12+
"init_hook": null
13+
},
14+
"nixpkgs": {
15+
"commit": "f80ac848e3d6f0c12c52758c0f25c10c97ca3b62"
16+
}
17+
}
18+
19+
-- index.php --
20+
<?php
21+
22+
// Check that the extension is loaded.
23+
if (!extension_loaded('ds')) {
24+
echo("ds extension is not enabled");
25+
exit(0);
26+
}
27+
28+
$vec = new \Ds\Vector(["hello", "world"]);
29+
30+
echo("Original vector elements\n");
31+
foreach ($vec as $idx => $elem) {
32+
echo("idx: $idx and elem: $elem\n");
33+
}
34+
echo("done\n");

0 commit comments

Comments
 (0)