public function testConnectionWithoutPort() { $options = $this->adapter->getOptions(); unset($options['port']); $this->adapter->setOptions($options); $this->assertTrue($this->adapter->getConnection() instanceof \PDO); }
public function testConnectionWithSocketConnection() { if (!TESTS_PHINX_DB_ADAPTER_MYSQL_UNIX_SOCKET) { $this->markTestSkipped('MySQL socket connection skipped. See TESTS_PHINX_DB_ADAPTER_MYSQL_UNIX_SOCKET constant.'); } $options = array('name' => TESTS_PHINX_DB_ADAPTER_MYSQL_DATABASE, 'user' => TESTS_PHINX_DB_ADAPTER_MYSQL_USERNAME, 'pass' => TESTS_PHINX_DB_ADAPTER_MYSQL_PASSWORD, 'unix_socket' => TESTS_PHINX_DB_ADAPTER_MYSQL_UNIX_SOCKET); $adapter = new MysqlAdapter($options, new NullOutput()); $adapter->connect(); $this->assertInstanceOf('\\PDO', $this->adapter->getConnection()); }
public function testAddForeignKeyWithPdoExceptionErrorMode() { $this->adapter->getConnection()->setAttribute(\PDO::ATTR_ERRMODE, \PDO::ERRMODE_EXCEPTION); $refTable = new \Phinx\Db\Table('ref_table', array(), $this->adapter); $refTable->addColumn('field1', 'string')->save(); $table = new \Phinx\Db\Table('table', array(), $this->adapter); $table->addColumn('ref_table_id', 'integer')->save(); $fk = new \Phinx\Db\Table\ForeignKey(); $fk->setReferencedTable($refTable)->setColumns(array('ref_table_id'))->setReferencedColumns(array('id')); $this->adapter->addForeignKey($table, $fk); $this->assertTrue($this->adapter->hasForeignKey($table->getName(), array('ref_table_id'))); }
public function testConnection() { $this->assertTrue($this->adapter->getConnection() instanceof \PDO); }
/** * @return mysqli */ public function getConnection() { return parent::getConnection(); }