/** * @depends testMapToSpecialType */ public function testGenerate() { $outline = new StringOutline(); $targetTypeClass = 'Wookieb\\ZorroDataSchema\\Schema\\Type\\BooleanType'; $this->object->mapToSpecialType('string', $targetTypeClass); $result = $this->object->generate($outline, $this->getImplementationMock()); $this->assertInstanceOf($targetTypeClass, $result); }
/** * @depends testRegisterTypeBuilder */ public function testGeneratorsPriority() { $implementation = $this->getImplementationMock(); $specialBuilder = new MapToSpecialTypesBuilder(); $specialBuilder->mapToSpecialType('string', 'Wookieb\\ZorroDataSchema\\Schema\\Type\\BooleanType'); $this->object->registerTypeBuilder(new BasicTypesBuilder())->registerTypeBuilder($specialBuilder, 100); $this->assertInstanceOf('Wookieb\\ZorroDataSchema\\Schema\\Type\\FloatType', $this->object->generateType(new FloatOutline(), $implementation)); $this->assertInstanceOf('Wookieb\\ZorroDataSchema\\Schema\\Type\\BooleanType', $this->object->generateType(new StringOutline(), $implementation)); }