Adds Pest tests. Starts GH Action.

This commit is contained in:
Joao Patricio 2023-03-20 21:17:28 +00:00
parent 9a7a992495
commit d7c7494007
9 changed files with 967 additions and 36 deletions

26
.github/workflows/docker-image.yml vendored Normal file
View File

@ -0,0 +1,26 @@
name: Docker Image CI
on:
push:
branches: [ "main" ]
pull_request:
branches: [ "*" ]
jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Build the Docker image
run: |
docker run --rm -u "$(id -u):$(id -g)" \
-v "$(pwd):/app" \
-w /app composer:2 \
composer install --ignore-platform-reqs
TAG=$(date +%s) ./vendor/bin/sail build
TAG=$(date +%s) ./vendor/bin/sail up -d
sleep 5
./vendor/bin/sail artisan test

View File

@ -55,6 +55,7 @@ public function handle(): ?ProcessResult
$sshCommand = 'ssh ' $sshCommand = 'ssh '
. '-o StrictHostKeyChecking=no -o UserKnownHostsFile=/dev/null ' . '-o StrictHostKeyChecking=no -o UserKnownHostsFile=/dev/null '
. '-o PasswordAuthentication=no ' . '-o PasswordAuthentication=no '
. '-o RequestTTY=no '
// Quiet mode. Causes most warning and diagnostic messages to be suppressed. // Quiet mode. Causes most warning and diagnostic messages to be suppressed.
// Errors are still out put. This is to silence for example, that warning // Errors are still out put. This is to silence for example, that warning
// Permanently added <host and key type> to the list of known hosts. // Permanently added <host and key type> to the list of known hosts.

View File

@ -20,6 +20,7 @@
"laravel/sail": "^1.18", "laravel/sail": "^1.18",
"mockery/mockery": "^1.4.4", "mockery/mockery": "^1.4.4",
"nunomaduro/collision": "^7.0", "nunomaduro/collision": "^7.0",
"pestphp/pest": "^2.0",
"phpunit/phpunit": "^10.0", "phpunit/phpunit": "^10.0",
"spatie/laravel-ignition": "^2.0" "spatie/laravel-ignition": "^2.0"
}, },

857
composer.lock generated
View File

