2020-05-03 17:38:23 +00:00
|
|
|
import ../make-test-python.nix ({pkgs, lib, ...}: {
|
2020-04-24 23:36:52 +00:00
|
|
|
name = "php-httpd-test";
|
2020-05-03 17:38:23 +00:00
|
|
|
meta.maintainers = lib.teams.php.members;
|
2020-04-24 23:36:52 +00:00
|
|
|
|
|
|
|
machine = { config, lib, pkgs, ... }: {
|
|
|
|
services.httpd = {
|
|
|
|
enable = true;
|
|
|
|
adminAddr = "admin@phpfpm";
|
|
|
|
virtualHosts."phpfpm" = let
|
|
|
|
testdir = pkgs.writeTextDir "web/index.php" "<?php phpinfo();";
|
|
|
|
in {
|
|
|
|
documentRoot = "${testdir}/web";
|
|
|
|
locations."/" = {
|
|
|
|
index = "index.php index.html";
|
|
|
|
};
|
|
|
|
};
|
|
|
|
enablePHP = true;
|
|
|
|
};
|
|
|
|
};
|
|
|
|
testScript = { ... }: ''
|
|
|
|
machine.wait_for_unit("httpd.service")
|
|
|
|
|
|
|
|
# Check so we get an evaluated PHP back
|
2020-10-27 00:29:36 +00:00
|
|
|
response = machine.succeed("curl -fvvv -s http://127.0.0.1:80/")
|
2020-04-24 23:36:52 +00:00
|
|
|
assert "PHP Version ${pkgs.php.version}" in response, "PHP version not detected"
|
|
|
|
|
|
|
|
# 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"
|
|
|
|
'';
|
|
|
|
})
|