per php-version phpunit

This commit is contained in:
Robin Appelman 2025-10-26 01:16:47 +02:00
commit 3afda04092
2 changed files with 27 additions and 15 deletions

View file

@ -1,12 +1,18 @@
{
phpunit,
callPackage,
php,
majorVersion,
testDependencies,
writeShellApplication,
}:
writeShellApplication {
name = "phpunit";
runtimeInputs = [phpunit] ++ testDependencies;
text = ''
phpunit "$@"
'';
}
}: let
unwrapped = callPackage ../pkgs/phpunit.nix {
inherit php majorVersion;
};
in
writeShellApplication {
name = "phpunit";
runtimeInputs = [unwrapped] ++ testDependencies;
text = ''
phpunit "$@"
'';
}

View file

@ -129,10 +129,8 @@ in
};
phpunit = final.callPackage ./apps/phpunit.nix {
phpunit = final.callPackage ./pkgs/phpunit.nix {
php = final.minPhp;
majorVersion = composerMeta.phpUnitVersion;
};
php = final.minPhp;
majorVersion = composerMeta.phpUnitVersion;
testDependencies = config.testDependencies final;
};
@ -170,9 +168,17 @@ in
(optionalAttrs hasPsalm (forPhpVersions "psalm" ./checks/psalm.nix))
// (optionalAttrs hasPhpStan (forPhpVersions "phpstan" ./checks/phpstan.nix));
apps = {pkgs, ...}: {
apps = {pkgs, ...}: let
forPhpVersions = name: app:
genAttrs' composerMeta.phpVersions (version: {
name = "${name}${removeDots version}";
value = ''${getExe (app.override {
php = buildPhpVersion pkgs version;
})} "$@"'';
});
in {
phpunit = ''${getExe pkgs.phpunit} "$@"'';
};
} // (forPhpVersions "phpunit" pkgs.phpunit);
})
{