Compare commits

...

17 Commits

Author SHA1 Message Date
7796630eaf chore: only runs CI against stable 2026-01-28 01:33:45 +00:00
3aec2b26ef chore: runs only unit tests 2026-01-28 01:30:45 +00:00
7a7c35292c release: 3.8.5 2026-01-28 01:23:37 +00:00
72cf695554 release: 3.8.4 2025-08-20 20:12:42 +01:00
027f4e4832 chore: bumps dependencies 2025-08-20 14:21:14 +01:00
165c879fe6 release: 3.8.3 2025-08-19 11:11:21 +01:00
4c8bf4b2fd chore: uses phpunit v11.5.33 2025-08-19 11:11:10 +01:00
1b0a846a81 Update README.md 2025-08-15 17:11:53 +01:00
f692be3637 chore: bumps dependencies 2025-07-26 07:34:25 -06:00
127ad618d3 chore: style 2025-07-26 07:34:19 -06:00
55218bcf78 Merge pull request #1324 from bibrokhim/add-attributes-to-laravel-preset
Add Attributes to Laravel preset
2025-07-26 04:19:54 +01:00
2a47b514ec Merge pull request #1351 from cndrsdrmn/patch-1
fix: add ignoring clause for `App\Features\Concerns` on Laravel Preset
2025-07-26 04:17:21 +01:00
7d77bbf1bb Merge pull request #1410 from JonPurvis/remove-period
Remove Period from `ShouldNotHappen` message
2025-06-23 19:29:01 +01:00
97c136cd94 link to issues page 2025-06-16 02:55:11 +01:00
d6cbd12d8b remove period from message 2025-06-16 02:51:48 +01:00
a5317c5640 fix: add ignoring clause for App\Features\Concerns on Laravel Preset 2025-02-08 00:07:21 +07:00
1ac594bdf0 Add Attributes to Laravel preset 2024-12-06 16:07:59 +05:00
15 changed files with 49 additions and 92 deletions

View File

@ -1,44 +0,0 @@
name: Static Analysis
on:
push:
pull_request:
schedule:
- cron: '0 0 * * *'
jobs:
static:
if: github.event_name != 'schedule' || github.repository == 'pestphp/pest'
name: Static Tests
runs-on: ubuntu-latest
strategy:
fail-fast: true
matrix:
dependency-version: [prefer-lowest, prefer-stable]
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Setup PHP
uses: shivammathur/setup-php@v2
with:
php-version: 8.2
tools: composer:v2
coverage: none
- name: Install Dependencies
run: composer update --prefer-stable --no-interaction --no-progress --ansi
# - name: Type Check
# run: composer test:type:check
- name: Type Coverage
run: composer test:type:coverage
- name: Refacto
run: composer test:refacto
- name: Style
run: composer test:lint

View File

@ -15,7 +15,7 @@ jobs:
os: [ubuntu-latest, macos-latest, windows-latest]
symfony: ['7.1']
php: ['8.2', '8.3', '8.4']
dependency_version: [prefer-lowest, prefer-stable]
dependency_version: [prefer-stable]
name: PHP ${{ matrix.php }} - Symfony ^${{ matrix.symfony }} - ${{ matrix.os }} - ${{ matrix.dependency_version }}

View File

