Compare commits

...

3 Commits

Author SHA1 Message Date
48a1de273f release: v3.2.1 2024-09-23 14:09:55 +01:00
970e16e949 Ignores 2024-09-23 14:08:30 +01:00
432ff221c6 fix: missing != and !== on new toUseStrictEquality arch expectation 2024-09-23 14:08:21 +01:00
9 changed files with 19 additions and 11 deletions

View File

@ -264,7 +264,7 @@ final class Expectation
$matched = false;
foreach ($expressions as $key => $callback) {
if ($subject != $key) {
if ($subject != $key) { // @pest-arch-ignore-line
continue;
}
@ -380,7 +380,7 @@ final class Expectation
if (self::hasExtend($name)) {
$extend = self::$extends[$name]->bindTo($this, Expectation::class);
if ($extend != false) {
if ($extend != false) { // @pest-arch-ignore-line
return $extend;
}
}
@ -522,9 +522,9 @@ final class Expectation
{
return Targeted::make(
$this,
fn (ObjectDescription $object): bool => ! str_contains((string) file_get_contents($object->path), ' == '), // @pest-arch-ignore-line
fn (ObjectDescription $object): bool => ! str_contains((string) file_get_contents($object->path), ' == ') && ! str_contains((string) file_get_contents($object->path), ' != '),
'to use strict equality',
FileLineFinder::where(fn (string $line): bool => str_contains($line, ' == ')),
FileLineFinder::where(fn (string $line): bool => str_contains($line, ' == ') || str_contains($line, ' != ')),
);
}

View File

@ -159,9 +159,9 @@ final readonly class OppositeExpectation
{
return Targeted::make(
$this->original,
fn (ObjectDescription $object): bool => ! str_contains((string) file_get_contents($object->path), ' === '),
fn (ObjectDescription $object): bool => ! str_contains((string) file_get_contents($object->path), ' === ') && ! str_contains((string) file_get_contents($object->path), ' !== '),
'to use strict equality',
FileLineFinder::where(fn (string $line): bool => str_contains($line, ' === ')),
FileLineFinder::where(fn (string $line): bool => str_contains($line, ' === ') || str_contains($line, ' !== ')),
);
}

View File

@ -150,7 +150,7 @@ final readonly class Converter
{
if ($testSuite instanceof TestSuiteForTestMethodWithDataProvider) {
$firstTest = $this->getFirstTest($testSuite);
if ($firstTest != null) {
if ($firstTest instanceof \PHPUnit\Event\Code\TestMethod) {
return $this->getTestMethodNameWithoutDatasetSuffix($firstTest);
}
}

View File

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

View File

@ -26,7 +26,7 @@ final class Closure
$closure = BaseClosure::bind($closure, $newThis, $newScope);
if ($closure === null) {
if (! $closure instanceof \Closure) {
throw ShouldNotHappen::fromMessage('Could not bind closure.');
}

View File

@ -1,5 +1,5 @@
Pest Testing Framework 3.2.0.
Pest Testing Framework 3.2.1.
USAGE: pest <file> [options]

View File

@ -1,3 +1,3 @@
Pest Testing Framework 3.2.0.
Pest Testing Framework 3.2.1.

View File

@ -14,5 +14,9 @@ class NotStrictEquality
if ($a == $b) {
echo 'Equal';
}
if ($a != $b) {
echo 'Equal';
}
}
}

View File

@ -14,5 +14,9 @@ class StrictEquality
if ($a === $b) {
echo 'Equal';
}
if ($a !== $b) {
echo 'Equal';
}
}
}