public function testMagicSetter() { $value = 'test value'; $property = 'foo_bar'; $camelCase = 'FooBar'; $this->assertNull($this->entity->getProperty($property)); $mapper = $this->createMapperMock(); $mapper->expects($this->any())->method('camelCaseToProperty')->with($camelCase)->will($this->returnValue($property)); $mapper->expects($this->any())->method('propertyToCamelCase')->with($property)->will($this->returnValue($camelCase)); $this->entity->setPropertyMapper($mapper); $this->entity->setFooBar($value); $properties = $this->entity->toArray(); $this->assertArrayHasKey($property, $properties); $this->assertSame($value, $properties[$property]); }