Code Duplication    Length = 28-29 lines in 2 locations

lib/Cake/Test/Case/Model/Datasource/Database/MysqlTest.php 1 location

@@ 724-751 (lines=28) @@
721
 *
722
 * @return void
723
 */
724
	public function testAlteringTwoTables() {
725
		$schema1 = new CakeSchema(array(
726
			'name' => 'AlterTest1',
727
			'connection' => 'test',
728
			'altertest' => array(
729
				'id' => array('type' => 'integer', 'null' => false, 'default' => 0),
730
				'name' => array('type' => 'string', 'null' => false, 'length' => 50),
731
			),
732
			'other_table' => array(
733
				'id' => array('type' => 'integer', 'null' => false, 'default' => 0),
734
				'name' => array('type' => 'string', 'null' => false, 'length' => 50),
735
			)
736
		));
737
		$schema2 = new CakeSchema(array(
738
			'name' => 'AlterTest1',
739
			'connection' => 'test',
740
			'altertest' => array(
741
				'id' => array('type' => 'integer', 'null' => false, 'default' => 0),
742
				'field_two' => array('type' => 'string', 'null' => false, 'length' => 50),
743
			),
744
			'other_table' => array(
745
				'id' => array('type' => 'integer', 'null' => false, 'default' => 0),
746
				'field_two' => array('type' => 'string', 'null' => false, 'length' => 50),
747
			)
748
		));
749
		$result = $this->Dbo->alterSchema($schema2->compare($schema1));
750
		$this->assertEquals(2, substr_count($result, 'field_two'), 'Too many fields');
751
	}
752
753
/**
754
 * testReadTableParameters method

lib/Cake/Test/Case/Model/Datasource/Database/PostgresTest.php 1 location

@@ 918-946 (lines=29) @@
915
 *
916
 * @return void
917
 */
918
	public function testAlteringTwoTables() {
919
		$schema1 = new CakeSchema(array(
920
			'name' => 'AlterTest1',
921
			'connection' => 'test',
922
			'altertest' => array(
923
				'id' => array('type' => 'integer', 'null' => false, 'default' => 0),
924
				'name' => array('type' => 'string', 'null' => false, 'length' => 50),
925
			),
926
			'other_table' => array(
927
				'id' => array('type' => 'integer', 'null' => false, 'default' => 0),
928
				'name' => array('type' => 'string', 'null' => false, 'length' => 50),
929
			)
930
		));
931
		$schema2 = new CakeSchema(array(
932
			'name' => 'AlterTest1',
933
			'connection' => 'test',
934
			'altertest' => array(
935
				'id' => array('type' => 'integer', 'null' => false, 'default' => 0),
936
				'field_two' => array('type' => 'string', 'null' => false, 'length' => 50),
937
			),
938
			'other_table' => array(
939
				'id' => array('type' => 'integer', 'null' => false, 'default' => 0),
940
				'field_two' => array('type' => 'string', 'null' => false, 'length' => 50),
941
			)
942
		));
943
		$result = $this->db->alterSchema($schema2->compare($schema1));
944
		$this->assertEquals(2, substr_count($result, 'field_two'), 'Too many fields');
945
		$this->assertFalse(strpos(';ALTER', $result), 'Too many semi colons');
946
	}
947
948
/**
949
 * test encoding setting.