2021-06-26 09:46:46 +02:00
|
|
|
import ../make-test-python.nix ({ pkgs, lib, php, ... }: {
|
2021-02-27 19:39:26 +01:00
|
|
|
name = "php-${php.version}-httpd-test";
|
2020-04-19 20:56:42 +02:00
|
|
|
meta.maintainers = lib.teams.php.members;
|
2020-04-16 21:48:40 +02:00
|
|
|
|
2022-03-21 00:15:30 +01:00
|
|
|
nodes.machine = { config, lib, pkgs, ... }: {
|
2020-04-16 21:48:40 +02:00
|
|
|
services.httpd = {
|
|
|
|
enable = true;
|
|
|
|
adminAddr = "admin@phpfpm";
|
2021-06-26 09:46:46 +02:00
|
|
|
virtualHosts."phpfpm" =
|
|
|
|
let
|
|
|
|
testdir = pkgs.writeTextDir "web/index.php" "<?php phpinfo();";
|
|
|
|
in
|
|
|
|
{
|
|
|
|
documentRoot = "${testdir}/web";
|
|
|
|
locations."/" = {
|
|
|
|
index = "index.php index.html";
|
|
|
|
};
|
2020-04-16 21:48:40 +02:00
|
|
|
};
|
2021-02-27 19:39:26 +01:00
|
|
|
phpPackage = php;
|
2020-04-16 21:48:40 +02:00
|
|
|
enablePHP = true;
|
|
|
|
};
|
|
|
|
};
|
|
|
|
testScript = { ... }: ''
|
|
|
|
machine.wait_for_unit("httpd.service")
|
|
|
|
|
|
|
|
# Check so we get an evaluated PHP back
|
2020-09-16 17:32:56 +02:00
|
|
|
response = machine.succeed("curl -fvvv -s http://127.0.0.1:80/")
|
2021-02-27 19:39:26 +01:00
|
|
|
assert "PHP Version ${php.version}" in response, "PHP version not detected"
|
2020-04-16 21:48:40 +02:00
|
|
|
|
|
|
|
# Check so we have database and some other extensions loaded
|
|
|
|
for ext in ["json", "opcache", "pdo_mysql", "pdo_pgsql", "pdo_sqlite"]:
|
|
|
|
assert ext in response, f"Missing {ext} extension"
|
|
|
|
'';
|
|
|
|
})
|