libdeltachat: 1.153.0 -> 1.154.1 (#374638)
[NixPkgs.git] / nixos / tests / php / httpd.nix
blob8bdf72dd0c8a6ef83fecf0146fc49a858f8f4f7f
1 import ../make-test-python.nix (
2   {
3     pkgs,
4     lib,
5     php,
6     ...
7   }:
8   {
9     name = "php-${php.version}-httpd-test";
10     meta.maintainers = lib.teams.php.members;
12     nodes.machine =
13       {
14         config,
15         lib,
16         pkgs,
17         ...
18       }:
19       {
20         services.httpd = {
21           enable = true;
22           adminAddr = "admin@phpfpm";
23           virtualHosts."phpfpm" =
24             let
25               testdir = pkgs.writeTextDir "web/index.php" "<?php phpinfo();";
26             in
27             {
28               documentRoot = "${testdir}/web";
29               locations."/" = {
30                 index = "index.php index.html";
31               };
32             };
33           phpPackage = php;
34           enablePHP = true;
35         };
36       };
37     testScript =
38       { ... }:
39       ''
40         machine.wait_for_unit("httpd.service")
42         # Check so we get an evaluated PHP back
43         response = machine.succeed("curl -fvvv -s http://127.0.0.1:80/")
44         assert "PHP Version ${php.version}" in response, "PHP version not detected"
46         # Check so we have database and some other extensions loaded
47         for ext in ["json", "opcache", "pdo_mysql", "pdo_pgsql", "pdo_sqlite"]:
48             assert ext in response, f"Missing {ext} extension"
49       '';
50   }