public function testCanBeInstantiatedWithOnlyAStringOrAValue()
{
new FixtureReferenceValue('user0');
new FixtureReferenceValue(new FakeValue());
try {
new FixtureReferenceValue(null);
} catch (\InvalidArgumentException $exception) {
$this->assertEquals('Expected reference to be either a string or a "Nelmio\\Alice\\Definition\\ValueInterface" instance, got' . ' "null" instead.', $exception->getMessage());
}
try {
new FixtureReferenceValue(true);
} catch (\InvalidArgumentException $exception) {
$this->assertEquals('Expected reference to be either a string or a "Nelmio\\Alice\\Definition\\ValueInterface" instance, got' . ' "boolean" instead.', $exception->getMessage());
}
try {
new FixtureReferenceValue(10);
} catch (\InvalidArgumentException $exception) {
$this->assertEquals('Expected reference to be either a string or a "Nelmio\\Alice\\Definition\\ValueInterface" instance, got' . ' "integer" instead.', $exception->getMessage());
}
try {
new FixtureReferenceValue(0.5);
} catch (\InvalidArgumentException $exception) {
$this->assertEquals('Expected reference to be either a string or a "Nelmio\\Alice\\Definition\\ValueInterface" instance, got' . ' "double" instead.', $exception->getMessage());
}
try {
new FixtureReferenceValue([]);
} catch (\InvalidArgumentException $exception) {
$this->assertEquals('Expected reference to be either a string or a "Nelmio\\Alice\\Definition\\ValueInterface" instance, got' . ' "array" instead.', $exception->getMessage());
}
try {
new FixtureReferenceValue(new \stdClass());
} catch (\InvalidArgumentException $exception) {
$this->assertEquals('Expected reference to be either a string or a "Nelmio\\Alice\\Definition\\ValueInterface" instance, got' . ' "stdClass" instead.', $exception->getMessage());
}
try {
new FixtureReferenceValue(function () {
});
} catch (\InvalidArgumentException $exception) {
$this->assertEquals('Expected reference to be either a string or a "Nelmio\\Alice\\Definition\\ValueInterface" instance, got' . ' "Closure" instead.', $exception->getMessage());
}
}