Skip to content
This repository was archived by the owner on Oct 1, 2021. It is now read-only.

Commit d595d29

Browse files
authored
Merge pull request #41 from owenvoke/feature/pest-removal
chore: remove Pest dependency
2 parents 455df70 + bad0690 commit d595d29

File tree

3 files changed

+33
-3
lines changed

3 files changed

+33
-3
lines changed

composer.json

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,7 @@
55
"license": "MIT",
66
"require": {
77
"php": "^7.4",
8-
"rector/rector": "^0.8.6",
9-
"pestphp/pest": "^0.3"
8+
"rector/rector": "^0.8.6"
109
},
1110
"authors": [
1211
{

src/Exceptions/ShouldNotHappen.php

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
<?php
2+
3+
declare(strict_types=1);
4+
5+
namespace Pest\Drift\Exceptions;
6+
7+
use Exception;
8+
use RuntimeException;
9+
use Throwable;
10+
11+
/** @internal */
12+
final class ShouldNotHappen extends RuntimeException
13+
{
14+
public function __construct(Throwable $exception)
15+
{
16+
$message = $exception->getMessage();
17+
18+
parent::__construct(sprintf(<<<EOF
19+
This should not happen - please create an new issue here: https://github.com/pestphp/drift.
20+
- Issue: %s
21+
- PHP version: %s
22+
- Operating system: %s
23+
EOF
24+
, $message, PHP_VERSION, PHP_OS), 1, $exception);
25+
}
26+
27+
public static function fromMessage(string $message): self
28+
{
29+
return new self(new Exception($message));
30+
}
31+
}

src/PHPUnit/Class_/CustomTestCaseToUsesRector.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,8 @@
44

55
namespace Pest\Drift\PHPUnit\Class_;
66

7+
use Pest\Drift\Exceptions\ShouldNotHappen;
78
use Pest\Drift\PHPUnit\AbstractPHPUnitToPestRector;
8-
use Pest\Exceptions\ShouldNotHappen;
99
use PhpParser\Node;
1010
use PhpParser\Node\Name;
1111
use PhpParser\Node\Stmt\Class_;

0 commit comments

Comments
 (0)