Esempio n. 1
0
/**
 * @internal
 *
 * @param string $name
 * @param mixed  $value
 *
 * @throws InvalidArgumentException
 */
function assertArgumentIsString($name, $value)
{
    if (!is_string($value)) {
        throw InvalidArgumentException::expectedString($name, $value);
    }
}
 /** @test */
 public function it_creates_an_exception_for_expected_string_but_got_an_object()
 {
     $exception = InvalidArgumentException::expectedString('param', new \stdClass());
     $this->assertEquals('$param was expected to be a string; got instance of stdClass.', $exception->getMessage());
 }