mirror of
https://github.com/pestphp/pest.git
synced 2026-03-06 15:57:21 +01:00
Compare commits
36 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 2848059a77 | |||
| 5c56ad8772 | |||
| f05fbd4d34 | |||
| 061c9de301 | |||
| cda82d6772 | |||
| 9f6a882327 | |||
| fa7f930d50 | |||
| 84bc028796 | |||
| 7f0e83671b | |||
| 5b9198dad9 | |||
| a1a0f049cd | |||
| a7e231f64f | |||
| 1856c15e67 | |||
| ee4ff5a909 | |||
| 7de10d52a7 | |||
| 660df6d8d1 | |||
| d8666c8abf | |||
| b8ac4968ee | |||
| 78b3c41825 | |||
| b58a020423 | |||
| e337a52cda | |||
| 0a6873d8a6 | |||
| 09b7ab9a42 | |||
| 339414e348 | |||
| bb56d32643 | |||
| acd6bb2234 | |||
| cf93e316ff | |||
| 47cc88a6ab | |||
| 45bf9e8650 | |||
| 3c766c15d5 | |||
| aa407f34d5 | |||
| 077b5ffce0 | |||
| af6240b4ee | |||
| 78b328e970 | |||
| c92fa45ad7 | |||
| d050ef8d54 |
20
.github/PULL_REQUEST_TEMPLATE.md
vendored
20
.github/PULL_REQUEST_TEMPLATE.md
vendored
@ -1,10 +1,16 @@
|
||||
| Q | A
|
||||
| ------------- | ---
|
||||
| Bug fix? | yes/no
|
||||
| New feature? | yes/no
|
||||
| Fixed tickets | #... <!-- #-prefixed issue number(s), if any -->
|
||||
|
||||
<!--
|
||||
- Replace this comment by a description of what your PR is solving.
|
||||
- Fill in the form below correctly. This will help the Pest team to understand the PR and also work on it.
|
||||
-->
|
||||
|
||||
### What:
|
||||
|
||||
- [ ] Bug Fix
|
||||
- [ ] New Feature
|
||||
|
||||
### Description:
|
||||
|
||||
<!-- describe what your PR is solving -->
|
||||
|
||||
### Related:
|
||||
|
||||
<!-- link to the issue(s) your PR is solving. If it doesn't exist, remove the "Related" section. -->
|
||||
|
||||
8
.github/workflows/tests.yml
vendored
8
.github/workflows/tests.yml
vendored
@ -8,7 +8,7 @@ jobs:
|
||||
strategy:
|
||||
matrix:
|
||||
os: [ubuntu-latest, macos-latest, windows-latest]
|
||||
php: ['7.3', '7.4', '8.0', '8.1']
|
||||
php: ['7.3', '7.4', '8.0', '8.1', '8.2']
|
||||
dependency-version: [prefer-lowest, prefer-stable]
|
||||
parallel: ['', '--parallel']
|
||||
exclude:
|
||||
@ -16,6 +16,10 @@ jobs:
|
||||
os: macos-latest
|
||||
- php: 8.1
|
||||
os: windows-latest
|
||||
- php: 8.2
|
||||
os: macos-latest
|
||||
- php: 8.2
|
||||
os: windows-latest
|
||||
|
||||
name: PHP ${{ matrix.php }} - ${{ matrix.os }} - ${{ matrix.dependency-version }} - ${{ matrix.parallel }}
|
||||
|
||||
@ -30,7 +34,7 @@ jobs:
|
||||
tools: composer:v2
|
||||
coverage: none
|
||||
|
||||
- name: Setup Problem Matches
|
||||
- name: Setup Problem Matchers
|
||||
run: |
|
||||
echo "::add-matcher::${{ runner.tool_cache }}/php.json"
|
||||
echo "::add-matcher::${{ runner.tool_cache }}/phpunit.json"
|
||||
|
||||
@ -8,11 +8,11 @@ $finder = PhpCsFixer\Finder::create()
|
||||
->append(['.php-cs-fixer.dist.php']);
|
||||
|
||||
$rules = [
|
||||
'@Symfony' => true,
|
||||
'phpdoc_no_empty_return' => false,
|
||||
'array_syntax' => ['syntax' => 'short'],
|
||||
'yoda_style' => false,
|
||||
'binary_operator_spaces' => [
|
||||
'@Symfony' => true,
|
||||
'phpdoc_no_empty_return' => false,
|
||||
'array_syntax' => ['syntax' => 'short'],
|
||||
'yoda_style' => false,
|
||||
'binary_operator_spaces' => [
|
||||
'operators' => [
|
||||
'=>' => 'align',
|
||||
'=' => 'align',
|
||||
@ -20,6 +20,11 @@ $rules = [
|
||||
],
|
||||
'concat_space' => ['spacing' => 'one'],
|
||||
'not_operator_with_space' => false,
|
||||
'global_namespace_import' => [
|
||||
'import_classes' => true,
|
||||
'import_functions' => true,
|
||||
'import_constants' => true,
|
||||
],
|
||||
];
|
||||
|
||||
$rules['increment_style'] = ['style' => 'post'];
|
||||
|
||||
28
CHANGELOG.md
28
CHANGELOG.md
@ -4,6 +4,34 @@ All notable changes to this project will be documented in this file.
|
||||
The format is based on [Keep a Changelog](http://keepachangelog.com/)
|
||||
and this project adheres to [Semantic Versioning](http://semver.org/).
|
||||
|
||||
## [v1.23.0 (2023-04-19)](https://github.com/pestphp/pest/compare/v1.22.6...v1.23.0)
|
||||
### Changed
|
||||
- Bumps dependencies
|
||||
|
||||
## [v1.22.6 (2023-03-17)](https://github.com/pestphp/pest/compare/v1.22.5...v1.22.6)
|
||||
### Changed
|
||||
- Bumps dependencies
|
||||
|
||||
## [v1.22.5 (2023-03-03)](https://github.com/pestphp/pest/compare/v1.22.4...v1.22.5)
|
||||
### Changed
|
||||
- Bumps dependencies
|
||||
|
||||
## [v1.22.4 (2023-02-03)](https://github.com/pestphp/pest/compare/v1.22.3...v1.22.4)
|
||||
### Changed
|
||||
- Bumps dependencies
|
||||
|
||||
## [v1.22.3 (2022-12-07)](https://github.com/pestphp/pest/compare/v1.22.2...v1.22.3)
|
||||
### Fixed
|
||||
- Fixes ignoring datasets description on lazy datasets ([#612](https://github.com/pestphp/pest/pull/612))
|
||||
|
||||
## [v1.22.2 (2022-11-09)](https://github.com/pestphp/pest/compare/v1.22.1...v1.22.2)
|
||||
### Fixed
|
||||
- Fixes storing lazy datasets into internal array ([#602](https://github.com/pestphp/pest/pull/602))
|
||||
|
||||
## [v1.22.1 (2022-08-29)](https://github.com/pestphp/pest/compare/v1.22.0...v1.22.1)
|
||||
### Fixed
|
||||
- Initial PHP 8.2 support ([d050ef8](https://github.com/pestphp/pest/commit/d050ef8d54ffe8dfe015adeb1188aae2cca33c33))
|
||||
|
||||
## [v1.22.0 (2022-08-28)](https://github.com/pestphp/pest/compare/v1.21.3...v1.22.0)
|
||||
### Added
|
||||
- Initial PHP 8.2 support ([#563](https://github.com/pestphp/pest/pull/563))
|
||||
|
||||
@ -18,9 +18,9 @@
|
||||
],
|
||||
"require": {
|
||||
"php": "^7.3 || ^8.0",
|
||||
"nunomaduro/collision": "^5.10.0|^6.0",
|
||||
"pestphp/pest-plugin": "^1.0.0",
|
||||
"phpunit/phpunit": "^9.5.5"
|
||||
"nunomaduro/collision": "^5.11.0|^6.4.0",
|
||||
"pestphp/pest-plugin": "^1.1.0",
|
||||
"phpunit/phpunit": "^9.6.10"
|
||||
},
|
||||
"autoload": {
|
||||
"psr-4": {
|
||||
@ -40,13 +40,13 @@
|
||||
]
|
||||
},
|
||||
"require-dev": {
|
||||
"illuminate/console": "^8.47.0",
|
||||
"illuminate/support": "^8.47.0",
|
||||
"laravel/dusk": "^6.15.0",
|
||||
"pestphp/pest-dev-tools": "dev-master",
|
||||
"pestphp/pest-plugin-parallel": "^1.0"
|
||||
"illuminate/console": "^8.83.27",
|
||||
"illuminate/support": "^8.83.27",
|
||||
"laravel/dusk": "^6.25.2",
|
||||
"pestphp/pest-dev-tools": "^1.0.0",
|
||||
"pestphp/pest-plugin-parallel": "^1.2.1"
|
||||
},
|
||||
"minimum-stability": "dev",
|
||||
"minimum-stability": "stable",
|
||||
"prefer-stable": true,
|
||||
"config": {
|
||||
"sort-packages": true,
|
||||
@ -59,8 +59,8 @@
|
||||
"bin/pest"
|
||||
],
|
||||
"scripts": {
|
||||
"lint": "php-cs-fixer fix -v",
|
||||
"test:lint": "php-cs-fixer fix -v --dry-run",
|
||||
"lint": "PHP_CS_FIXER_IGNORE_ENV=true php-cs-fixer fix -v",
|
||||
"test:lint": "PHP_CS_FIXER_IGNORE_ENV=true php-cs-fixer fix -v --dry-run",
|
||||
"test:types": "phpstan analyse --ansi --memory-limit=-1",
|
||||
"test:unit": "php bin/pest --colors=always --exclude-group=integration",
|
||||
"test:parallel": "php bin/pest -p --colors=always --exclude-group=integration",
|
||||
|
||||
@ -55,11 +55,6 @@ parameters:
|
||||
count: 1
|
||||
path: src/Console/Command.php
|
||||
|
||||
-
|
||||
message: "#^Argument of an invalid type mixed supplied for foreach, only iterables are supported\\.$#"
|
||||
count: 1
|
||||
path: src/Datasets.php
|
||||
|
||||
-
|
||||
message: "#^Method Pest\\\\Datasets\\:\\:getDataSetsCombinations\\(\\) has parameter \\$combinations with no value type specified in iterable type array\\.$#"
|
||||
count: 1
|
||||
@ -75,11 +70,6 @@ parameters:
|
||||
count: 1
|
||||
path: src/Datasets.php
|
||||
|
||||
-
|
||||
message: "#^Parameter \\#1 \\$key of static method Pest\\\\Datasets\\:\\:getDataSetDescription\\(\\) expects int\\|string, mixed given\\.$#"
|
||||
count: 1
|
||||
path: src/Datasets.php
|
||||
|
||||
-
|
||||
message: "#^Argument of an invalid type mixed supplied for foreach, only iterables are supported\\.$#"
|
||||
count: 1
|
||||
@ -90,11 +80,6 @@ parameters:
|
||||
count: 1
|
||||
path: src/Expectation.php
|
||||
|
||||
-
|
||||
message: "#^Parameter \\#1 \\$actualJson of static method PHPUnit\\\\Framework\\\\Assert\\:\\:assertJson\\(\\) expects string, mixed given\\.$#"
|
||||
count: 1
|
||||
path: src/Expectation.php
|
||||
|
||||
-
|
||||
message: "#^Parameter \\#1 \\$directory of static method PHPUnit\\\\Framework\\\\Assert\\:\\:assertDirectoryExists\\(\\) expects string, mixed given\\.$#"
|
||||
count: 1
|
||||
@ -250,16 +235,6 @@ parameters:
|
||||
count: 1
|
||||
path: src/Support/ExceptionTrace.php
|
||||
|
||||
-
|
||||
message: "#^Cannot access offset 'file' on mixed\\.$#"
|
||||
count: 1
|
||||
path: src/Support/ExceptionTrace.php
|
||||
|
||||
-
|
||||
message: "#^Parameter \\#1 \\$haystack of function mb_strpos expects string, mixed given\\.$#"
|
||||
count: 1
|
||||
path: src/Support/ExceptionTrace.php
|
||||
|
||||
-
|
||||
message: "#^Parameter \\#2 \\$array of function key_exists expects array, mixed given\\.$#"
|
||||
count: 1
|
||||
|
||||
@ -5,13 +5,12 @@ declare(strict_types=1);
|
||||
namespace Pest\Actions;
|
||||
|
||||
use Pest\Support\Str;
|
||||
|
||||
use function Pest\testDirectory;
|
||||
|
||||
use PHPUnit\Util\FileLoader;
|
||||
use RecursiveDirectoryIterator;
|
||||
use RecursiveIteratorIterator;
|
||||
|
||||
use function Pest\testDirectory;
|
||||
|
||||
/**
|
||||
* @internal
|
||||
*/
|
||||
|
||||
@ -11,6 +11,8 @@ use Pest\TestSuite;
|
||||
use PHPUnit\Framework\ExecutionOrderDependency;
|
||||
use Throwable;
|
||||
|
||||
use function sprintf;
|
||||
|
||||
/**
|
||||
* To avoid inheritance conflicts, all the fields related
|
||||
* to Pest only will be prefixed by double underscore.
|
||||
@ -257,7 +259,7 @@ trait Testable
|
||||
*/
|
||||
public function toString(): string
|
||||
{
|
||||
return \sprintf(
|
||||
return sprintf(
|
||||
'%s::%s',
|
||||
self::$__filename,
|
||||
$this->__description
|
||||
|
||||
@ -18,6 +18,8 @@ use PHPUnit\TextUI\TestRunner;
|
||||
use SebastianBergmann\FileIterator\Facade as FileIteratorFacade;
|
||||
use Symfony\Component\Console\Output\OutputInterface;
|
||||
|
||||
use function is_dir;
|
||||
|
||||
/**
|
||||
* @internal
|
||||
*/
|
||||
@ -81,7 +83,7 @@ final class Command extends BaseCommand
|
||||
$testSuite = $this->arguments['test'];
|
||||
|
||||
if (is_string($testSuite)) {
|
||||
if (\is_dir($testSuite)) {
|
||||
if (is_dir($testSuite)) {
|
||||
/** @var string[] $files */
|
||||
$files = (new FileIteratorFacade())->getFilesAsArray(
|
||||
$testSuite,
|
||||
|
||||
@ -5,6 +5,7 @@ declare(strict_types=1);
|
||||
namespace Pest;
|
||||
|
||||
use Closure;
|
||||
use Generator;
|
||||
use Pest\Exceptions\DatasetAlreadyExist;
|
||||
use Pest\Exceptions\DatasetDoesNotExist;
|
||||
use SebastianBergmann\Exporter\Exporter;
|
||||
@ -122,7 +123,10 @@ final class Datasets
|
||||
}
|
||||
|
||||
if ($datasets[$index] instanceof Traversable) {
|
||||
$datasets[$index] = iterator_to_array($datasets[$index]);
|
||||
$preserveKeysForArrayIterator = $datasets[$index] instanceof Generator
|
||||
&& is_string($datasets[$index]->key());
|
||||
|
||||
$datasets[$index] = iterator_to_array($datasets[$index], $preserveKeysForArrayIterator);
|
||||
}
|
||||
|
||||
foreach ($datasets[$index] as $key => $values) {
|
||||
|
||||
@ -216,7 +216,7 @@ final class TestCaseFactory
|
||||
eval("
|
||||
namespace $namespace;
|
||||
|
||||
#[AllowDynamicProperties]
|
||||
#[\AllowDynamicProperties]
|
||||
final class $className extends $baseClass implements $hasPrintableTestCaseClassFQN {
|
||||
$traitsCode
|
||||
|
||||
|
||||
@ -8,11 +8,10 @@ use Illuminate\Console\Command;
|
||||
use Illuminate\Support\Facades\File;
|
||||
use Illuminate\Support\Str;
|
||||
use Pest\Exceptions\InvalidConsoleArgument;
|
||||
use Pest\TestSuite;
|
||||
|
||||
use function Pest\testDirectory;
|
||||
|
||||
use Pest\TestSuite;
|
||||
|
||||
/**
|
||||
* @internal
|
||||
*/
|
||||
|
||||
@ -8,11 +8,10 @@ use Illuminate\Console\Command;
|
||||
use Illuminate\Support\Facades\File;
|
||||
use Pest\Console\Thanks;
|
||||
use Pest\Exceptions\InvalidConsoleArgument;
|
||||
use Pest\TestSuite;
|
||||
|
||||
use function Pest\testDirectory;
|
||||
|
||||
use Pest\TestSuite;
|
||||
|
||||
/**
|
||||
* @internal
|
||||
*/
|
||||
|
||||
@ -8,11 +8,10 @@ use Illuminate\Console\Command;
|
||||
use Illuminate\Support\Facades\File;
|
||||
use Pest\Exceptions\InvalidConsoleArgument;
|
||||
use Pest\Support\Str;
|
||||
use Pest\TestSuite;
|
||||
|
||||
use function Pest\testDirectory;
|
||||
|
||||
use Pest\TestSuite;
|
||||
|
||||
/**
|
||||
* @internal
|
||||
*/
|
||||
|
||||
@ -12,15 +12,9 @@ declare(strict_types=1);
|
||||
|
||||
namespace Pest\Logging;
|
||||
|
||||
use function class_exists;
|
||||
|
||||
use DOMDocument;
|
||||
use DOMElement;
|
||||
use Exception;
|
||||
|
||||
use function get_class;
|
||||
use function method_exists;
|
||||
|
||||
use Pest\Concerns\Testable;
|
||||
use PHPUnit\Framework\AssertionFailedError;
|
||||
use PHPUnit\Framework\ExceptionWrapper;
|
||||
@ -35,12 +29,13 @@ use PHPUnit\Util\Printer;
|
||||
use PHPUnit\Util\Xml;
|
||||
use ReflectionClass;
|
||||
use ReflectionException;
|
||||
|
||||
use function sprintf;
|
||||
use function str_replace;
|
||||
|
||||
use Throwable;
|
||||
|
||||
use function class_exists;
|
||||
use function get_class;
|
||||
use function method_exists;
|
||||
use function sprintf;
|
||||
use function str_replace;
|
||||
use function trim;
|
||||
|
||||
/**
|
||||
|
||||
@ -4,14 +4,9 @@ declare(strict_types=1);
|
||||
|
||||
namespace Pest\Logging;
|
||||
|
||||
use function getmypid;
|
||||
|
||||
use Pest\Concerns\Logging\WritesToConsole;
|
||||
use Pest\Concerns\Testable;
|
||||
use Pest\Support\ExceptionTrace;
|
||||
|
||||
use function Pest\version;
|
||||
|
||||
use PHPUnit\Framework\AssertionFailedError;
|
||||
use PHPUnit\Framework\Test;
|
||||
use PHPUnit\Framework\TestCase;
|
||||
@ -19,13 +14,14 @@ use PHPUnit\Framework\TestResult;
|
||||
use PHPUnit\Framework\TestSuite;
|
||||
use PHPUnit\Framework\Warning;
|
||||
use PHPUnit\TextUI\DefaultResultPrinter;
|
||||
use Throwable;
|
||||
|
||||
use function getmypid;
|
||||
use function Pest\version;
|
||||
use function round;
|
||||
use function str_replace;
|
||||
use function strlen;
|
||||
|
||||
use Throwable;
|
||||
|
||||
final class TeamCity extends DefaultResultPrinter
|
||||
{
|
||||
use WritesToConsole;
|
||||
@ -86,6 +82,7 @@ final class TeamCity extends DefaultResultPrinter
|
||||
foreach ($filteredResults as $key => $info) {
|
||||
$this->writeWithColor($info['color'], $info['count'] . " $key", false);
|
||||
|
||||
/* @phpstan-ignore-next-line */
|
||||
if ($key !== array_reverse(array_keys($filteredResults))[0]) {
|
||||
$this->write(', ');
|
||||
}
|
||||
@ -193,7 +190,7 @@ final class TeamCity extends DefaultResultPrinter
|
||||
}
|
||||
|
||||
$this->printEvent(self::TEST_STARTED, [
|
||||
self::NAME => $test->getName(),
|
||||
self::NAME => $test->getName(),
|
||||
// @phpstan-ignore-next-line
|
||||
self::LOCATION_HINT => self::PROTOCOL . $test->toString(),
|
||||
]);
|
||||
|
||||
@ -102,7 +102,7 @@ final class TestCall
|
||||
* Runs the current test multiple times with
|
||||
* each item of the given `iterable`.
|
||||
*
|
||||
* @param array<\Closure|iterable<int|string, mixed>|string> $data
|
||||
* @param array<Closure|iterable<int|string, mixed>|string> $data
|
||||
*/
|
||||
public function with(...$data): TestCall
|
||||
{
|
||||
|
||||
@ -6,7 +6,7 @@ namespace Pest;
|
||||
|
||||
function version(): string
|
||||
{
|
||||
return '1.22.0';
|
||||
return '1.23.1';
|
||||
}
|
||||
|
||||
function testDirectory(string $file = ''): string
|
||||
|
||||
@ -5,11 +5,10 @@ declare(strict_types=1);
|
||||
namespace Pest\Plugins;
|
||||
|
||||
use Pest\Contracts\Plugins\HandlesArguments;
|
||||
use Symfony\Component\Console\Output\OutputInterface;
|
||||
|
||||
use function Pest\version;
|
||||
|
||||
use Symfony\Component\Console\Output\OutputInterface;
|
||||
|
||||
/**
|
||||
* @internal
|
||||
*/
|
||||
|
||||
@ -8,6 +8,8 @@ use Closure;
|
||||
use ReflectionClass;
|
||||
use Throwable;
|
||||
|
||||
use const PHP_MAJOR_VERSION;
|
||||
|
||||
/**
|
||||
* @internal
|
||||
*/
|
||||
@ -132,7 +134,7 @@ final class HigherOrderMessage
|
||||
|
||||
private static function getUndefinedMethodMessage(object $target, string $methodName): string
|
||||
{
|
||||
if (\PHP_MAJOR_VERSION >= 8) {
|
||||
if (PHP_MAJOR_VERSION >= 8) {
|
||||
return sprintf(sprintf(self::UNDEFINED_METHOD, sprintf('%s::%s()', get_class($target), $methodName)));
|
||||
}
|
||||
|
||||
|
||||
@ -11,7 +11,10 @@
|
||||
|
|
||||
*/
|
||||
|
||||
uses(Tests\TestCase::class)->in('Feature');
|
||||
uses(
|
||||
Tests\TestCase::class,
|
||||
// Illuminate\Foundation\Testing\RefreshDatabase::class,
|
||||
)->in('Feature');
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
|
||||
@ -96,6 +96,13 @@
|
||||
✓ more than two datasets with (2) / (4) / (5)
|
||||
✓ more than two datasets with (2) / (4) / (6)
|
||||
✓ more than two datasets did the job right
|
||||
✓ eager registered wrapped datasets with Generator functions with (1)
|
||||
✓ eager registered wrapped datasets with Generator functions with (2)
|
||||
✓ eager registered wrapped datasets with Generator functions with (3)
|
||||
✓ eager registered wrapped datasets with Generator functions with (4)
|
||||
✓ eager registered wrapped datasets with Generator functions did the job right
|
||||
✓ eager registered wrapped datasets with Generator functions display description with data set "taylor"
|
||||
✓ eager registered wrapped datasets with Generator functions display description with data set "james"
|
||||
✓ it can resolve a dataset after the test case is available with (Closure Object (...))
|
||||
✓ it can resolve a dataset after the test case is available with shared yield sets with (Closure Object (...)) #1
|
||||
✓ it can resolve a dataset after the test case is available with shared yield sets with (Closure Object (...)) #2
|
||||
@ -722,5 +729,5 @@
|
||||
✓ it is a test
|
||||
✓ it uses correct parent class
|
||||
|
||||
Tests: 4 incompleted, 9 skipped, 480 passed
|
||||
Tests: 4 incompleted, 9 skipped, 487 passed
|
||||
|
||||
@ -13,3 +13,20 @@ dataset('numbers.closure.wrapped', function () {
|
||||
dataset('numbers.array', [[1], [2]]);
|
||||
|
||||
dataset('numbers.array.wrapped', [1, 2]);
|
||||
|
||||
dataset('numbers.generators.wrapped', function () {
|
||||
yield from firstSetOfNumber();
|
||||
yield from secondSetOfNumbers();
|
||||
});
|
||||
|
||||
function firstSetOfNumber(): Generator
|
||||
{
|
||||
yield 1;
|
||||
yield 2;
|
||||
}
|
||||
|
||||
function secondSetOfNumbers(): Generator
|
||||
{
|
||||
yield 3;
|
||||
yield 4;
|
||||
}
|
||||
|
||||
@ -228,10 +228,38 @@ test('more than two datasets did the job right', function () use ($state) {
|
||||
expect($state->text)->toBe('121212121212131423241314232411122122111221221112212213142324135136145146235236245246');
|
||||
});
|
||||
|
||||
$wrapped_generator_state = new stdClass();
|
||||
$wrapped_generator_state->text = '';
|
||||
$wrapped_generator_function_datasets = [1, 2, 3, 4];
|
||||
|
||||
test(
|
||||
'eager registered wrapped datasets with Generator functions',
|
||||
function (int $text) use (
|
||||
$wrapped_generator_state,
|
||||
$wrapped_generator_function_datasets
|
||||
) {
|
||||
$wrapped_generator_state->text .= $text;
|
||||
expect(in_array($text, $wrapped_generator_function_datasets))->toBe(true);
|
||||
}
|
||||
)->with('numbers.generators.wrapped');
|
||||
|
||||
test('eager registered wrapped datasets with Generator functions did the job right', function () use ($wrapped_generator_state) {
|
||||
expect($wrapped_generator_state->text)->toBe('1234');
|
||||
});
|
||||
|
||||
test('eager registered wrapped datasets with Generator functions display description', function ($wrapped_generator_state_with_description) {
|
||||
expect($wrapped_generator_state_with_description)->not->toBeEmpty();
|
||||
})->with(function () {
|
||||
yield 'taylor' => 'taylor@laravel.com';
|
||||
yield 'james' => 'james@laravel.com';
|
||||
});
|
||||
|
||||
it('can resolve a dataset after the test case is available', function ($result) {
|
||||
expect($result)->toBe('bar');
|
||||
})->with([
|
||||
function () { return $this->foo; },
|
||||
function () {
|
||||
return $this->foo;
|
||||
},
|
||||
]);
|
||||
|
||||
it('can resolve a dataset after the test case is available with shared yield sets', function ($result) {
|
||||
|
||||
@ -47,7 +47,7 @@ it('runs with truthy', function () {
|
||||
|
||||
return $value->toEqual('bar');
|
||||
},
|
||||
true => function ($value) {
|
||||
true => function ($value) {
|
||||
$this->matched = 'foo';
|
||||
|
||||
return $value->toEqual('foo');
|
||||
@ -88,7 +88,7 @@ it('runs with truthy closure condition', function () {
|
||||
|
||||
return $value->toEqual('bar');
|
||||
},
|
||||
true => function ($value) {
|
||||
true => function ($value) {
|
||||
$this->matched = 'foo';
|
||||
|
||||
return $value->toEqual('foo');
|
||||
@ -141,7 +141,7 @@ it('can be used in higher order tests')
|
||||
false => function ($value) {
|
||||
return $value->toBeFalse();
|
||||
},
|
||||
true => function ($value) {
|
||||
true => function ($value) {
|
||||
return $value->toBeTrue();
|
||||
},
|
||||
]
|
||||
|
||||
@ -4,10 +4,10 @@ declare(strict_types=1);
|
||||
|
||||
namespace Tests\CustomTestCase;
|
||||
|
||||
use function PHPUnit\Framework\assertTrue;
|
||||
|
||||
use PHPUnit\Framework\TestCase;
|
||||
|
||||
use function PHPUnit\Framework\assertTrue;
|
||||
|
||||
class CustomTestCase extends TestCase
|
||||
{
|
||||
public function assertCustomTrue()
|
||||
|
||||
@ -4,10 +4,10 @@ declare(strict_types=1);
|
||||
|
||||
namespace Tests\CustomTestCase;
|
||||
|
||||
use function PHPUnit\Framework\assertTrue;
|
||||
|
||||
use PHPUnit\Framework\TestCase;
|
||||
|
||||
use function PHPUnit\Framework\assertTrue;
|
||||
|
||||
class ExecutedTest extends TestCase
|
||||
{
|
||||
public static $executed = false;
|
||||
|
||||
@ -1,11 +1,10 @@
|
||||
<?php
|
||||
|
||||
use Pest\Plugins\Version;
|
||||
use Symfony\Component\Console\Output\BufferedOutput;
|
||||
|
||||
use function Pest\version;
|
||||
|
||||
use Symfony\Component\Console\Output\BufferedOutput;
|
||||
|
||||
it('outputs the version when --version is used', function () {
|
||||
$output = new BufferedOutput();
|
||||
$plugin = new Version($output);
|
||||
|
||||
Reference in New Issue
Block a user