mirror of
https://codeberg.org/icewind/haze.git
synced 2026-08-02 04:04:44 +02:00
make it easier to use a specific phpunit version
This commit is contained in:
parent
44da124f75
commit
d59b99211a
5 changed files with 27 additions and 12 deletions
|
|
@ -107,7 +107,7 @@ Additionally, you can use the following options when starting an instance:
|
||||||
#### Run tests in a new instance
|
#### Run tests in a new instance
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
haze test [database] [php-version] [path]
|
haze test [database] [php-version] [phpunit version] [path]
|
||||||
```
|
```
|
||||||
|
|
||||||
Where `path` is a file or folder to run PHPUnit in, relative to the sources
|
Where `path` is a file or folder to run PHPUnit in, relative to the sources
|
||||||
|
|
|
||||||
|
|
@ -85,28 +85,28 @@
|
||||||
name = "phpunit";
|
name = "phpunit";
|
||||||
runtimeInputs = [jq];
|
runtimeInputs = [jq];
|
||||||
text = ''
|
text = ''
|
||||||
MAJOR=$(jq -r 'first(.require."phpunit/phpunit" | scan("[[:digit:]]+"))' vendor-bin/phpunit/composer.json)
|
MAJOR=$(jq -r 'first(.require."phpunit/phpunit" | scan("[[:digit:]]+"))' vendor-bin/phpunit/composer.json || echo "")
|
||||||
case "$MAJOR" in
|
case "$MAJOR" in
|
||||||
9)
|
9)
|
||||||
PKG=${phpunitUnwrapped "9"}
|
BIN="${getExe (phpunitUnwrapped "9")}"
|
||||||
;;
|
;;
|
||||||
10)
|
10)
|
||||||
PKG=${phpunitUnwrapped "10"}
|
BIN="${getExe (phpunitUnwrapped "10")}"
|
||||||
;;
|
;;
|
||||||
11)
|
11)
|
||||||
PKG=${phpunitUnwrapped "11"}
|
BIN="${getExe (phpunitUnwrapped "11")}"
|
||||||
;;
|
;;
|
||||||
12)
|
12)
|
||||||
PKG=${phpunitUnwrapped "12"}
|
BIN="${getExe (phpunitUnwrapped "12")}"
|
||||||
;;
|
;;
|
||||||
13)
|
13)
|
||||||
PKG=${phpunitUnwrapped "13"}
|
BIN="${getExe (phpunitUnwrapped "13")}"
|
||||||
;;
|
;;
|
||||||
*)
|
*)
|
||||||
PKG=${phpunitUnwrapped "10"}
|
BIN="${getExe (phpunitUnwrapped "10")}"
|
||||||
;;
|
;;
|
||||||
esac
|
esac
|
||||||
"$PKG"/bin/phpunit "$@"
|
"$BIN" "$@"
|
||||||
'';
|
'';
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
@ -160,6 +160,7 @@
|
||||||
phpEnv.packages.composer
|
phpEnv.packages.composer
|
||||||
phpunit
|
phpunit
|
||||||
]
|
]
|
||||||
|
++ (map phpunitUnwrapped ["9" "10" "11" "12" "13"])
|
||||||
++ optionals ((compareVersions phpVersion "8.2") == 1) [
|
++ optionals ((compareVersions phpVersion "8.2") == 1) [
|
||||||
(frankenphp.override {
|
(frankenphp.override {
|
||||||
php = php.withExtensions (
|
php = php.withExtensions (
|
||||||
|
|
|
||||||
|
|
@ -45,12 +45,16 @@ in
|
||||||
|
|
||||||
doInstallCheck = false;
|
doInstallCheck = false;
|
||||||
|
|
||||||
|
postInstall = ''
|
||||||
|
mv $out/bin/phpunit $out/bin/phpunit${majorVersion}
|
||||||
|
'';
|
||||||
|
|
||||||
meta = {
|
meta = {
|
||||||
changelog = "https://github.com/sebastianbergmann/phpunit/blob/${finalAttrs.version}/ChangeLog-${lib.versions.majorMinor finalAttrs.version}.md";
|
changelog = "https://github.com/sebastianbergmann/phpunit/blob/${finalAttrs.version}/ChangeLog-${lib.versions.majorMinor finalAttrs.version}.md";
|
||||||
description = "PHP Unit Testing framework";
|
description = "PHP Unit Testing framework";
|
||||||
homepage = "https://phpunit.de";
|
homepage = "https://phpunit.de";
|
||||||
license = lib.licenses.bsd3;
|
license = lib.licenses.bsd3;
|
||||||
mainProgram = "phpunit";
|
mainProgram = "phpunit${majorVersion}";
|
||||||
maintainers = with lib.maintainers; [onny];
|
maintainers = with lib.maintainers; [onny];
|
||||||
teams = [lib.teams.php];
|
teams = [lib.teams.php];
|
||||||
};
|
};
|
||||||
|
|
|
||||||
|
|
@ -3,5 +3,15 @@
|
||||||
def --wrapped main [...rest] {
|
def --wrapped main [...rest] {
|
||||||
cd $env.WEBROOT
|
cd $env.WEBROOT
|
||||||
|
|
||||||
XDEBUG_SESSION=haze phpunit --configuration $"($env.WEBROOT)/tests/phpunit-autotest.xml" ...$rest
|
mut args = $rest;
|
||||||
|
mut command = "phpunit";
|
||||||
|
if (($args | first | detect type | describe) == "int") {
|
||||||
|
let phpunit_version = $rest | first
|
||||||
|
$command = $"phpunit($phpunit_version)"
|
||||||
|
$args = $args | skip 1
|
||||||
|
}
|
||||||
|
|
||||||
|
let command = $command
|
||||||
|
let args = $args
|
||||||
|
XDEBUG_SESSION=haze exec $command --configuration $"($env.WEBROOT)/tests/phpunit-autotest.xml" ...$args
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -426,7 +426,7 @@ pub enum HazeCommand {
|
||||||
/// Run tests in a new instance
|
/// Run tests in a new instance
|
||||||
#[strum(props(
|
#[strum(props(
|
||||||
InstanceArgs = true,
|
InstanceArgs = true,
|
||||||
Args = "[phpunit arguments] arguments to pass to phpunit"
|
Args = "[phpunit version] use a specific phpunit version instead of the automatically detected one [phpunit arguments] arguments to pass to phpunit"
|
||||||
))]
|
))]
|
||||||
Test,
|
Test,
|
||||||
/// Run a command in an instance
|
/// Run a command in an instance
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue