public function testBuild()
 {
     $this->object->load('implementation.yml');
     $classMap = new ClassMap();
     $classMap->registerNamespace('Wookieb\\ZorroDataSchema\\Tests\\Resources\\Implementation\\Entity')->registerNamespace('Wookieb\\ZorroDataSchema\\Tests\\Resources\\Implementation\\SecondEntity');
     $globalOptions = new GlobalClassTypeImplementation();
     $globalOptions->setAccessorsStyle(new CamelCaseStyle())->setAccessorsEnabled(true);
     $implementation = new BasicImplementation($classMap, $globalOptions);
     $implementation->registerClassTypeImplementation($this->classImplementation('User')->setAccessorsEnabled(false)->setAccessorsStyle(new CamelCaseStyle())->addPropertyImplementation($this->propertyImplementation('name')->setSetter('setLogin'))->addPropertyImplementation($this->propertyImplementation('lastname')->setTargetPropertyName('surname'))->addPropertyImplementation($this->propertyImplementation('nickname')->setGetter('getNick'))->setAccessorsEnabled(false))->registerClassTypeImplementation($this->classImplementation('Admin')->setAccessorsEnabled(true)->setAccessorsStyle(new UnderscoreStyle())->setClassName('Wookieb\\ZorroDataSchema\\Tests\\Resources\\Implementation\\Admin')->addPropertyImplementation($this->propertyImplementation('masterOfDisaster')->setTargetPropertyName('yesHeIs')->setSetter('set_yes_he_is')->setGetter('get_yes_he_is')))->registerClassTypeImplementation($this->classImplementation('SuperUser')->setAccessorsEnabled(true)->setAccessorsStyle(new CamelCaseStyle())->addPropertyImplementation($this->propertyImplementation('position')->setSetter('setPositionName')->setGetter('getPosition'))->addPropertyImplementation($this->propertyImplementation('platform')->setGetter('getSuperUserPlatform')->setSetter('setPlatform'))->addPropertyImplementation($this->propertyImplementation('system')->setSetter('setOperatingSystem')->setGetter('getOperatingSystem')->setTargetPropertyName('operatingSystem')));
     $this->assertEquals($implementation, $this->object->build());
     $expectedResources = array(new FileResource(TESTS_DIRECTORY . '/Resources/Implementation/implementation.yml'), new FileResource(TESTS_DIRECTORY . '/Resources/Implementation/second_implementation.yml'));
     $this->assertEquals($expectedResources, $this->object->getResources());
 }
Esempio n. 2
0
 public function testExceptionWhenClassCannotBeFound()
 {
     $msg = 'No class name defined for type "DentalGuitar"';
     $this->setExpectedException('Wookieb\\ZorroDataSchema\\Exception\\ClassNotFoundException', $msg);
     $this->object->getClass('DentalGuitar');
 }