Ejemplo n.º 1
0
 public function testGetTriggerName()
 {
     $tableName = 'subject_table';
     $time = 'before';
     $event = 'insert';
     $triggerName = 'trg_subject_table_before_insert';
     $this->connectionFactory->expects($this->once())->method('create')->will($this->returnValue($this->connection));
     $this->connection->expects($this->once())->method('getTriggerName')->with($tableName, $time, $event)->willReturn($triggerName);
     $this->assertSame($triggerName, $this->resource->getTriggerName($tableName, $time, $event));
 }
 /**
  * Retrieve connection by $connectionName
  *
  * @param string $connectionName
  * @return \Magento\Framework\DB\Adapter\AdapterInterface
  * @throws \DomainException
  */
 public function getConnectionByName($connectionName)
 {
     if (isset($this->connections[$connectionName])) {
         return $this->connections[$connectionName];
     }
     $connectionConfig = $this->deploymentConfig->get(ConfigOptionsListConstants::CONFIG_PATH_DB_CONNECTIONS . '/' . $connectionName);
     if ($connectionConfig) {
         $connection = $this->connectionFactory->create($connectionConfig);
     } else {
         throw new \DomainException('Connection "' . $connectionName . '" is not defined');
     }
     $this->connections[$connectionName] = $connection;
     return $connection;
 }