@ -34,9 +34,9 @@ We cannot thank our sponsors enough for their incredible support in funding Pest
### Gold Sponsors
- **[Brokerchooser](https://brokerchooser.com/?ref=pestphp)**
- **[CodeRabbit](https://coderabbit.ai/?ref=pestphp)**
- **[NativePHP](https://nativephp.com/mobile?ref=pestphp.com)**
- **[CMS Max](https://cmsmax.com/?ref=pestphp)**
### Premium Sponsors

View File

@ -18,17 +18,17 @@
],
"require": {
"php": "^8.2.0",
"brianium/paratest": "^7.8.3",
"nunomaduro/collision": "^8.8.0",
"nunomaduro/termwind": "^2.3.0",
"brianium/paratest": "^7.8.5",
"nunomaduro/collision": "^8.8.3",
"nunomaduro/termwind": "^2.3.3",
"pestphp/pest-plugin": "^3.0.0",
"pestphp/pest-plugin-arch": "^3.1.0",
"pestphp/pest-plugin-arch": "^3.1.1",
"pestphp/pest-plugin-mutate": "^3.0.5",
"phpunit/phpunit": "^11.5.15"
"phpunit/phpunit": "^11.5.50"
},
"conflict": {
"filp/whoops": "<2.16.0",
"phpunit/phpunit": ">11.5.15",
"phpunit/phpunit": ">11.5.50",
"sebastian/exporter": "<6.0.0",
"webmozart/assert": "<1.11.0"
},
@ -54,8 +54,8 @@
},
"require-dev": {
"pestphp/pest-dev-tools": "^3.4.0",
"pestphp/pest-plugin-type-coverage": "^3.5.0",
"symfony/process": "^7.2.5"
"pestphp/pest-plugin-type-coverage": "^3.6.1",
"symfony/process": "^7.4.4"
},
"minimum-stability": "dev",
"prefer-stable": true,
@ -71,21 +71,12 @@
],
"scripts": {
"refacto": "rector",
"lint": "pint",
"test:refacto": "rector --dry-run",
"test:lint": "pint --test",
"test:type:check": "phpstan analyse --ansi --memory-limit=-1 --debug",
"test:type:coverage": "php -d memory_limit=-1 bin/pest --type-coverage --min=100",
"test:unit": "php bin/pest --colors=always --exclude-group=integration --compact",
"test:inline": "php bin/pest --colors=always --configuration=phpunit.inline.xml",
"test:parallel": "php bin/pest --colors=always --exclude-group=integration --parallel --processes=3",
"test:integration": "php bin/pest --colors=always --group=integration -v",
"update:snapshots": "REBUILD_SNAPSHOTS=true php bin/pest --colors=always --update-snapshots",
"test": [
"@test:refacto",
"@test:lint",
"@test:type:check",
"@test:type:coverage",
"@test:unit",
"@test:parallel",
"@test:integration"

View File

@ -49,7 +49,7 @@ use const DIRECTORY_SEPARATOR;
use const LOCK_EX;
use PHPUnit\Framework\TestStatus\TestStatus;
use PHPUnit\Runner\DirectoryCannotBeCreatedException;
use PHPUnit\Runner\DirectoryDoesNotExistException;
use PHPUnit\Runner\Exception;
use PHPUnit\Util\Filesystem;
@ -98,28 +98,28 @@ final class DefaultResultCache implements ResultCache
$this->cacheFilename = $filepath ?? $_ENV['PHPUNIT_RESULT_CACHE'] ?? self::DEFAULT_RESULT_CACHE_FILENAME;
}
public function setStatus(string $id, TestStatus $status): void
public function setStatus(ResultCacheId $id, TestStatus $status): void
{
if ($status->isSuccess()) {
return;
}
$this->defects[$id] = $status;
$this->defects[$id->asString()] = $status;
}
public function status(string $id): TestStatus
public function status(ResultCacheId $id): TestStatus
{
return $this->defects[$id] ?? TestStatus::unknown();
return $this->defects[$id->asString()] ?? TestStatus::unknown();
}
public function setTime(string $id, float $time): void
public function setTime(ResultCacheId $id, float $time): void
{
$this->times[$id] = $time;
$this->times[$id->asString()] = $time;
}
public function time(string $id): float
public function time(ResultCacheId $id): float
{
return $this->times[$id] ?? 0.0;
return $this->times[$id->asString()] ?? 0.0;
}
public function mergeWith(self $other): void
@ -179,7 +179,7 @@ final class DefaultResultCache implements ResultCache
public function persist(): void
{
if (! Filesystem::createDirectory(dirname($this->cacheFilename))) {
throw new DirectoryCannotBeCreatedException($this->cacheFilename);
throw new DirectoryDoesNotExistException(dirname($this->cacheFilename));
}
$data = [

View File

@ -35,7 +35,8 @@ final class Laravel extends AbstractPreset
->ignoring('App\Features\Concerns');
$this->expectations[] = expect('App\Features')
->toHaveMethod('resolve');
->toHaveMethod('resolve')
->ignoring('App\Features\Concerns');
$this->expectations[] = expect('App\Exceptions')
->classes()
@ -166,5 +167,11 @@ final class Laravel extends AbstractPreset
$this->expectations[] = expect('App\Policies')
->classes()
->toHaveSuffix('Policy');
$this->expectations[] = expect('App\Attributes')
->classes()
->toImplement('Illuminate\Contracts\Container\ContextualAttribute')
->toHaveAttribute('Attribute')
->toHaveMethod('resolve');
}
}

View File

@ -20,7 +20,7 @@ final class ShouldNotHappen extends RuntimeException
$message = $exception->getMessage();
parent::__construct(sprintf(<<<'EOF'
This should not happen - please create an new issue here: https://github.com/pestphp/pest.
This should not happen - please create an new issue here: https://github.com/pestphp/pest/issues
Issue: %s
PHP version: %s

View File

@ -232,7 +232,6 @@ final class TeamCityLogger
$reflector = new ReflectionClass($telemetry);
$property = $reflector->getProperty('current');
$property->setAccessible(true);
$snapshot = $property->getValue($telemetry);
assert($snapshot instanceof Snapshot);

View File

@ -6,7 +6,7 @@ namespace Pest;
function version(): string
{
return '3.8.2';
return '3.8.5';
}
function testDirectory(string $file = ''): string

View File

@ -19,8 +19,8 @@ final class SnapshotRepository
* Creates a snapshot repository instance.
*/
public function __construct(
readonly private string $testsPath,
readonly private string $snapshotsPath,
private readonly string $testsPath,
private readonly string $snapshotsPath,
) {}
/**

View File

@ -40,7 +40,7 @@ final class Result
*/
public static function exitCode(Configuration $configuration, TestResult $result): int
{
if ($result->wasSuccessfulIgnoringPhpunitWarnings()) {
if ($result->wasSuccessful()) {
if ($configuration->failOnWarning()) {
$warnings = $result->numberOfTestsWithTestTriggeredPhpunitWarningEvents()
+ count($result->warnings())
@ -60,7 +60,7 @@ final class Result
return self::FAILURE_EXIT;
}
if ($result->wasSuccessfulIgnoringPhpunitWarnings()) {
if ($result->wasSuccessful()) {
if ($configuration->failOnRisky() && $result->hasTestConsideredRiskyEvents()) {
$returnCode = self::FAILURE_EXIT;
}

View File

@ -23,14 +23,12 @@ final class EnsureIgnorableTestCasesAreIgnored implements StartedSubscriber
{
$reflection = new ReflectionClass(Facade::class);
$property = $reflection->getProperty('collector');
$property->setAccessible(true);
$collector = $property->getValue();
assert($collector instanceof Collector);
$reflection = new ReflectionClass($collector);
$property = $reflection->getProperty('testRunnerTriggeredWarningEvents');
$property->setAccessible(true);
/** @var array<int, WarningTriggered> $testRunnerTriggeredWarningEvents */
$testRunnerTriggeredWarningEvents = $property->getValue($collector);

View File

@ -34,8 +34,6 @@ final class Reflection
try {
$reflectionMethod = $reflectionClass->getMethod($method);
$reflectionMethod->setAccessible(true);
return $reflectionMethod->invoke($object, ...$args);
} catch (ReflectionException $exception) {
if (method_exists($object, '__call')) {
@ -113,8 +111,6 @@ final class Reflection
}
}
$reflectionProperty->setAccessible(true);
return $reflectionProperty->getValue($object);
}
@ -144,8 +140,6 @@ final class Reflection
}
}
}
$reflectionProperty->setAccessible(true);
$reflectionProperty->setValue($object, $value);
}

View File

@ -1,5 +1,5 @@
Pest Testing Framework 3.8.2.
Pest Testing Framework 3.8.5.
USAGE: pest <file> [options]
@ -53,7 +53,7 @@
--disallow-test-output ................. Be strict about output during tests
--enforce-time-limit ................. Enforce time limit based on test size
--default-time-limit [sec] Timeout in seconds for tests that have no declared size
--dont-report-useless-tests .. Do not report tests that do not test anything
--do-not-report-useless-tests Do not report tests that do not test anything
--stop-on-defect ... Stop after first error, failure, warning, or risky test
--stop-on-error ..................................... Stop after first error
--stop-on-failure ................................. Stop after first failure
@ -68,9 +68,20 @@
--fail-on-risky Signal failure using shell exit code when a test was considered risky
--fail-on-deprecation Signal failure using shell exit code when a deprecation was triggered
--fail-on-phpunit-deprecation Signal failure using shell exit code when a PHPUnit deprecation was triggered
--fail-on-phpunit-warning Signal failure using shell exit code when a PHPUnit warning was triggered
--fail-on-notice Signal failure using shell exit code when a notice was triggered
--fail-on-skipped Signal failure using shell exit code when a test was skipped
--fail-on-incomplete Signal failure using shell exit code when a test was marked incomplete
--fail-on-all-issues Signal failure using shell exit code when an issue is triggered
--do-not-fail-on-empty-test-suite Do not signal failure using shell exit code when no tests were run
--do-not-fail-on-warning Do not signal failure using shell exit code when a warning was triggered
--do-not-fail-on-risky Do not signal failure using shell exit code when a test was considered risky
--do-not-fail-on-deprecation Do not signal failure using shell exit code when a deprecation was triggered
--do-not-fail-on-phpunit-deprecation Do not signal failure using shell exit code when a PHPUnit deprecation was triggered
--do-not-fail-on-phpunit-warning Do not signal failure using shell exit code when a PHPUnit warning was triggered
--do-not-fail-on-notice Do not signal failure using shell exit code when a notice was triggered
--do-not-fail-on-skipped Do not signal failure using shell exit code when a test was skipped
--do-not-fail-on-incomplete Do not signal failure using shell exit code when a test was marked incomplete
--cache-result ............................ Write test results to cache file
--do-not-cache-result .............. Do not write test results to cache file
--order-by [order] Run tests in order: default|defects|depends|duration|no-depends|random|reverse|size
@ -91,6 +102,7 @@
--display-errors ............. Display details for errors triggered by tests
--display-notices ........... Display details for notices triggered by tests
--display-warnings ......... Display details for warnings triggered by tests
--display-all-issues ..... Display details for all issues that are triggered
--reverse-list .............................. Print defects in reverse order
--teamcity . Replace default progress and result output with TeamCity format
--testdox ................ Replace default result output with TestDox format

View File

@ -1,3 +1,3 @@
Pest Testing Framework 3.8.2.
Pest Testing Framework 3.8.5.