/** * @test */ public function it_works_for_objects_without_properties() { $object = new ClassWithoutProperties(); $hydrate = new HydrateUsingReflection(); // This class doesn't have any property which should be no problem $hydrate->hydrate([], $object); }
/** * @test */ public function it_ignores_extra_keys_in_the_data_array() { $object = new ClassWithPrivateProperties(); $hydrate = new HydrateUsingReflection(); // 'extra' is not a property, which should be no problem $hydrate->hydrate(['extra' => 'no problem', 'foo' => 'bar'], $object); $this->assertSame('bar', $object->foo()); }