/** * Create mapper source. * * @param string|SourceTypeInterface $type * @param SourceDataFactoryInterface $dataFactory * @param string $name * * @return Source */ public function create($type, SourceDataFactoryInterface $dataFactory, $name) { if (is_string($type)) { $type = $this->typeRegistry->getType($type); } return new Source($type, $dataFactory, $name); }
public function testCreate_WithStringTypeArgument() { $this->registry->add($this->getSourceTypeMock('tadcka_mapper'), 'tadcka_mapper'); $source = $this->factory->create('tadcka_mapper', $this->getSourceDataFactoryMock(), 'tadcka_mapper'); $this->assertEquals('tadcka_mapper', $source->getTypeName()); }
public function testGetType_Success() { $mockType = $this->getSourceTypeMock('tadcka_mapper'); $this->registry->add($mockType, 'tadcka_mapper'); $this->assertEquals($mockType, $this->registry->getType('tadcka_mapper')); }