@ -4,7 +4,7 @@
"Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies", "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies",
"This file is @generated automatically" "This file is @generated automatically"
], ],
"content-hash": "262dce663830cec0e39428d0d3d76c7e", "content-hash": "5b876c04da75e4ae5fab21efa402fd45",
"packages": [ "packages": [
{ {
"name": "brick/math", "name": "brick/math",
@ -6311,6 +6311,144 @@
} }
], ],
"packages-dev": [ "packages-dev": [
{
"name": "brianium/paratest",
"version": "v7.1.2",
"source": {
"type": "git",
"url": "https://github.com/paratestphp/paratest.git",
"reference": "10e66ccdad397200f8129a034f0d3bf8cbe4c524"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/paratestphp/paratest/zipball/10e66ccdad397200f8129a034f0d3bf8cbe4c524",
"reference": "10e66ccdad397200f8129a034f0d3bf8cbe4c524",
"shasum": ""
},
"require": {
"ext-dom": "*",
"ext-pcre": "*",
"ext-reflection": "*",
"ext-simplexml": "*",
"fidry/cpu-core-counter": "^0.4.1 || ^0.5.1",
"jean85/pretty-package-versions": "^2.0.5",
"php": "~8.1.0 || ~8.2.0",
"phpunit/php-code-coverage": "^10.0.2",
"phpunit/php-file-iterator": "^4.0.1",
"phpunit/php-timer": "^6.0",
"phpunit/phpunit": "^10.0.17",
"sebastian/environment": "^6.0",
"symfony/console": "^6.2.7",
"symfony/process": "^6.2.7"
},
"require-dev": {
"doctrine/coding-standard": "^11.1.0",
"ext-pcov": "*",
"ext-posix": "*",
"infection/infection": "^0.26.19",
"phpstan/phpstan": "^1.10.7",
"phpstan/phpstan-deprecation-rules": "^1.1.3",
"phpstan/phpstan-phpunit": "^1.3.10",
"phpstan/phpstan-strict-rules": "^1.5",
"squizlabs/php_codesniffer": "^3.7.2",
"symfony/filesystem": "^6.2.7"
},
"bin": [
"bin/paratest",
"bin/paratest.bat",
"bin/paratest_for_phpstorm"
],
"type": "library",
"autoload": {
"psr-4": {
"ParaTest\\": [
"src/"
]
}
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"MIT"
],
"authors": [
{
"name": "Brian Scaturro",
"email": "scaturrob@gmail.com",
"role": "Developer"
},
{
"name": "Filippo Tessarotto",
"email": "zoeslam@gmail.com",
"role": "Developer"
}
],
"description": "Parallel testing for PHP",
"homepage": "https://github.com/paratestphp/paratest",
"keywords": [
"concurrent",
"parallel",
"phpunit",
"testing"
],
"support": {
"issues": "https://github.com/paratestphp/paratest/issues",
"source": "https://github.com/paratestphp/paratest/tree/v7.1.2"
},
"funding": [
{
"url": "https://github.com/sponsors/Slamdunk",
"type": "github"
},
{
"url": "https://paypal.me/filippotessarotto",
"type": "paypal"
}
],
"time": "2023-03-20T15:15:41+00:00"
},
{
"name": "doctrine/deprecations",
"version": "v1.0.0",
"source": {
"type": "git",
"url": "https://github.com/doctrine/deprecations.git",
"reference": "0e2a4f1f8cdfc7a92ec3b01c9334898c806b30de"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/doctrine/deprecations/zipball/0e2a4f1f8cdfc7a92ec3b01c9334898c806b30de",
"reference": "0e2a4f1f8cdfc7a92ec3b01c9334898c806b30de",
"shasum": ""
},
"require": {
"php": "^7.1|^8.0"
},
"require-dev": {
"doctrine/coding-standard": "^9",
"phpunit/phpunit": "^7.5|^8.5|^9.5",
"psr/log": "^1|^2|^3"
},
"suggest": {
"psr/log": "Allows logging deprecations via PSR-3 logger implementation"
},
"type": "library",
"autoload": {
"psr-4": {
"Doctrine\\Deprecations\\": "lib/Doctrine/Deprecations"
}
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"MIT"
],
"description": "A small layer on top of trigger_error(E_USER_DEPRECATED) or PSR-3 logging with options to disable all deprecations or selectively for packages.",
"homepage": "https://www.doctrine-project.org/",
"support": {
"issues": "https://github.com/doctrine/deprecations/issues",
"source": "https://github.com/doctrine/deprecations/tree/v1.0.0"
},
"time": "2022-05-02T15:47:09+00:00"
},
{ {
"name": "fakerphp/faker", "name": "fakerphp/faker",
"version": "v1.21.0", "version": "v1.21.0",
@ -6379,6 +6517,67 @@
}, },
"time": "2022-12-13T13:54:32+00:00" "time": "2022-12-13T13:54:32+00:00"
}, },
{
"name": "fidry/cpu-core-counter",
"version": "0.5.1",
"source": {
"type": "git",
"url": "https://github.com/theofidry/cpu-core-counter.git",
"reference": "b58e5a3933e541dc286cc91fc4f3898bbc6f1623"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/theofidry/cpu-core-counter/zipball/b58e5a3933e541dc286cc91fc4f3898bbc6f1623",
"reference": "b58e5a3933e541dc286cc91fc4f3898bbc6f1623",
"shasum": ""
},
"require": {
"php": "^7.2 || ^8.0"
},
"require-dev": {
"fidry/makefile": "^0.2.0",
"phpstan/extension-installer": "^1.2.0",
"phpstan/phpstan": "^1.9.2",
"phpstan/phpstan-deprecation-rules": "^1.0.0",
"phpstan/phpstan-phpunit": "^1.2.2",
"phpstan/phpstan-strict-rules": "^1.4.4",
"phpunit/phpunit": "^9.5.26 || ^8.5.31",
"theofidry/php-cs-fixer-config": "^1.0",
"webmozarts/strict-phpunit": "^7.5"
},
"type": "library",
"autoload": {
"psr-4": {
"Fidry\\CpuCoreCounter\\": "src/"
}
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"MIT"
],
"authors": [
{
"name": "Théo FIDRY",
"email": "theo.fidry@gmail.com"
}
],
"description": "Tiny utility to get the number of CPU cores.",
"keywords": [
"CPU",
"core"
],
"support": {
"issues": "https://github.com/theofidry/cpu-core-counter/issues",
"source": "https://github.com/theofidry/cpu-core-counter/tree/0.5.1"
},
"funding": [
{
"url": "https://github.com/theofidry",
"type": "github"
}
],
"time": "2022-12-24T12:35:10+00:00"
},
{ {
"name": "filp/whoops", "name": "filp/whoops",
"version": "2.15.1", "version": "2.15.1",
@ -6501,6 +6700,65 @@
}, },
"time": "2020-07-09T08:09:16+00:00" "time": "2020-07-09T08:09:16+00:00"
}, },
{
"name": "jean85/pretty-package-versions",
"version": "2.0.5",
"source": {
"type": "git",
"url": "https://github.com/Jean85/pretty-package-versions.git",
"reference": "ae547e455a3d8babd07b96966b17d7fd21d9c6af"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/Jean85/pretty-package-versions/zipball/ae547e455a3d8babd07b96966b17d7fd21d9c6af",
"reference": "ae547e455a3d8babd07b96966b17d7fd21d9c6af",
"shasum": ""
},
"require": {
"composer-runtime-api": "^2.0.0",
"php": "^7.1|^8.0"
},
"require-dev": {
"friendsofphp/php-cs-fixer": "^2.17",
"jean85/composer-provided-replaced-stub-package": "^1.0",
"phpstan/phpstan": "^0.12.66",
"phpunit/phpunit": "^7.5|^8.5|^9.4",
"vimeo/psalm": "^4.3"
},
"type": "library",
"extra": {
"branch-alias": {
"dev-master": "1.x-dev"
}
},
"autoload": {
"psr-4": {
"Jean85\\": "src/"
}
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"MIT"
],
"authors": [
{
"name": "Alessandro Lai",
"email": "alessandro.lai85@gmail.com"
}
],
"description": "A library to get pretty versions strings of installed dependencies",
"keywords": [
"composer",
"package",
"release",
"versions"
],
"support": {
"issues": "https://github.com/Jean85/pretty-package-versions/issues",
"source": "https://github.com/Jean85/pretty-package-versions/tree/2.0.5"
},
"time": "2021-10-08T21:21:46+00:00"
},
{ {
"name": "laravel/pint", "name": "laravel/pint",
"version": "v1.6.0", "version": "v1.6.0",
@ -6764,17 +7022,80 @@
"time": "2023-03-08T13:26:56+00:00" "time": "2023-03-08T13:26:56+00:00"
}, },
{ {
"name": "nunomaduro/collision", "name": "myclabs/php-enum",
"version": "v7.1.2", "version": "1.8.4",
"source": { "source": {
"type": "git", "type": "git",
"url": "https://github.com/nunomaduro/collision.git", "url": "https://github.com/myclabs/php-enum.git",
"reference": "f502ff3b2051124c89b4dd3a8a497ca65f3ce26c" "reference": "a867478eae49c9f59ece437ae7f9506bfaa27483"
}, },
"dist": { "dist": {
"type": "zip", "type": "zip",
"url": "https://api.github.com/repos/nunomaduro/collision/zipball/f502ff3b2051124c89b4dd3a8a497ca65f3ce26c", "url": "https://api.github.com/repos/myclabs/php-enum/zipball/a867478eae49c9f59ece437ae7f9506bfaa27483",
"reference": "f502ff3b2051124c89b4dd3a8a497ca65f3ce26c", "reference": "a867478eae49c9f59ece437ae7f9506bfaa27483",
"shasum": ""
},
"require": {
"ext-json": "*",
"php": "^7.3 || ^8.0"
},
"require-dev": {
"phpunit/phpunit": "^9.5",
"squizlabs/php_codesniffer": "1.*",
"vimeo/psalm": "^4.6.2"
},
"type": "library",
"autoload": {
"psr-4": {
"MyCLabs\\Enum\\": "src/"
},
"classmap": [
"stubs/Stringable.php"
]
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"MIT"
],
"authors": [
{
"name": "PHP Enum contributors",
"homepage": "https://github.com/myclabs/php-enum/graphs/contributors"
}
],
"description": "PHP Enum implementation",
"homepage": "http://github.com/myclabs/php-enum",
"keywords": [
"enum"
],
"support": {
"issues": "https://github.com/myclabs/php-enum/issues",
"source": "https://github.com/myclabs/php-enum/tree/1.8.4"
},
"funding": [
{
"url": "https://github.com/mnapoli",
"type": "github"
},
{
"url": "https://tidelift.com/funding/github/packagist/myclabs/php-enum",
"type": "tidelift"
}
],
"time": "2022-08-04T09:53:51+00:00"
},
{
"name": "nunomaduro/collision",
"version": "v7.2.0",
"source": {
"type": "git",
"url": "https://github.com/nunomaduro/collision.git",
"reference": "8ee125cb0888cf694b559caa015e104f577bb4f0"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/nunomaduro/collision/zipball/8ee125cb0888cf694b559caa015e104f577bb4f0",
"reference": "8ee125cb0888cf694b559caa015e104f577bb4f0",
"shasum": "" "shasum": ""
}, },
"require": { "require": {
@ -6788,13 +7109,13 @@
}, },
"require-dev": { "require-dev": {
"brianium/paratest": "^7.1.1", "brianium/paratest": "^7.1.1",
"laravel/framework": "^10.3.3", "laravel/framework": "^10.4.1",
"laravel/pint": "^1.6.0", "laravel/pint": "^1.6.0",
"laravel/sail": "^1.21.2", "laravel/sail": "^1.21.2",
"laravel/sanctum": "^3.2.1", "laravel/sanctum": "^3.2.1",
"laravel/tinker": "^2.8.1", "laravel/tinker": "^2.8.1",
"nunomaduro/larastan": "^2.5.1", "nunomaduro/larastan": "^2.5.1",
"orchestra/testbench-core": "^8.0.5", "orchestra/testbench-core": "^8.1.0",
"pestphp/pest": "^2.0.0", "pestphp/pest": "^2.0.0",
"phpunit/phpunit": "^10.0.16", "phpunit/phpunit": "^10.0.16",
"sebastian/environment": "^6.0.0", "sebastian/environment": "^6.0.0",
@ -6857,7 +7178,237 @@
"type": "patreon" "type": "patreon"
} }
], ],
"time": "2023-03-14T14:34:49+00:00" "time": "2023-03-19T17:08:17+00:00"
},
{
"name": "pestphp/pest",
"version": "v2.0.2",
"source": {
"type": "git",
"url": "https://github.com/pestphp/pest.git",
"reference": "9d0cd32e3f9286d03f66636a395632972a66a52e"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/pestphp/pest/zipball/9d0cd32e3f9286d03f66636a395632972a66a52e",
"reference": "9d0cd32e3f9286d03f66636a395632972a66a52e",
"shasum": ""
},
"require": {
"brianium/paratest": "^7.1.2",
"nunomaduro/collision": "^7.2.0",
"nunomaduro/termwind": "^1.15.1",
"pestphp/pest-plugin": "^2.0.0",
"pestphp/pest-plugin-arch": "^2.0.1",
"php": "^8.1.0",
"phpunit/phpunit": "^10.0.17"
},
"conflict": {
"phpunit/phpunit": ">10.0.17",
"webmozart/assert": "<1.11.0"
},
"require-dev": {
"pestphp/pest-dev-tools": "^2.5.0",
"symfony/process": "^6.2.7"
},
"bin": [
"bin/pest"
],
"type": "library",
"extra": {
"pest": {
"plugins": [
"Pest\\Plugins\\Bail",
"Pest\\Plugins\\Cache",
"Pest\\Plugins\\Coverage",
"Pest\\Plugins\\Init",
"Pest\\Plugins\\Environment",
"Pest\\Plugins\\Help",
"Pest\\Plugins\\Memory",
"Pest\\Plugins\\Printer",
"Pest\\Plugins\\ProcessIsolation",
"Pest\\Plugins\\Profile",
"Pest\\Plugins\\Retry",
"Pest\\Plugins\\Version",
"Pest\\Plugins\\Parallel"
]
}
},
"autoload": {
"files": [
"src/Functions.php",
"src/Pest.php"
],
"psr-4": {
"Pest\\": "src/"
}
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"MIT"
],
"authors": [
{
"name": "Nuno Maduro",
"email": "enunomaduro@gmail.com"
}
],
"description": "An elegant PHP Testing Framework.",
"keywords": [
"framework",
"pest",
"php",
"test",
"testing",
"unit"
],
"support": {
"issues": "https://github.com/pestphp/pest/issues",
"source": "https://github.com/pestphp/pest/tree/v2.0.2"
},
"funding": [
{
"url": "https://www.paypal.com/paypalme/enunomaduro",
"type": "custom"
},
{
"url": "https://github.com/nunomaduro",
"type": "github"
}
],
"time": "2023-03-20T17:52:35+00:00"
},
{
"name": "pestphp/pest-plugin",
"version": "v2.0.0",
"source": {
"type": "git",
"url": "https://github.com/pestphp/pest-plugin.git",
"reference": "e46455b40f620f5d29e1b0bdbc41ae8b7506d4fd"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/pestphp/pest-plugin/zipball/e46455b40f620f5d29e1b0bdbc41ae8b7506d4fd",
"reference": "e46455b40f620f5d29e1b0bdbc41ae8b7506d4fd",
"shasum": ""
},
"require": {
"composer-plugin-api": "^2.0.0",
"php": "^8.1"
},
"conflict": {
"pestphp/pest": "<2.0"
},
"require-dev": {
"composer/composer": "^2.5.4",
"pestphp/pest": "^2.0.0",
"pestphp/pest-dev-tools": "^2.5.0"
},
"type": "composer-plugin",
"extra": {
"class": "Pest\\Plugin\\Manager"
},
"autoload": {
"psr-4": {
"Pest\\Plugin\\": "src/"
}
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"MIT"
],
"description": "The Pest plugin manager",
"keywords": [
"framework",
"manager",
"pest",
"php",
"plugin",
"test",
"testing",
"unit"
],
"support": {
"source": "https://github.com/pestphp/pest-plugin/tree/v2.0.0"
},
"funding": [
{
"url": "https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=66BYDWAT92N6L",
"type": "custom"
},
{
"url": "https://github.com/nunomaduro",
"type": "github"
},
{
"url": "https://www.patreon.com/nunomaduro",
"type": "patreon"
}
],
"time": "2023-03-20T10:01:55+00:00"
},
{
"name": "pestphp/pest-plugin-arch",
"version": "v2.0.1",
"source": {
"type": "git",
"url": "https://github.com/pestphp/pest-plugin-arch.git",
"reference": "8bb489c635b386188bf725b0fd0415262d633903"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/pestphp/pest-plugin-arch/zipball/8bb489c635b386188bf725b0fd0415262d633903",
"reference": "8bb489c635b386188bf725b0fd0415262d633903",
"shasum": ""
},
"require": {
"pestphp/pest-plugin": "^2.0.0",
"php": "^8.1",
"ta-tikoma/phpunit-architecture-test": "^0.7.1"
},
"require-dev": {
"pestphp/pest": "^2.0.1",
"pestphp/pest-dev-tools": "^2.5.0"
},
"type": "library",
"autoload": {
"files": [
"src/Autoload.php"
],
"psr-4": {
"Pest\\Arch\\": "src/"
}
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"MIT"
],
"description": "The Arch plugin for Pest PHP.",
"keywords": [
"arch",
"architecture",
"framework",
"pest",
"php",
"plugin",
"test",
"testing",
"unit"
],
"support": {
"source": "https://github.com/pestphp/pest-plugin-arch/tree/v2.0.1"
},
"funding": [
{
"url": "https://www.paypal.com/paypalme/enunomaduro",
"type": "custom"
},
{
"url": "https://github.com/nunomaduro",
"type": "github"
}
],
"time": "2023-03-20T15:14:41+00:00"
}, },
{ {
"name": "phar-io/manifest", "name": "phar-io/manifest",
@ -6970,6 +7521,219 @@
}, },
"time": "2022-02-21T01:04:05+00:00" "time": "2022-02-21T01:04:05+00:00"
}, },
{
"name": "phpdocumentor/reflection-common",
"version": "2.2.0",
"source": {
"type": "git",
"url": "https://github.com/phpDocumentor/ReflectionCommon.git",
"reference": "1d01c49d4ed62f25aa84a747ad35d5a16924662b"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/phpDocumentor/ReflectionCommon/zipball/1d01c49d4ed62f25aa84a747ad35d5a16924662b",
"reference": "1d01c49d4ed62f25aa84a747ad35d5a16924662b",
"shasum": ""
},
"require": {
"php": "^7.2 || ^8.0"
},
"type": "library",
"extra": {
"branch-alias": {
"dev-2.x": "2.x-dev"
}
},
"autoload": {
"psr-4": {
"phpDocumentor\\Reflection\\": "src/"
}
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"MIT"
],
"authors": [
{
"name": "Jaap van Otterdijk",
"email": "opensource@ijaap.nl"
}
],
"description": "Common reflection classes used by phpdocumentor to reflect the code structure",
"homepage": "http://www.phpdoc.org",
"keywords": [
"FQSEN",
"phpDocumentor",
"phpdoc",
"reflection",
"static analysis"
],
"support": {
"issues": "https://github.com/phpDocumentor/ReflectionCommon/issues",
"source": "https://github.com/phpDocumentor/ReflectionCommon/tree/2.x"
},
"time": "2020-06-27T09:03:43+00:00"
},
{
"name": "phpdocumentor/reflection-docblock",
"version": "5.3.0",
"source": {
"type": "git",
"url": "https://github.com/phpDocumentor/ReflectionDocBlock.git",
"reference": "622548b623e81ca6d78b721c5e029f4ce664f170"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/phpDocumentor/ReflectionDocBlock/zipball/622548b623e81ca6d78b721c5e029f4ce664f170",
"reference": "622548b623e81ca6d78b721c5e029f4ce664f170",
"shasum": ""
},
"require": {
"ext-filter": "*",
"php": "^7.2 || ^8.0",
"phpdocumentor/reflection-common": "^2.2",
"phpdocumentor/type-resolver": "^1.3",
"webmozart/assert": "^1.9.1"
},
"require-dev": {
"mockery/mockery": "~1.3.2",
"psalm/phar": "^4.8"
},
"type": "library",
"extra": {
"branch-alias": {
"dev-master": "5.x-dev"
}
},
"autoload": {
"psr-4": {
"phpDocumentor\\Reflection\\": "src"
}
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"MIT"
],
"authors": [
{
"name": "Mike van Riel",
"email": "me@mikevanriel.com"
},
{
"name": "Jaap van Otterdijk",
"email": "account@ijaap.nl"
}
],
"description": "With this component, a library can provide support for annotations via DocBlocks or otherwise retrieve information that is embedded in a DocBlock.",
"support": {
"issues": "https://github.com/phpDocumentor/ReflectionDocBlock/issues",
"source": "https://github.com/phpDocumentor/ReflectionDocBlock/tree/5.3.0"
},
"time": "2021-10-19T17:43:47+00:00"
},
{
"name": "phpdocumentor/type-resolver",
"version": "1.7.0",
"source": {
"type": "git",
"url": "https://github.com/phpDocumentor/TypeResolver.git",
"reference": "1534aea9bde19a5c85c5d1e1f834ab63f4c5dcf5"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/phpDocumentor/TypeResolver/zipball/1534aea9bde19a5c85c5d1e1f834ab63f4c5dcf5",
"reference": "1534aea9bde19a5c85c5d1e1f834ab63f4c5dcf5",
"shasum": ""
},
"require": {
"doctrine/deprecations": "^1.0",
"php": "^7.4 || ^8.0",
"phpdocumentor/reflection-common": "^2.0",
"phpstan/phpdoc-parser": "^1.13"
},
"require-dev": {
"ext-tokenizer": "*",
"phpbench/phpbench": "^1.2",
"phpstan/extension-installer": "^1.1",
"phpstan/phpstan": "^1.8",
"phpstan/phpstan-phpunit": "^1.1",
"phpunit/phpunit": "^9.5",
"rector/rector": "^0.13.9",
"vimeo/psalm": "^4.25"
},
"type": "library",
"extra": {
"branch-alias": {
"dev-1.x": "1.x-dev"
}
},
"autoload": {
"psr-4": {
"phpDocumentor\\Reflection\\": "src"
}
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"MIT"
],
"authors": [
{
"name": "Mike van Riel",
"email": "me@mikevanriel.com"
}
],
"description": "A PSR-5 based resolver of Class names, Types and Structural Element Names",
"support": {
"issues": "https://github.com/phpDocumentor/TypeResolver/issues",
"source": "https://github.com/phpDocumentor/TypeResolver/tree/1.7.0"
},
"time": "2023-03-12T10:13:29+00:00"
},
{
"name": "phpstan/phpdoc-parser",
"version": "1.16.1",
"source": {
"type": "git",
"url": "https://github.com/phpstan/phpdoc-parser.git",
"reference": "e27e92d939e2e3636f0a1f0afaba59692c0bf571"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/phpstan/phpdoc-parser/zipball/e27e92d939e2e3636f0a1f0afaba59692c0bf571",
"reference": "e27e92d939e2e3636f0a1f0afaba59692c0bf571",
"shasum": ""
},
"require": {
"php": "^7.2 || ^8.0"
},
"require-dev": {
"php-parallel-lint/php-parallel-lint": "^1.2",
"phpstan/extension-installer": "^1.0",
"phpstan/phpstan": "^1.5",
"phpstan/phpstan-phpunit": "^1.1",
"phpstan/phpstan-strict-rules": "^1.0",
"phpunit/phpunit": "^9.5",
"symfony/process": "^5.2"
},
"type": "library",
"autoload": {
"psr-4": {
"PHPStan\\PhpDocParser\\": [
"src/"
]
}
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"MIT"
],
"description": "PHPDoc parser with support for nullable, intersection and generic types",
"support": {
"issues": "https://github.com/phpstan/phpdoc-parser/issues",
"source": "https://github.com/phpstan/phpdoc-parser/tree/1.16.1"
},
"time": "2023-02-07T18:11:17+00:00"
},
{ {
"name": "phpunit/php-code-coverage", "name": "phpunit/php-code-coverage",
"version": "10.0.2", "version": "10.0.2",
@ -7290,16 +8054,16 @@
}, },
{ {
"name": "phpunit/phpunit", "name": "phpunit/phpunit",
"version": "10.0.16", "version": "10.0.17",
"source": { "source": {
"type": "git", "type": "git",
"url": "https://github.com/sebastianbergmann/phpunit.git", "url": "https://github.com/sebastianbergmann/phpunit.git",
"reference": "07d386a11ac7094032900f07cada1c8975d16607" "reference": "b75eddcabca052312ae38c8a2bc69ff1a7b89b77"
}, },
"dist": { "dist": {
"type": "zip", "type": "zip",
"url": "https://api.github.com/repos/sebastianbergmann/phpunit/zipball/07d386a11ac7094032900f07cada1c8975d16607", "url": "https://api.github.com/repos/sebastianbergmann/phpunit/zipball/b75eddcabca052312ae38c8a2bc69ff1a7b89b77",
"reference": "07d386a11ac7094032900f07cada1c8975d16607", "reference": "b75eddcabca052312ae38c8a2bc69ff1a7b89b77",
"shasum": "" "shasum": ""
}, },
"require": { "require": {
@ -7370,7 +8134,8 @@
], ],
"support": { "support": {
"issues": "https://github.com/sebastianbergmann/phpunit/issues", "issues": "https://github.com/sebastianbergmann/phpunit/issues",
"source": "https://github.com/sebastianbergmann/phpunit/tree/10.0.16" "security": "https://github.com/sebastianbergmann/phpunit/security/policy",
"source": "https://github.com/sebastianbergmann/phpunit/tree/10.0.17"
}, },
"funding": [ "funding": [
{ {
@ -7386,7 +8151,7 @@
"type": "tidelift" "type": "tidelift"
} }
], ],
"time": "2023-03-13T09:02:40+00:00" "time": "2023-03-20T14:42:33+00:00"
}, },
{ {
"name": "sebastian/cli-parser", "name": "sebastian/cli-parser",
@ -8602,6 +9367,66 @@
], ],
"time": "2023-02-16T09:57:23+00:00" "time": "2023-02-16T09:57:23+00:00"
}, },
{
"name": "ta-tikoma/phpunit-architecture-test",
"version": "0.7.1",
"source": {
"type": "git",
"url": "https://github.com/ta-tikoma/phpunit-architecture-test.git",
"reference": "1f4466e8faf8d7edd1ae26656f39bf9447c5fa38"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/ta-tikoma/phpunit-architecture-test/zipball/1f4466e8faf8d7edd1ae26656f39bf9447c5fa38",
"reference": "1f4466e8faf8d7edd1ae26656f39bf9447c5fa38",
"shasum": ""
},
"require": {
"myclabs/php-enum": "^1.8.4",
"nikic/php-parser": "^4.15.4",
"php": "^8.1.0",
"phpdocumentor/reflection-docblock": "^5.3.0",
"phpunit/phpunit": "^9.6.5|^10.0.16",
"symfony/finder": "^6.2.7"
},
"require-dev": {
"laravel/pint": "^1.6.0",
"phpstan/phpstan": "^1.10.7"
},
"type": "library",
"autoload": {
"psr-4": {
"PHPUnit\\Architecture\\": "src/"
}
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"MIT"
],
"authors": [
{
"name": "Ni Shi",
"email": "futik0ma011@gmail.com"
},
{
"name": "Nuno Maduro",
"email": "enunomaduro@gmail.com"
}
],
"description": "Methods for testing application architecture",
"keywords": [
"architecture",
"phpunit",
"stucture",
"test",
"testing"
],
"support": {
"issues": "https://github.com/ta-tikoma/phpunit-architecture-test/issues",
"source": "https://github.com/ta-tikoma/phpunit-architecture-test/tree/0.7.1"
},
"time": "2023-03-17T01:38:35+00:00"
},
{ {
"name": "theseer/tokenizer", "name": "theseer/tokenizer",
"version": "1.2.1", "version": "1.2.1",

View File

@ -1,7 +1,7 @@
version: '3.8' version: '3.8'
services: services:
php: php:
image: coolify:4 image: "coolify:${TAG:-4}"
build: build:
context: ./docker/dev context: ./docker/dev
dockerfile: Dockerfile dockerfile: Dockerfile

View File

@ -0,0 +1,32 @@
<?php
use Tests\Support\Output;
it('starts a docker container correctly', function () {
$coolifyNamePrefix = 'coolify_test_';
$format = '{"ID":"{{ .ID }}", "Image": "{{ .Image }}", "Names":"{{ .Names }}"}';
$areThereCoolifyTestContainers = "docker ps --filter=\"name={$coolifyNamePrefix}*\" --format '{$format}' ";
// Generate a known name
$containerName = 'coolify_test_' . now()->format('Ymd_his');
$host = 'testing-host';
// Assert there's no containers start with coolify_test_*
$processResult = coolifyProcess($areThereCoolifyTestContainers, $host);
$containers = Output::containerList($processResult->output());
expect($containers)->toBeEmpty();
// start a container nginx -d --name = $containerName
$processResult = coolifyProcess("docker run -d --name {$containerName} nginx", $host);
expect($processResult->successful())->toBeTrue();
// docker ps name = $container
$processResult = coolifyProcess($areThereCoolifyTestContainers, $host);
$containers = Output::containerList($processResult->output());
expect($containers->where('Names', $containerName)->count())->toBe(1);
// Stop testing containers
$processResult = coolifyProcess("docker stop $(docker ps --filter='name={$coolifyNamePrefix}*' -q)", $host);
expect($processResult->successful())->toBeTrue();
});

View File

@ -1,19 +0,0 @@
<?php
namespace Tests\Feature;
// use Illuminate\Foundation\Testing\RefreshDatabase;
use Tests\TestCase;
class ExampleTest extends TestCase
{
/**
* A basic test example.
*/
public function test_the_application_returns_a_successful_response(): void
{
$response = $this->get('/');
$response->assertStatus(200);
}
}

48
tests/Pest.php Normal file
View File

@ -0,0 +1,48 @@
<?php
/*
|--------------------------------------------------------------------------
| Test Case
|--------------------------------------------------------------------------
|
| The closure you provide to your test functions is always bound to a specific PHPUnit test
| case class. By default, that class is "PHPUnit\Framework\TestCase". Of course, you may
| need to change it using the "uses()" function to bind a different classes or traits.
|
*/
uses(
Tests\TestCase::class,
// Illuminate\Foundation\Testing\RefreshDatabase::class,
)->in('Feature');
/*
|--------------------------------------------------------------------------
| Expectations
|--------------------------------------------------------------------------
|
| When you're writing tests, you often need to check that values meet certain conditions. The
| "expect()" function gives you access to a set of "expectations" methods that you can use
| to assert different things. Of course, you may extend the Expectation API at any time.
|
*/
expect()->extend('toBeOne', function () {
return $this->toBe(1);
});
/*
|--------------------------------------------------------------------------
| Functions
|--------------------------------------------------------------------------
|
| While Pest is very powerful out-of-the-box, you may have some testing code specific to your
| project that you don't want to repeat in every file. Here you can also expose helpers as
| global functions to help you to reduce the number of lines of code in your test files.
|
*/
function something()
{
// ..
}

17
tests/Support/Output.php Normal file
View File

@ -0,0 +1,17 @@
<?php
namespace Tests\Support;
use Illuminate\Support\Collection;
class Output
{
public static function containerList($rawOutput): Collection
{
$outputLines = explode(PHP_EOL, $rawOutput);
return collect($outputLines)
->reject(fn($line) => empty($line))
->map(fn($outputLine) => json_decode($outputLine, flags: JSON_THROW_ON_ERROR));
}
}