private function useExceptionImplementation()
 {
     $this->getClassMap()->registerClass('Exception', '\\Exception');
     $implementation = new ClassTypeImplementation('Exception');
     $causePropertyImplementation = new PropertyImplementation('cause');
     $causePropertyImplementation->setTargetPropertyName('previous');
     $implementation->addPropertyImplementation($causePropertyImplementation);
     $this->registerClassTypeImplementation($implementation);
 }
 public function testAddPropertyImplementation()
 {
     $propertyImplementation = new PropertyImplementation('property');
     $this->assertMethodChaining($this->object->addPropertyImplementation($propertyImplementation), 'addPropertyImplementation');
     $this->assertSame($propertyImplementation, $this->object->getImplementationForProperty('property'));
 }
 public function testGenerateClass()
 {
     $parentClass = new ClassOutline('vacuumBadger');
     $outline = new ClassOutline('vacuum', array(), $parentClass);
     $outline->addProperty($this->propertyOutline('zoo')->setIsNullable(true))->addProperty($this->propertyOutline('bridge')->setIsNullable(true))->addProperty($this->propertyOutline('galley'))->addProperty($this->propertyOutline('granddaughter')->setDefaultValue('is young'))->addProperty($this->propertyOutline('everyNumber'));
     $this->classMap->registerClass('vacuum', 'VacuumZooBridge')->registerClass('vacuumBadger', 'VacuumBadger');
     $classImplementation = new ClassTypeImplementation('vacuum');
     $classImplementation->addPropertyImplementation($this->propertyImplementation('zoo'))->addPropertyImplementation($this->propertyImplementation('bridge')->setSetter('setBridge')->setGetter('getBridge'))->addPropertyImplementation($this->propertyImplementation('galley')->setSetter('setGalley'))->addPropertyImplementation($this->propertyImplementation('granddaughter')->setGetter('getGranddaughter'))->addPropertyImplementation($this->propertyImplementation('everyNumber')->setTargetPropertyName('notEveryNumber'));
     $this->implementation->registerClassTypeImplementation($classImplementation);
     $parentClassExpected = new ClassType('vacuumBadger', 'VacuumBadger');
     $expected = new ClassType('vacuum', 'VacuumZooBridge', $parentClassExpected);
     $expected->addProperty($this->property('zoo')->setIsNullable(true))->addProperty($this->property('bridge')->setGetterName('getBridge')->setSetterName('setBridge')->setIsNullable(true))->addProperty($this->property('galley')->setSetterName('setGalley'))->addProperty($this->property('granddaughter')->setDefaultValue('is young')->setGetterName('getGranddaughter'))->addProperty($this->property('everyNumber')->setTargetPropertyName('notEveryNumber'));
     $result = $this->object->generate($outline, $this->implementation);
     $this->assertEquals($expected, $result);
 }