mirror of
https://github.com/pestphp/pest.git
synced 2026-03-06 07:47:22 +01:00
feat: adjusts only for browser debug
This commit is contained in:
@ -5,7 +5,10 @@ declare(strict_types=1);
|
|||||||
namespace Pest\Plugins;
|
namespace Pest\Plugins;
|
||||||
|
|
||||||
use Pest\Contracts\Plugins\Terminable;
|
use Pest\Contracts\Plugins\Terminable;
|
||||||
|
use Pest\Factories\Attribute;
|
||||||
|
use Pest\Factories\TestCaseMethodFactory;
|
||||||
use Pest\PendingCalls\TestCall;
|
use Pest\PendingCalls\TestCall;
|
||||||
|
use PHPUnit\Framework\Attributes\Group;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @internal
|
* @internal
|
||||||
@ -23,28 +26,19 @@ final class Only implements Terminable
|
|||||||
.DIRECTORY_SEPARATOR
|
.DIRECTORY_SEPARATOR
|
||||||
.'.temp';
|
.'.temp';
|
||||||
|
|
||||||
/**
|
|
||||||
* {@inheritDoc}
|
|
||||||
*/
|
|
||||||
public function terminate(): void
|
|
||||||
{
|
|
||||||
if (Parallel::isWorker()) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
$lockFile = self::TEMPORARY_FOLDER.DIRECTORY_SEPARATOR.'only.lock';
|
|
||||||
|
|
||||||
if (file_exists($lockFile)) {
|
|
||||||
unlink($lockFile);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Creates the lock file.
|
* Creates the lock file.
|
||||||
*/
|
*/
|
||||||
public static function enable(TestCall $testCall, string $group = '__pest_only'): void
|
public static function enable(TestCall|TestCaseMethodFactory $testCall, string $group = '__pest_only'): void
|
||||||
{
|
{
|
||||||
|
if ($testCall instanceof TestCall) {
|
||||||
$testCall->group($group);
|
$testCall->group($group);
|
||||||
|
} else {
|
||||||
|
$testCall->attributes[] = new Attribute(
|
||||||
|
Group::class,
|
||||||
|
[$group],
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
if (Environment::name() === Environment::CI || Parallel::isWorker()) {
|
if (Environment::name() === Environment::CI || Parallel::isWorker()) {
|
||||||
return;
|
return;
|
||||||
@ -88,4 +82,20 @@ final class Only implements Terminable
|
|||||||
|
|
||||||
return file_get_contents($lockFile) ?: '__pest_only'; // @phpstan-ignore-line
|
return file_get_contents($lockFile) ?: '__pest_only'; // @phpstan-ignore-line
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* {@inheritDoc}
|
||||||
|
*/
|
||||||
|
public function terminate(): void
|
||||||
|
{
|
||||||
|
if (Parallel::isWorker()) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
$lockFile = self::TEMPORARY_FOLDER.DIRECTORY_SEPARATOR.'only.lock';
|
||||||
|
|
||||||
|
if (file_exists($lockFile)) {
|
||||||
|
unlink($lockFile);
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user