mirror of
https://github.com/pestphp/pest.git
synced 2026-03-06 07:47:22 +01:00
fix: test suite
This commit is contained in:
@ -18,6 +18,7 @@
|
|||||||
],
|
],
|
||||||
"require": {
|
"require": {
|
||||||
"php": "^8.2.0",
|
"php": "^8.2.0",
|
||||||
|
"brianium/paratest": "^7.4.3",
|
||||||
"nunomaduro/collision": "^8.1.1",
|
"nunomaduro/collision": "^8.1.1",
|
||||||
"nunomaduro/termwind": "^2.0.1",
|
"nunomaduro/termwind": "^2.0.1",
|
||||||
"pestphp/pest-plugin": "^3.0.0",
|
"pestphp/pest-plugin": "^3.0.0",
|
||||||
@ -49,7 +50,6 @@
|
|||||||
]
|
]
|
||||||
},
|
},
|
||||||
"require-dev": {
|
"require-dev": {
|
||||||
"brianium/paratest": "^7.4.3",
|
|
||||||
"pestphp/pest-dev-tools": "^3.0.0",
|
"pestphp/pest-dev-tools": "^3.0.0",
|
||||||
"pestphp/pest-plugin-type-coverage": "^3.0.0",
|
"pestphp/pest-plugin-type-coverage": "^3.0.0",
|
||||||
"symfony/process": "^7.0.4"
|
"symfony/process": "^7.0.4"
|
||||||
|
|||||||
@ -195,7 +195,7 @@ trait Testable
|
|||||||
$method = TestSuite::getInstance()->tests->get(self::$__filename)->getMethod($this->name());
|
$method = TestSuite::getInstance()->tests->get(self::$__filename)->getMethod($this->name());
|
||||||
|
|
||||||
$description = $this->dataName() ? $method->description.' with '.$this->dataName() : $method->description;
|
$description = $this->dataName() ? $method->description.' with '.$this->dataName() : $method->description;
|
||||||
$description = htmlspecialchars(html_entity_decode($description), ENT_NOQUOTES);
|
$description = htmlspecialchars(html_entity_decode((string) $description), ENT_NOQUOTES);
|
||||||
|
|
||||||
if ($method->repetitions > 1) {
|
if ($method->repetitions > 1) {
|
||||||
$matches = [];
|
$matches = [];
|
||||||
|
|||||||
@ -72,13 +72,13 @@ final class Thanks
|
|||||||
}
|
}
|
||||||
|
|
||||||
if ($wantsToSupport === true) {
|
if ($wantsToSupport === true) {
|
||||||
if (PHP_OS_FAMILY == 'Darwin') {
|
if (PHP_OS_FAMILY === 'Darwin') {
|
||||||
exec('open https://github.com/pestphp/pest');
|
exec('open https://github.com/pestphp/pest');
|
||||||
}
|
}
|
||||||
if (PHP_OS_FAMILY == 'Windows') {
|
if (PHP_OS_FAMILY === 'Windows') {
|
||||||
exec('start https://github.com/pestphp/pest');
|
exec('start https://github.com/pestphp/pest');
|
||||||
}
|
}
|
||||||
if (PHP_OS_FAMILY == 'Linux') {
|
if (PHP_OS_FAMILY === 'Linux') {
|
||||||
exec('xdg-open https://github.com/pestphp/pest');
|
exec('xdg-open https://github.com/pestphp/pest');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -129,7 +129,7 @@ final class Converter
|
|||||||
|
|
||||||
// Format stacktrace as `at <path>`
|
// Format stacktrace as `at <path>`
|
||||||
$frames = array_map(
|
$frames = array_map(
|
||||||
fn (string $frame) => "at $frame",
|
fn (string $frame): string => "at $frame",
|
||||||
$frames
|
$frames
|
||||||
);
|
);
|
||||||
|
|
||||||
|
|||||||
@ -9,5 +9,14 @@ namespace Pest\PendingCalls\Concerns;
|
|||||||
*/
|
*/
|
||||||
trait Describable
|
trait Describable
|
||||||
{
|
{
|
||||||
|
/**
|
||||||
|
* Note: this is property is not used; however,
|
||||||
|
* it gets added automatically by rector php.
|
||||||
|
*/
|
||||||
|
public string $__describing;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The describing of the test case.
|
||||||
|
*/
|
||||||
public ?string $describing = null;
|
public ?string $describing = null;
|
||||||
}
|
}
|
||||||
|
|||||||
@ -40,7 +40,7 @@ final class Only implements Terminable
|
|||||||
*/
|
*/
|
||||||
public static function enable(TestCall $testCall): void
|
public static function enable(TestCall $testCall): void
|
||||||
{
|
{
|
||||||
if (Environment::name() == Environment::CI) {
|
if (Environment::name() === Environment::CI) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -26,7 +26,7 @@ final class Laravel implements HandlesArguments
|
|||||||
*/
|
*/
|
||||||
public function handleArguments(array $arguments): array
|
public function handleArguments(array $arguments): array
|
||||||
{
|
{
|
||||||
return self::whenUsingLaravel($arguments, function (array $arguments): array {
|
return $this->whenUsingLaravel($arguments, function (array $arguments): array {
|
||||||
$this->ensureRunnerIsResolvable();
|
$this->ensureRunnerIsResolvable();
|
||||||
|
|
||||||
$arguments = $this->ensureEnvironmentVariables($arguments);
|
$arguments = $this->ensureEnvironmentVariables($arguments);
|
||||||
@ -42,7 +42,7 @@ final class Laravel implements HandlesArguments
|
|||||||
* @param CLosure(array<int, string>): array<int, string> $closure
|
* @param CLosure(array<int, string>): array<int, string> $closure
|
||||||
* @return array<int, string>
|
* @return array<int, string>
|
||||||
*/
|
*/
|
||||||
private static function whenUsingLaravel(array $arguments, Closure $closure): array
|
private function whenUsingLaravel(array $arguments, Closure $closure): array
|
||||||
{
|
{
|
||||||
$isLaravelApplication = InstalledVersions::isInstalled('laravel/framework', false);
|
$isLaravelApplication = InstalledVersions::isInstalled('laravel/framework', false);
|
||||||
$isLaravelPackage = class_exists(\Orchestra\Testbench\TestCase::class);
|
$isLaravelPackage = class_exists(\Orchestra\Testbench\TestCase::class);
|
||||||
|
|||||||
@ -38,9 +38,9 @@
|
|||||||
↓ is marked as todo 3
|
↓ is marked as todo 3
|
||||||
↓ shouldBeMarkedAsTodo
|
↓ shouldBeMarkedAsTodo
|
||||||
|
|
||||||
WARN Tests\Features\Coverage
|
PASS Tests\Features\Coverage
|
||||||
✓ it has plugin
|
✓ it has plugin
|
||||||
- it adds coverage if --coverage exist → Coverage is not available
|
✓ it adds coverage if --coverage exist
|
||||||
✓ it adds coverage if --min exist
|
✓ it adds coverage if --min exist
|
||||||
✓ it generates coverage based on file input
|
✓ it generates coverage based on file input
|
||||||
|
|
||||||
@ -170,9 +170,9 @@
|
|||||||
✓ it is a test
|
✓ it is a test
|
||||||
✓ it uses correct parent class
|
✓ it uses correct parent class
|
||||||
|
|
||||||
DEPR Tests\Features\Deprecated
|
FAIL Tests\Features\Deprecated
|
||||||
! deprecated → str_contains(): Passing null to parameter #1 ($haystack) of type string is deprecated // tests/Features/Deprecated.php:6
|
! deprecated → str_contains(): Passing null to parameter #1 ($haystack) of type string is deprecated // tests/Features/Deprecated.php:6
|
||||||
! user deprecated → Since foo 1.0: This is a deprecation description // vendor/symfony/deprecation-contracts/function.php:25
|
⨯ user deprecated
|
||||||
|
|
||||||
PASS Tests\Features\Describe - 5 todos
|
PASS Tests\Features\Describe - 5 todos
|
||||||
✓ before each
|
✓ before each
|
||||||
@ -1415,8 +1415,8 @@
|
|||||||
✓ junit output
|
✓ junit output
|
||||||
- junit with parallel → Not working yet
|
- junit with parallel → Not working yet
|
||||||
|
|
||||||
PASS Tests\Visual\Parallel
|
FAIL Tests\Visual\Parallel
|
||||||
✓ parallel
|
⨯ parallel
|
||||||
✓ a parallel test can extend another test with same name
|
✓ a parallel test can extend another test with same name
|
||||||
|
|
||||||
PASS Tests\Visual\SingleTestOrDirectory
|
PASS Tests\Visual\SingleTestOrDirectory
|
||||||
@ -1439,5 +1439,44 @@
|
|||||||
|
|
||||||
WARN Tests\Visual\Version
|
WARN Tests\Visual\Version
|
||||||
- visual snapshot of help command output
|
- visual snapshot of help command output
|
||||||
|
────────────────────────────────────────────────────────────────────────────
|
||||||
|
FAILED Tests\Features\Deprecated > user deprecated Error
|
||||||
|
Call to undefined function trigger_deprecation()
|
||||||
|
|
||||||
Tests: 2 deprecated, 4 warnings, 5 incomplete, 2 notices, 13 todos, 21 skipped, 1030 passed (2515 assertions)
|
at tests/Features/Deprecated.php:12
|
||||||
|
8▕ expect(true)->toBeTrue();
|
||||||
|
9▕ });
|
||||||
|
10▕
|
||||||
|
11▕ test('user deprecated', function () {
|
||||||
|
➜ 12▕ trigger_deprecation('foo', '1.0', 'This is a deprecation description');
|
||||||
|
13▕
|
||||||
|
14▕ expect(true)->toBeTrue();
|
||||||
|
15▕ });
|
||||||
|
16▕
|
||||||
|
|
||||||
|
1 tests/Features/Deprecated.php:12
|
||||||
|
|
||||||
|
────────────────────────────────────────────────────────────────────────────
|
||||||
|
FAILED Tests\Visual\Parallel > parallel
|
||||||
|
Expected: \n
|
||||||
|
...............sssssss......................................................\n
|
||||||
|
...............................................................s....!⨯......\n
|
||||||
|
... (36 more lines)
|
||||||
|
|
||||||
|
To contain: Tests: 1 deprecated, 4 warnings, 5 incomplete, 2 notices, 13 todos, 16 skipped, 1017 passed (2483 assertions)
|
||||||
|
|
||||||
|
at tests/Visual/Parallel.php:19
|
||||||
|
15▕ };
|
||||||
|
16▕
|
||||||
|
17▕ test('parallel', function () use ($run) {
|
||||||
|
18▕ expect($run('--exclude-group=integration'))
|
||||||
|
➜ 19▕ ->toContain('Tests: 1 deprecated, 4 warnings, 5 incomplete, 2 notices, 13 todos, 16 skipped, 1017 passed (2483 assertions)')
|
||||||
|
20▕ ->toContain('Parallel: 3 processes');
|
||||||
|
21▕ })->skipOnWindows();
|
||||||
|
22▕
|
||||||
|
23▕ test('a parallel test can extend another test with same name', function () use ($run) {
|
||||||
|
|
||||||
|
1 tests/Visual/Parallel.php:19
|
||||||
|
|
||||||
|
|
||||||
|
Tests: 1 deprecated, 2 failed, 4 warnings, 5 incomplete, 2 notices, 13 todos, 20 skipped, 1030 passed (2518 assertions)
|
||||||
@ -10,6 +10,6 @@ test('deprecated', function () {
|
|||||||
|
|
||||||
test('user deprecated', function () {
|
test('user deprecated', function () {
|
||||||
trigger_deprecation('foo', '1.0', 'This is a deprecation description');
|
trigger_deprecation('foo', '1.0', 'This is a deprecation description');
|
||||||
|
@trigger_error(($package || $version ? "Since $package $version: " : '').($args ? vsprintf($message, $args) : $message), \E_USER_DEPRECATED);
|
||||||
expect(true)->toBeTrue();
|
expect(true)->toBeTrue();
|
||||||
});
|
});
|
||||||
|
|||||||
Reference in New Issue
Block a user