mirror of
https://github.com/pestphp/pest.git
synced 2026-03-06 07:47:22 +01:00
fixes and styles
This commit is contained in:
@ -37,7 +37,9 @@ final class Laravel extends AbstractPreset
|
|||||||
|
|
||||||
$this->expectations[] = expect('App\Http\Controllers')
|
$this->expectations[] = expect('App\Http\Controllers')
|
||||||
->classes()
|
->classes()
|
||||||
->toHaveSuffix('Controller')
|
->toHaveSuffix('Controller');
|
||||||
|
|
||||||
|
$this->expectations[] = expect('App\Http\Controllers')
|
||||||
->not->toHavePublicMethodsBesides(['__construct', '__invoke', 'index', 'show', 'create', 'store', 'edit', 'update', 'destroy']);
|
->not->toHavePublicMethodsBesides(['__construct', '__invoke', 'index', 'show', 'create', 'store', 'edit', 'update', 'destroy']);
|
||||||
|
|
||||||
$this->expectations[] = expect('App\Http\Middleware')
|
$this->expectations[] = expect('App\Http\Middleware')
|
||||||
|
|||||||
@ -226,6 +226,8 @@ final class OppositeExpectation
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Asserts that the given expectation target not to have the public methods besides the given methods.
|
* Asserts that the given expectation target not to have the public methods besides the given methods.
|
||||||
|
*
|
||||||
|
* @param array<int, string>|string $methods
|
||||||
*/
|
*/
|
||||||
public function toHavePublicMethodsBesides(array|string $methods): ArchExpectation
|
public function toHavePublicMethodsBesides(array|string $methods): ArchExpectation
|
||||||
{
|
{
|
||||||
@ -246,7 +248,7 @@ final class OppositeExpectation
|
|||||||
|
|
||||||
return true;
|
return true;
|
||||||
},
|
},
|
||||||
count($methods) === 0
|
$methods === []
|
||||||
? 'not to have public methods'
|
? 'not to have public methods'
|
||||||
: sprintf("not to have public methods besides '%s'", implode("', '", $methods)),
|
: sprintf("not to have public methods besides '%s'", implode("', '", $methods)),
|
||||||
FileLineFinder::where(fn (string $line): bool => str_contains($line, 'public function')),
|
FileLineFinder::where(fn (string $line): bool => str_contains($line, 'public function')),
|
||||||
@ -255,6 +257,8 @@ final class OppositeExpectation
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Asserts that the given expectation target not to have the protected methods besides the given methods.
|
* Asserts that the given expectation target not to have the protected methods besides the given methods.
|
||||||
|
*
|
||||||
|
* @param array<int, string>|string $methods
|
||||||
*/
|
*/
|
||||||
public function toHaveProtectedMethodsBesides(array|string $methods): ArchExpectation
|
public function toHaveProtectedMethodsBesides(array|string $methods): ArchExpectation
|
||||||
{
|
{
|
||||||
@ -275,7 +279,7 @@ final class OppositeExpectation
|
|||||||
|
|
||||||
return true;
|
return true;
|
||||||
},
|
},
|
||||||
count($methods) === 0
|
$methods === []
|
||||||
? 'not to have protected methods'
|
? 'not to have protected methods'
|
||||||
: sprintf("not to have protected methods besides '%s'", implode("', '", $methods)),
|
: sprintf("not to have protected methods besides '%s'", implode("', '", $methods)),
|
||||||
FileLineFinder::where(fn (string $line): bool => str_contains($line, 'protected function')),
|
FileLineFinder::where(fn (string $line): bool => str_contains($line, 'protected function')),
|
||||||
@ -284,6 +288,8 @@ final class OppositeExpectation
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Asserts that the given expectation target not to have the private methods besides the given methods.
|
* Asserts that the given expectation target not to have the private methods besides the given methods.
|
||||||
|
*
|
||||||
|
* @param array<int, string>|string $methods
|
||||||
*/
|
*/
|
||||||
public function toHavePrivateMethodsBesides(array|string $methods): ArchExpectation
|
public function toHavePrivateMethodsBesides(array|string $methods): ArchExpectation
|
||||||
{
|
{
|
||||||
@ -304,7 +310,7 @@ final class OppositeExpectation
|
|||||||
|
|
||||||
return true;
|
return true;
|
||||||
},
|
},
|
||||||
count($methods) === 0
|
$methods === []
|
||||||
? 'not to have private methods'
|
? 'not to have private methods'
|
||||||
: sprintf("not to have private methods besides '%s'", implode("', '", $methods)),
|
: sprintf("not to have private methods besides '%s'", implode("', '", $methods)),
|
||||||
FileLineFinder::where(fn (string $line): bool => str_contains($line, 'private function')),
|
FileLineFinder::where(fn (string $line): bool => str_contains($line, 'private function')),
|
||||||
|
|||||||
Reference in New Issue
Block a user