Code Duplication    Length = 15-18 lines in 4 locations

tests/Doctrine/Tests/DBAL/Platforms/DB2PlatformTest.php 2 locations

@@ 147-164 (lines=18) @@
144
        self::assertEquals('db2', $this->_platform->getName());
145
    }
146
147
    public function testGeneratesCreateTableSQLWithCommonIndexes()
148
    {
149
        $table = new Table('test');
150
        $table->addColumn('id', 'integer');
151
        $table->addColumn('name', 'string', array('length' => 50));
152
        $table->setPrimaryKey(array('id'));
153
        $table->addIndex(array('name'));
154
        $table->addIndex(array('id', 'name'), 'composite_idx');
155
156
        self::assertEquals(
157
            array(
158
                'CREATE TABLE test (id INTEGER NOT NULL, name VARCHAR(50) NOT NULL, PRIMARY KEY(id))',
159
                'CREATE INDEX IDX_D87F7E0C5E237E06 ON test (name)',
160
                'CREATE INDEX composite_idx ON test (id, name)'
161
            ),
162
            $this->_platform->getCreateTableSQL($table)
163
        );
164
    }
165
166
    public function testGeneratesCreateTableSQLWithForeignKeyConstraints()
167
    {
@@ 192-206 (lines=15) @@
189
        );
190
    }
191
192
    public function testGeneratesCreateTableSQLWithCheckConstraints()
193
    {
194
        $table = new Table('test');
195
        $table->addColumn('id', 'integer');
196
        $table->addColumn('check_max', 'integer', array('platformOptions' => array('max' => 10)));
197
        $table->addColumn('check_min', 'integer', array('platformOptions' => array('min' => 10)));
198
        $table->setPrimaryKey(array('id'));
199
200
        self::assertEquals(
201
            array(
202
                'CREATE TABLE test (id INTEGER NOT NULL, check_max INTEGER NOT NULL, check_min INTEGER NOT NULL, PRIMARY KEY(id), CHECK (check_max <= 10), CHECK (check_min >= 10))'
203
            ),
204
            $this->_platform->getCreateTableSQL($table)
205
        );
206
    }
207
208
    public function testGeneratesColumnTypesDeclarationSQL()
209
    {

tests/Doctrine/Tests/DBAL/Platforms/SQLAnywherePlatformTest.php 2 locations

@@ 127-144 (lines=18) @@
124
        self::assertEquals('sqlanywhere', $this->_platform->getName());
125
    }
126
127
    public function testGeneratesCreateTableSQLWithCommonIndexes()
128
    {
129
        $table = new Table('test');
130
        $table->addColumn('id', 'integer');
131
        $table->addColumn('name', 'string', array('length' => 50));
132
        $table->setPrimaryKey(array('id'));
133
        $table->addIndex(array('name'));
134
        $table->addIndex(array('id', 'name'), 'composite_idx');
135
136
        self::assertEquals(
137
            array(
138
                'CREATE TABLE test (id INT NOT NULL, name VARCHAR(50) NOT NULL, PRIMARY KEY (id))',
139
                'CREATE INDEX IDX_D87F7E0C5E237E06 ON test (name)',
140
                'CREATE INDEX composite_idx ON test (id, name)'
141
            ),
142
            $this->_platform->getCreateTableSQL($table)
143
        );
144
    }
145
146
    public function testGeneratesCreateTableSQLWithForeignKeyConstraints()
147
    {
@@ 172-186 (lines=15) @@
169
        );
170
    }
171
172
    public function testGeneratesCreateTableSQLWithCheckConstraints()
173
    {
174
        $table = new Table('test');
175
        $table->addColumn('id', 'integer');
176
        $table->addColumn('check_max', 'integer', array('platformOptions' => array('max' => 10)));
177
        $table->addColumn('check_min', 'integer', array('platformOptions' => array('min' => 10)));
178
        $table->setPrimaryKey(array('id'));
179
180
        self::assertEquals(
181
            array(
182
                'CREATE TABLE test (id INT NOT NULL, check_max INT NOT NULL, check_min INT NOT NULL, PRIMARY KEY (id), CHECK (check_max <= 10), CHECK (check_min >= 10))'
183
            ),
184
            $this->_platform->getCreateTableSQL($table)
185
        );
186
    }
187
188
    public function testGeneratesTableAlterationWithRemovedColumnCommentSql()
189
    {