According to the PHPUnit Documentation on @expectedExceptionMessage, the string must only be a substring of the actual Exception thrown.
@expectedExceptionMessage
Exception
In
You can use $this->expectExceptionMessage to handle this.
$this->expectExceptionMessage
Example:
$this->expectException(InvalidArgumentException::class); $this->expectExceptionMessage = "Some error message";