Beispiel #1
0
 /**
  * {@inheritdoc}
  */
 public function create(array $connectionConfig)
 {
     $quote = new \Magento\Framework\DB\Platform\Quote();
     $selectFactory = new \Magento\Framework\DB\SelectFactory(new \Magento\Framework\DB\Select\SelectRenderer(['distinct' => ['renderer' => new \Magento\Framework\DB\Select\DistinctRenderer(), 'sort' => 100], 'columns' => ['renderer' => new \Magento\Framework\DB\Select\ColumnsRenderer($quote), 'sort' => 200], 'union' => ['renderer' => new \Magento\Framework\DB\Select\UnionRenderer(), 'sort' => 300], 'from' => ['renderer' => new \Magento\Framework\DB\Select\FromRenderer($quote), 'sort' => 400], 'where' => ['renderer' => new \Magento\Framework\DB\Select\WhereRenderer(), 'sort' => 500], 'group' => ['renderer' => new \Magento\Framework\DB\Select\GroupRenderer($quote), 'sort' => 600], 'having' => ['renderer' => new \Magento\Framework\DB\Select\HavingRenderer(), 'sort' => 700], 'order' => ['renderer' => new \Magento\Framework\DB\Select\OrderRenderer($quote), 'sort' => 800], 'limit' => ['renderer' => new \Magento\Framework\DB\Select\LimitRenderer(), 'sort' => 900], 'for_update' => ['renderer' => new \Magento\Framework\DB\Select\ForUpdateRenderer(), 'sort' => 1000]]));
     $resourceInstance = new Mysql(new Stdlib\StringUtils(), new Stdlib\DateTime(), $selectFactory, $connectionConfig);
     return $resourceInstance->getConnection($this->serviceLocator->get(\Magento\Framework\DB\Logger\Quiet::class));
 }
Beispiel #2
0
 /**
  * @expectedException \InvalidArgumentException
  * @expectedExceptionMessage Configuration array must have a key for 'dbname' that names the database instance
  */
 public function testGetConnectionInactive()
 {
     $config = ['host' => 'localhost', 'active' => false];
     $object = new Mysql($this->string, $this->dateTime, $this->selectFactory, $config);
     $logger = $this->getMockForAbstractClass('Magento\\Framework\\DB\\LoggerInterface');
     $this->assertNull($object->getConnection($logger));
 }
 /**
  * {@inheritdoc}
  */
 public function create(array $connectionConfig)
 {
     $resourceInstance = new Mysql(new Stdlib\StringUtils(), new Stdlib\DateTime(), $connectionConfig);
     return $resourceInstance->getConnection($this->serviceLocator->get(\Magento\Framework\DB\Logger\Quiet::class));
 }