Include method name in toHaveMethod error message

This commit is contained in:
Dan Mason
2024-07-19 15:30:43 +01:00
committed by GitHub
parent ef120125e0
commit ef29b4f091

View File

@ -515,7 +515,7 @@ final class Expectation
return Targeted::make( return Targeted::make(
$this, $this,
fn (ObjectDescription $object): bool => $object->reflectionClass->hasMethod($method), fn (ObjectDescription $object): bool => $object->reflectionClass->hasMethod($method),
'to have method', sprintf("to have method '%s'", $method),
FileLineFinder::where(fn (string $line): bool => str_contains($line, 'class')), FileLineFinder::where(fn (string $line): bool => str_contains($line, 'class')),
); );
} }