/** * Tests the getAddIndexSQL method. * * @return void * * @since 12.1 */ public function testGetAddIndexSQL() { $instance = new JDatabaseImporterPostgresqlInspector(); $instance->setDbo($this->dbo); $this->assertThat($instance->getAddIndexSQL(new SimpleXmlElement($this->sample['xml-index'])), $this->equalTo("CREATE INDEX jos_dbtest_idx_name ON jos_dbtest USING btree (name)"), 'testGetAddIndexSQL did not yield the expected result.'); $this->assertThat($instance->getAddIndexSQL(new SimpleXmlElement($this->sample['xml-primary-key'])), $this->equalTo("ALTER TABLE jos_dbtest ADD PRIMARY KEY (id)"), 'testGetAddIndexSQL did not yield the expected result.'); }
/** * Tests the getAddIndexSQL method. * * @return void * * @since 12.1 */ public function testGetAddIndexSQL() { $xmlIndex = '<key Index="jos_dbtest_idx_name" is_primary="FALSE" is_unique="FALSE" ' . 'Query="CREATE INDEX jos_dbtest_idx_name ON jos_dbtest USING btree (name)" />'; $xmlPrimaryKey = '<key Index="jos_dbtest_pkey" is_primary="TRUE" is_unique="TRUE" ' . 'Query="ALTER TABLE jos_dbtest ADD PRIMARY KEY (id)" />'; $instance = new JDatabaseImporterPostgresqlInspector; $instance->setDbo($this->dbo); $this->assertThat( $instance->getAddIndexSQL( new SimpleXmlElement($xmlIndex) ), $this->equalTo( "CREATE INDEX jos_dbtest_idx_name ON jos_dbtest USING btree (name)" ), 'testGetAddIndexSQL did not yield the expected result.' ); $this->assertThat( $instance->getAddIndexSQL( new SimpleXmlElement($xmlPrimaryKey) ), $this->equalTo( "ALTER TABLE jos_dbtest ADD PRIMARY KEY (id)" ), 'testGetAddIndexSQL did not yield the expected result.' ); }