mirror of
https://github.com/pestphp/pest.git
synced 2026-03-06 07:47:22 +01:00
feat: adds not->toHavePrivateMethods and related
This commit is contained in:
@ -20,7 +20,7 @@ final class Relaxed extends AbstractPreset
|
||||
$this->eachUserNamespace(
|
||||
fn (Expectation $namespace): ArchExpectation => $namespace->not->toUseStrictTypes(),
|
||||
fn (Expectation $namespace): ArchExpectation => $namespace->classes()->not->toBeFinal(),
|
||||
fn (Expectation $namespace): ArchExpectation => $namespace->classes()->not->toHavePrivateMethodsBesides([]),
|
||||
fn (Expectation $namespace): ArchExpectation => $namespace->classes()->not->toHavePrivateMethods(),
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
@ -18,7 +18,7 @@ final class Strict extends AbstractPreset
|
||||
public function execute(): void
|
||||
{
|
||||
$this->eachUserNamespace(
|
||||
fn (Expectation $namespace): ArchExpectation => $namespace->classes()->not->toHaveProtectedMethodsBesides([]),
|
||||
fn (Expectation $namespace): ArchExpectation => $namespace->classes()->not->toHaveProtectedMethods(),
|
||||
fn (Expectation $namespace): ArchExpectation => $namespace->classes()->not->toBeAbstract(),
|
||||
fn (Expectation $namespace): ArchExpectation => $namespace->toUseStrictTypes(),
|
||||
fn (Expectation $namespace): ArchExpectation => $namespace->classes()->toBeFinal(),
|
||||
|
||||
@ -610,6 +610,14 @@ final class Expectation
|
||||
throw InvalidExpectation::fromMethods(['toHavePublicMethodsBesides']);
|
||||
}
|
||||
|
||||
/**
|
||||
* Not supported.
|
||||
*/
|
||||
public function toHavePublicMethods(): void
|
||||
{
|
||||
throw InvalidExpectation::fromMethods(['toHavePublicMethods']);
|
||||
}
|
||||
|
||||
/**
|
||||
* Not supported.
|
||||
*/
|
||||
@ -618,6 +626,14 @@ final class Expectation
|
||||
throw InvalidExpectation::fromMethods(['toHaveProtectedMethodsBesides']);
|
||||
}
|
||||
|
||||
/**
|
||||
* Not supported.
|
||||
*/
|
||||
public function toHaveProtectedMethods(): void
|
||||
{
|
||||
throw InvalidExpectation::fromMethods(['toHaveProtectedMethods']);
|
||||
}
|
||||
|
||||
/**
|
||||
* Not supported.
|
||||
*/
|
||||
@ -626,6 +642,14 @@ final class Expectation
|
||||
throw InvalidExpectation::fromMethods(['toHavePrivateMethodsBesides']);
|
||||
}
|
||||
|
||||
/**
|
||||
* Not supported.
|
||||
*/
|
||||
public function toHavePrivateMethods(): void
|
||||
{
|
||||
throw InvalidExpectation::fromMethods(['toHavePrivateMethods']);
|
||||
}
|
||||
|
||||
/**
|
||||
* Asserts that the given expectation target is enum.
|
||||
*/
|
||||
|
||||
@ -277,6 +277,14 @@ final readonly class OppositeExpectation
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Asserts that the given expectation target not to have the public methods.
|
||||
*/
|
||||
public function toHavePublicMethods(): ArchExpectation
|
||||
{
|
||||
return $this->toHavePublicMethodsBesides([]);
|
||||
}
|
||||
|
||||
/**
|
||||
* Asserts that the given expectation target not to have the protected methods besides the given methods.
|
||||
*
|
||||
@ -312,6 +320,14 @@ final readonly class OppositeExpectation
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Asserts that the given expectation target not to have the protected methods.
|
||||
*/
|
||||
public function toHaveProtectedMethods(): ArchExpectation
|
||||
{
|
||||
return $this->toHaveProtectedMethodsBesides([]);
|
||||
}
|
||||
|
||||
/**
|
||||
* Asserts that the given expectation target not to have the private methods besides the given methods.
|
||||
*
|
||||
@ -347,6 +363,14 @@ final readonly class OppositeExpectation
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Asserts that the given expectation target not to have the private methods.
|
||||
*/
|
||||
public function toHavePrivateMethods(): ArchExpectation
|
||||
{
|
||||
return $this->toHavePrivateMethodsBesides([]);
|
||||
}
|
||||
|
||||
/**
|
||||
* Asserts that the given expectation target is not enum.
|
||||
*/
|
||||
|
||||
@ -8,5 +8,5 @@ test('pass', function () {
|
||||
});
|
||||
|
||||
test('failures', function () {
|
||||
expect(UserController::class)->not->toHavePrivateMethodsBesides([]);
|
||||
expect(UserController::class)->not->toHavePrivateMethods();
|
||||
})->throws(ArchExpectationFailedException::class);
|
||||
|
||||
@ -8,5 +8,5 @@ test('pass', function () {
|
||||
});
|
||||
|
||||
test('failures', function () {
|
||||
expect(UserController::class)->not->toHaveProtectedMethodsBesides([]);
|
||||
expect(UserController::class)->not->toHaveProtectedMethods();
|
||||
})->throws(ArchExpectationFailedException::class);
|
||||
|
||||
@ -8,5 +8,5 @@ test('pass', function () {
|
||||
});
|
||||
|
||||
test('failures', function () {
|
||||
expect(UserController::class)->not->toHavePublicMethodsBesides([]);
|
||||
expect(UserController::class)->not->toHavePublicMethods();
|
||||
})->throws(ArchExpectationFailedException::class);
|
||||
|
||||
Reference in New Issue
Block a user