mirror of
https://github.com/pestphp/pest.git
synced 2026-03-06 15:57:21 +01:00
Add toNotIncludeSuspiciousCharacters() expectation
This commit is contained in:
@ -885,6 +885,21 @@ final class Expectation
|
||||
return ToUseNothing::make($this);
|
||||
}
|
||||
|
||||
/**
|
||||
* Asserts that the source code of the given expectation target does not include suspicious characters.
|
||||
*/
|
||||
public function toNotIncludeSuspiciousCharacters(): ArchExpectation
|
||||
{
|
||||
$checker = new Spoofchecker();
|
||||
|
||||
return Targeted::make(
|
||||
$this,
|
||||
fn (ObjectDescription $object) => ! $checker->isSuspicious(file_get_contents($object->path)),
|
||||
'to not include suspicious characters',
|
||||
FileLineFinder::where(fn (string $line) => $checker->isSuspicious($line)),
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Not supported.
|
||||
*/
|
||||
|
||||
Reference in New Issue
Block a user