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\\Resource\\Adapter\\Mysql', ['select', 'fetchAll', 'query', 'loadPage', 'createDelta', 'loadChangedRecords', 'loadDeletedRecords'], [], '', false);
     $this->adapterFactory = $this->getMock('\\Migration\\Resource\\AdapterFactory', ['create'], [], '', false);
     $this->adapterFactory->expects($this->once())->method('create')->with($adapterConfigs)->will($this->returnValue($this->adapter));
     $this->documentFactory = $this->getMock('\\Migration\\Resource\\DocumentFactory', [], [], '', false);
     $this->structureFactory = $this->getMock('\\Migration\\Resource\\StructureFactory', [], [], '', false);
     $this->documentCollection = $this->getMock('\\Migration\\Resource\\Document\\Collection', [], [], '', false);
     $this->resourceSource = new \Migration\Resource\Source($this->adapterFactory, $this->config, $this->documentFactory, $this->structureFactory, $this->documentCollection);
 }
Example #2
0
 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\\Resource\\Adapter\\Mysql', ['insertRecords', 'deleteAllRecords', 'backupDocument', 'rollbackDocument', 'deleteBackup'], [], '', false);
     $this->adapterFactory = $this->getMock('\\Migration\\Resource\\AdapterFactory', ['create'], [], '', false);
     $this->adapterFactory->expects($this->once())->method('create')->with($adapterConfigs)->will($this->returnValue($this->adapter));
     $this->documentFactory = $this->getMock('\\Migration\\Resource\\DocumentFactory', [], [], '', false);
     $this->structureFactory = $this->getMock('\\Migration\\Resource\\StructureFactory', [], [], '', false);
     $this->documentCollection = $this->getMock('\\Migration\\Resource\\Document\\Collection', [], [], '', false);
     $this->resourceDestination = new \Migration\Resource\Destination($this->adapterFactory, $this->config, $this->documentFactory, $this->structureFactory, $this->documentCollection);
 }