Merge pull request #1287 from mortenscheel/patch-1

Add toNotIncludeSuspiciousCharacters() expectation
This commit is contained in:
nuno maduro
2025-07-26 04:30:22 +01:00
committed by GitHub

View File

@ -894,6 +894,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.
*/