예제 #1
0
 /**
  * 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);
 }
예제 #2
0
 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());
 }
예제 #3
0
 public function testGetType_Success()
 {
     $mockType = $this->getSourceTypeMock('tadcka_mapper');
     $this->registry->add($mockType, 'tadcka_mapper');
     $this->assertEquals($mockType, $this->registry->getType('tadcka_mapper'));
 }