/** * {@inheritDoc} */ public function set(Fixture $fixture, $object, $property, $value) { if (!method_exists($object, $fixture->getCustomSetter())) { throw new \RuntimeException('Setter ' . $fixture->getCustomSetter() . ' not found in object'); } $customSetter = $fixture->getCustomSetter()->getValue(); $object->{$customSetter}($property, $value); }
public function testGetCustomSetterWillReturnTheCustomSetterValue() { $setFixture = new Fixture(self::USER, 'user', array('__set' => 'setterFunc'), null); $noSetFixture = new Fixture(self::USER, 'user', array(), null); $this->assertEquals('setterFunc', $setFixture->getCustomSetter()); $this->assertNull($noSetFixture->getCustomSetter()); }