public function testDbPostgresql() { require 'unit-tests/config.db.php'; if (empty($configPostgresql)) { $this->markTestSkipped("Skipped"); return; } $connection = new Phalcon\Db\Adapter\Pdo\Postgresql($configPostgresql); //List tables $expectedTables = array(0 => 'customers', 1 => 'parts', 2 => 'personas', 3 => 'personnes', 4 => 'prueba', 5 => 'robots', 6 => 'robots_parts', 7 => 'subscriptores', 8 => 'tipo_documento'); $tables = $connection->listTables(); $this->assertEquals($tables, $expectedTables); $tables = $connection->listTables('public'); $this->assertEquals($tables, $expectedTables); //Table exist $this->assertEquals($connection->tableExists('personas'), 1); $this->assertEquals($connection->tableExists('noexist'), 0); $this->assertEquals($connection->tableExists('personas', 'public'), 1); $this->assertEquals($connection->tableExists('personas', 'test'), 0); //Columns $expectedDescribe = $this->getExpectedColumnsPostgresql(); $describe = $connection->describeColumns('personas'); $this->assertEquals($describe, $expectedDescribe); $describe = $connection->describeColumns('personas', 'public'); $this->assertEquals($describe, $expectedDescribe); //Indexes $expectedIndexes = array('robots_parts_parts_id' => Phalcon\Db\Index::__set_state(array('_name' => 'robots_parts_parts_id', '_columns' => array('parts_id'))), 'robots_parts_pkey' => Phalcon\Db\Index::__set_state(array('_name' => 'robots_parts_pkey', '_columns' => array('id'))), 'robots_parts_robots_id' => Phalcon\Db\Index::__set_state(array('_name' => 'robots_parts_robots_id', '_columns' => array('robots_id')))); $describeIndexes = $connection->describeIndexes('robots_parts'); $this->assertEquals($describeIndexes, $expectedIndexes); $describeIndexes = $connection->describeIndexes('robots_parts', 'public'); $this->assertEquals($describeIndexes, $expectedIndexes); //References $expectedReferences = array('robots_parts_ibfk_1' => Phalcon\Db\Reference::__set_state(array('_referenceName' => 'robots_parts_ibfk_1', '_referencedTable' => 'robots', '_columns' => array('robots_id'), '_referencedColumns' => array('id'), '_referencedSchema' => 'phalcon_test')), 'robots_parts_ibfk_2' => Phalcon\Db\Reference::__set_state(array('_referenceName' => 'robots_parts_ibfk_2', '_referencedTable' => 'parts', '_columns' => array('parts_id'), '_referencedColumns' => array('id'), '_referencedSchema' => 'phalcon_test'))); $describeReferences = $connection->describeReferences('robots_parts'); $this->assertEquals($describeReferences, $expectedReferences); $describeReferences = $connection->describeReferences('robots_parts', 'public'); $this->assertEquals($describeReferences, $expectedReferences); }