/**
  * Tests the getAddColumnSQL method.
  *
  * Note that combinations of fields is tested in testGetColumnSQL.
  *
  * @return  void
  *
  * @since   12.1
  */
 public function testGetAddColumnSQL()
 {
     $instance = new JDatabaseImporterPostgresqlInspector();
     $instance->setDbo($this->dbo);
     $this->assertThat($instance->getAddColumnSQL('jos_test', new SimpleXmlElement($this->sample['xml-title-field'])), $this->equalTo('ALTER TABLE "jos_test" ADD COLUMN "title" character varying(50) NOT NULL'), 'testGetAddColumnSQL did not yield the expected result.');
     /* test a field with a default value */
     $this->assertThat($instance->getAddColumnSQL('jos_test', new SimpleXmlElement($this->sample['xml-title-def'])), $this->equalTo('ALTER TABLE "jos_test" ADD COLUMN "title" character varying(50) NOT NULL DEFAULT \'this is a test\''), 'testGetAddColumnSQL did not yield the expected result.');
     /* test a field with a numeric default value */
     $this->assertThat($instance->getAddColumnSQL('jos_test', new SimpleXmlElement($this->sample['xml-int-defnum'])), $this->equalTo('ALTER TABLE "jos_test" ADD COLUMN "title" integer NOT NULL DEFAULT 0'), 'testGetAddColumnSQL did not yield the expected result.');
 }
	/**
	 * Tests the getAddColumnSQL method.
	 *
	 * Note that combinations of fields are tested in testGetColumnSQL.
	 *
	 * @return  void
	 *
	 * @since   12.1
	 */
	public function testGetAddColumnSQL()
	{
		$instance = new JDatabaseImporterPostgresqlInspector;
		$instance->setDbo($this->dbo);

		$sample = array(
			'xml-title-field' => '<field Field="title" Type="character varying(50)" Null="NO" Default="NULL" Comments="" />',
			'xml-title-def' => '<field Field="title" Type="character varying(50)" Null="NO" Default="this is a test" Comments="" />',
			'xml-int-defnum' => '<field Field="title" Type="integer" Null="NO" Default="0" Comments="" />',);

		$this->assertThat(
			$instance->getAddColumnSQL(
				'jos_test',
				new SimpleXmlElement($sample['xml-title-field'])
			),
			$this->equalTo(
				'ALTER TABLE "jos_test" ADD COLUMN "title" character varying(50) NOT NULL'
			),
			'testGetAddColumnSQL did not yield the expected result.'
		);

		// Test a field with a default value
		$this->assertThat(
			$instance->getAddColumnSQL(
				'jos_test',
				new SimpleXmlElement($sample['xml-title-def'])
			),
			$this->equalTo(
				'ALTER TABLE "jos_test" ADD COLUMN "title" character varying(50) NOT NULL DEFAULT \'this is a test\''
			),
			'testGetAddColumnSQL did not yield the expected result.'
		);

		// Test a field with a numeric default value
		$this->assertThat(
			$instance->getAddColumnSQL(
				'jos_test',
				new SimpleXmlElement($sample['xml-int-defnum'])
			),
			$this->equalTo(
				'ALTER TABLE "jos_test" ADD COLUMN "title" integer NOT NULL DEFAULT 0'
			),
			'testGetAddColumnSQL did not yield the expected result.'
		);
	}