public function testCreate() { $adapterClassName = '\\Migration\\Resource\\Adapter\\Mysql'; $data = ['config' => ['key' => 'value']]; $adapter = $this->getMock($adapterClassName, [], [], '', false); $this->config->expects($this->once())->method('getOption')->with('resource_adapter_class_name')->will($this->returnValue(null)); $this->objectManager->expects($this->once())->method('create')->with('\\Migration\\Resource\\Adapter\\Mysql', $data)->will($this->returnValue($adapter)); $this->assertInstanceOf($adapterClassName, $this->adapterFactory->create($data)); }
/** * @param AdapterFactory $adapterFactory * @param \Migration\Config $configReader * @param DocumentFactory $documentFactory * @param StructureFactory $structureFactory * @param Document\Collection $documentCollection */ public function __construct(\Migration\Resource\AdapterFactory $adapterFactory, \Migration\Config $configReader, \Migration\Resource\DocumentFactory $documentFactory, \Migration\Resource\StructureFactory $structureFactory, \Migration\Resource\Document\Collection $documentCollection) { $this->configReader = $configReader; $this->adapter = $adapterFactory->create(['config' => $this->getResourceConfig()]); $this->documentFactory = $documentFactory; $this->structureFactory = $structureFactory; $this->documentCollection = $documentCollection; }