コード例 #1
0
 /**
  * @param AdapterFactory $adapterFactory
  * @param \Migration\Config $configReader
  * @param DocumentFactory $documentFactory
  * @param StructureFactory $structureFactory
  * @param Document\Collection $documentCollection
  */
 public function __construct(\Migration\ResourceModel\AdapterFactory $adapterFactory, \Migration\Config $configReader, \Migration\ResourceModel\DocumentFactory $documentFactory, \Migration\ResourceModel\StructureFactory $structureFactory, \Migration\ResourceModel\Document\Collection $documentCollection)
 {
     $this->configReader = $configReader;
     $this->adapter = $adapterFactory->create(['config' => $this->getResourceConfig()]);
     $this->documentFactory = $documentFactory;
     $this->structureFactory = $structureFactory;
     $this->documentCollection = $documentCollection;
 }
コード例 #2
0
 /**
  * @return void
  */
 public function testCreate()
 {
     $adapterClassName = '\\Migration\\ResourceModel\\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\\ResourceModel\\Adapter\\Mysql', $data)->will($this->returnValue($adapter));
     $this->assertInstanceOf($adapterClassName, $this->adapterFactory->create($data));
 }
コード例 #3
0
 /**
  * @return void
  */
 protected function setUp()
 {
     $config = ['type' => 'database', 'version' => '2.0.0.0', 'database' => ['host' => 'localhost', 'name' => 'dbname', 'user' => 'uname', 'password' => 'upass']];
     $adapterConfigs = ['config' => ['host' => 'localhost', 'dbname' => 'dbname', 'username' => 'uname', 'password' => 'upass']];
     $this->config = $this->getMock('\\Migration\\Config', ['getOption', 'getDestination'], [], '', false);
     $this->config->expects($this->any())->method('getDestination')->will($this->returnValue($config));
     $this->adapter = $this->getMock('\\Migration\\ResourceModel\\Adapter\\Mysql', ['insertRecords', 'deleteAllRecords', 'backupDocument', 'rollbackDocument', 'deleteBackup'], [], '', false);
     $this->adapterFactory = $this->getMock('\\Migration\\ResourceModel\\AdapterFactory', ['create'], [], '', false);
     $this->adapterFactory->expects($this->once())->method('create')->with($adapterConfigs)->will($this->returnValue($this->adapter));
     $this->documentFactory = $this->getMock('\\Migration\\ResourceModel\\DocumentFactory', [], [], '', false);
     $this->structureFactory = $this->getMock('\\Migration\\ResourceModel\\StructureFactory', [], [], '', false);
     $this->documentCollection = $this->getMock('\\Migration\\ResourceModel\\Document\\Collection', [], [], '', false);
     $this->resourceDestination = new \Migration\ResourceModel\Destination($this->adapterFactory, $this->config, $this->documentFactory, $this->structureFactory, $this->documentCollection);
 }
コード例 #4
0
 /**
  * @return void
  */
 protected function setUp()
 {
     $adapterConfigs = ['config' => ['host' => 'localhost', 'dbname' => 'dbname', 'username' => 'uname', 'password' => 'upass']];
     $this->config = $this->getMock('\\Migration\\Config', ['getOption', 'getSource'], [], '', false);
     $config = ['type' => 'database', 'version' => '1.14.1.0', 'database' => ['host' => 'localhost', 'name' => 'dbname', 'user' => 'uname', 'password' => 'upass']];
     $this->config->expects($this->once())->method('getSource')->will($this->returnValue($config));
     $this->adapter = $this->getMock('\\Migration\\ResourceModel\\Adapter\\Mysql', ['select', 'fetchAll', 'query', 'loadPage', 'createDelta', 'loadChangedRecords', 'loadDeletedRecords'], [], '', false);
     $this->adapterFactory = $this->getMock('\\Migration\\ResourceModel\\AdapterFactory', ['create'], [], '', false);
     $this->adapterFactory->expects($this->once())->method('create')->with($adapterConfigs)->will($this->returnValue($this->adapter));
     $this->documentFactory = $this->getMock('\\Migration\\ResourceModel\\DocumentFactory', [], [], '', false);
     $this->structureFactory = $this->getMock('\\Migration\\ResourceModel\\StructureFactory', [], [], '', false);
     $this->documentCollection = $this->getMock('\\Migration\\ResourceModel\\Document\\Collection', [], [], '', false);
     $this->resourceSource = new \Migration\ResourceModel\Source($this->adapterFactory, $this->config, $this->documentFactory, $this->structureFactory, $this->documentCollection);
 }