@@ -166,7 +166,7 @@ |
||
166 | 166 | $paramStr = 'foo'; |
167 | 167 | |
168 | 168 | $sql = "SELECT test_int, test_string FROM " . $this->_conn->quoteIdentifier($table) . " ". |
169 | - "WHERE test_int = " . $this->_conn->quote($paramInt) . " AND test_string = " . $this->_conn->quote($paramStr); |
|
169 | + "WHERE test_int = " . $this->_conn->quote($paramInt) . " AND test_string = " . $this->_conn->quote($paramStr); |
|
170 | 170 | $stmt = $this->_conn->prepare($sql); |
171 | 171 | self::assertInstanceOf('Doctrine\DBAL\Statement', $stmt); |
172 | 172 | } |
@@ -165,7 +165,7 @@ discard block |
||
165 | 165 | $paramInt = 1; |
166 | 166 | $paramStr = 'foo'; |
167 | 167 | |
168 | - $sql = "SELECT test_int, test_string FROM " . $this->_conn->quoteIdentifier($table) . " ". |
|
168 | + $sql = "SELECT test_int, test_string FROM " . $this->_conn->quoteIdentifier($table) . " " . |
|
169 | 169 | "WHERE test_int = " . $this->_conn->quote($paramInt) . " AND test_string = " . $this->_conn->quote($paramStr); |
170 | 170 | $stmt = $this->_conn->prepare($sql); |
171 | 171 | self::assertInstanceOf('Doctrine\DBAL\Statement', $stmt); |
@@ -531,30 +531,30 @@ discard block |
||
531 | 531 | { |
532 | 532 | $p = $this->_conn->getDatabasePlatform(); |
533 | 533 | $sql = 'SELECT '; |
534 | - $sql .= $p->getDateDiffExpression('test_datetime', $p->getCurrentTimestampSQL()) .' AS diff, '; |
|
535 | - $sql .= $p->getDateAddSecondsExpression('test_datetime', 1) .' AS add_seconds, '; |
|
536 | - $sql .= $p->getDateSubSecondsExpression('test_datetime', 1) .' AS sub_seconds, '; |
|
537 | - $sql .= $p->getDateAddMinutesExpression('test_datetime', 5) .' AS add_minutes, '; |
|
538 | - $sql .= $p->getDateSubMinutesExpression('test_datetime', 5) .' AS sub_minutes, '; |
|
539 | - $sql .= $p->getDateAddHourExpression('test_datetime', 3) .' AS add_hour, '; |
|
540 | - $sql .= $p->getDateSubHourExpression('test_datetime', 3) .' AS sub_hour, '; |
|
541 | - $sql .= $p->getDateAddDaysExpression('test_datetime', 10) .' AS add_days, '; |
|
542 | - $sql .= $p->getDateSubDaysExpression('test_datetime', 10) .' AS sub_days, '; |
|
543 | - $sql .= $p->getDateAddWeeksExpression('test_datetime', 1) .' AS add_weeks, '; |
|
544 | - $sql .= $p->getDateSubWeeksExpression('test_datetime', 1) .' AS sub_weeks, '; |
|
545 | - $sql .= $p->getDateAddMonthExpression('test_datetime', 2) .' AS add_month, '; |
|
546 | - $sql .= $p->getDateSubMonthExpression('test_datetime', 2) .' AS sub_month, '; |
|
547 | - $sql .= $p->getDateAddQuartersExpression('test_datetime', 3) .' AS add_quarters, '; |
|
548 | - $sql .= $p->getDateSubQuartersExpression('test_datetime', 3) .' AS sub_quarters, '; |
|
549 | - $sql .= $p->getDateAddYearsExpression('test_datetime', 6) .' AS add_years, '; |
|
550 | - $sql .= $p->getDateSubYearsExpression('test_datetime', 6) .' AS sub_years '; |
|
534 | + $sql .= $p->getDateDiffExpression('test_datetime', $p->getCurrentTimestampSQL()) . ' AS diff, '; |
|
535 | + $sql .= $p->getDateAddSecondsExpression('test_datetime', 1) . ' AS add_seconds, '; |
|
536 | + $sql .= $p->getDateSubSecondsExpression('test_datetime', 1) . ' AS sub_seconds, '; |
|
537 | + $sql .= $p->getDateAddMinutesExpression('test_datetime', 5) . ' AS add_minutes, '; |
|
538 | + $sql .= $p->getDateSubMinutesExpression('test_datetime', 5) . ' AS sub_minutes, '; |
|
539 | + $sql .= $p->getDateAddHourExpression('test_datetime', 3) . ' AS add_hour, '; |
|
540 | + $sql .= $p->getDateSubHourExpression('test_datetime', 3) . ' AS sub_hour, '; |
|
541 | + $sql .= $p->getDateAddDaysExpression('test_datetime', 10) . ' AS add_days, '; |
|
542 | + $sql .= $p->getDateSubDaysExpression('test_datetime', 10) . ' AS sub_days, '; |
|
543 | + $sql .= $p->getDateAddWeeksExpression('test_datetime', 1) . ' AS add_weeks, '; |
|
544 | + $sql .= $p->getDateSubWeeksExpression('test_datetime', 1) . ' AS sub_weeks, '; |
|
545 | + $sql .= $p->getDateAddMonthExpression('test_datetime', 2) . ' AS add_month, '; |
|
546 | + $sql .= $p->getDateSubMonthExpression('test_datetime', 2) . ' AS sub_month, '; |
|
547 | + $sql .= $p->getDateAddQuartersExpression('test_datetime', 3) . ' AS add_quarters, '; |
|
548 | + $sql .= $p->getDateSubQuartersExpression('test_datetime', 3) . ' AS sub_quarters, '; |
|
549 | + $sql .= $p->getDateAddYearsExpression('test_datetime', 6) . ' AS add_years, '; |
|
550 | + $sql .= $p->getDateSubYearsExpression('test_datetime', 6) . ' AS sub_years '; |
|
551 | 551 | $sql .= 'FROM fetch_table'; |
552 | 552 | |
553 | 553 | $row = $this->_conn->fetchAssoc($sql); |
554 | 554 | $row = array_change_key_case($row, CASE_LOWER); |
555 | 555 | |
556 | 556 | $diff = (strtotime('2010-01-01') - strtotime(date('Y-m-d'))) / 3600 / 24; |
557 | - self::assertEquals($diff, $row['diff'], "Date difference should be approx. ".$diff." days.", 1); |
|
557 | + self::assertEquals($diff, $row['diff'], "Date difference should be approx. " . $diff . " days.", 1); |
|
558 | 558 | self::assertEquals('2010-01-01 10:10:11', date('Y-m-d H:i:s', strtotime($row['add_seconds'])), "Adding second should end up on 2010-01-01 10:10:11"); |
559 | 559 | self::assertEquals('2010-01-01 10:10:09', date('Y-m-d H:i:s', strtotime($row['sub_seconds'])), "Subtracting second should end up on 2010-01-01 10:10:09"); |
560 | 560 | self::assertEquals('2010-01-01 10:15:10', date('Y-m-d H:i:s', strtotime($row['add_minutes'])), "Adding minutes should end up on 2010-01-01 10:15:10"); |
@@ -578,15 +578,15 @@ discard block |
||
578 | 578 | $platform = $this->_conn->getDatabasePlatform(); |
579 | 579 | |
580 | 580 | $sql = 'SELECT '; |
581 | - $sql .= $platform->getLocateExpression('test_string', "'oo'") .' AS locate1, '; |
|
582 | - $sql .= $platform->getLocateExpression('test_string', "'foo'") .' AS locate2, '; |
|
583 | - $sql .= $platform->getLocateExpression('test_string', "'bar'") .' AS locate3, '; |
|
584 | - $sql .= $platform->getLocateExpression('test_string', 'test_string') .' AS locate4, '; |
|
585 | - $sql .= $platform->getLocateExpression("'foo'", 'test_string') .' AS locate5, '; |
|
586 | - $sql .= $platform->getLocateExpression("'barfoobaz'", 'test_string') .' AS locate6, '; |
|
587 | - $sql .= $platform->getLocateExpression("'bar'", 'test_string') .' AS locate7, '; |
|
588 | - $sql .= $platform->getLocateExpression('test_string', "'oo'", 2) .' AS locate8, '; |
|
589 | - $sql .= $platform->getLocateExpression('test_string', "'oo'", 3) .' AS locate9 '; |
|
581 | + $sql .= $platform->getLocateExpression('test_string', "'oo'") . ' AS locate1, '; |
|
582 | + $sql .= $platform->getLocateExpression('test_string', "'foo'") . ' AS locate2, '; |
|
583 | + $sql .= $platform->getLocateExpression('test_string', "'bar'") . ' AS locate3, '; |
|
584 | + $sql .= $platform->getLocateExpression('test_string', 'test_string') . ' AS locate4, '; |
|
585 | + $sql .= $platform->getLocateExpression("'foo'", 'test_string') . ' AS locate5, '; |
|
586 | + $sql .= $platform->getLocateExpression("'barfoobaz'", 'test_string') . ' AS locate6, '; |
|
587 | + $sql .= $platform->getLocateExpression("'bar'", 'test_string') . ' AS locate7, '; |
|
588 | + $sql .= $platform->getLocateExpression('test_string', "'oo'", 2) . ' AS locate8, '; |
|
589 | + $sql .= $platform->getLocateExpression('test_string', "'oo'", 3) . ' AS locate9 '; |
|
590 | 590 | $sql .= 'FROM fetch_table'; |
591 | 591 | |
592 | 592 | $row = $this->_conn->fetchAssoc($sql); |
@@ -717,11 +717,11 @@ discard block |
||
717 | 717 | |
718 | 718 | $results = $stmt->fetchAll( |
719 | 719 | FetchMode::CUSTOM_OBJECT, |
720 | - __NAMESPACE__.'\\MyFetchClass' |
|
720 | + __NAMESPACE__ . '\\MyFetchClass' |
|
721 | 721 | ); |
722 | 722 | |
723 | 723 | self::assertCount(1, $results); |
724 | - self::assertInstanceOf(__NAMESPACE__.'\\MyFetchClass', $results[0]); |
|
724 | + self::assertInstanceOf(__NAMESPACE__ . '\\MyFetchClass', $results[0]); |
|
725 | 725 | |
726 | 726 | self::assertEquals(1, $results[0]->test_int); |
727 | 727 | self::assertEquals('foo', $results[0]->test_string); |
@@ -760,7 +760,7 @@ discard block |
||
760 | 760 | $results = $stmt->fetchAll(); |
761 | 761 | |
762 | 762 | self::assertCount(1, $results); |
763 | - self::assertInstanceOf(__NAMESPACE__.'\\MyFetchClass', $results[0]); |
|
763 | + self::assertInstanceOf(__NAMESPACE__ . '\\MyFetchClass', $results[0]); |
|
764 | 764 | |
765 | 765 | self::assertEquals(1, $results[0]->test_int); |
766 | 766 | self::assertEquals('foo', $results[0]->test_string); |
@@ -785,7 +785,7 @@ discard block |
||
785 | 785 | } |
786 | 786 | |
787 | 787 | self::assertCount(1, $results); |
788 | - self::assertInstanceOf(__NAMESPACE__.'\\MyFetchClass', $results[0]); |
|
788 | + self::assertInstanceOf(__NAMESPACE__ . '\\MyFetchClass', $results[0]); |
|
789 | 789 | |
790 | 790 | self::assertEquals(1, $results[0]->test_int); |
791 | 791 | self::assertEquals('foo', $results[0]->test_string); |
@@ -885,7 +885,7 @@ discard block |
||
885 | 885 | |
886 | 886 | private function skipOci8AndMysqli() |
887 | 887 | { |
888 | - if (isset($GLOBALS['db_type']) && $GLOBALS['db_type'] == "oci8") { |
|
888 | + if (isset($GLOBALS['db_type']) && $GLOBALS['db_type'] == "oci8") { |
|
889 | 889 | $this->markTestSkipped("Not supported by OCI8"); |
890 | 890 | } |
891 | 891 | if ('mysqli' == $this->_conn->getDriver()->getName()) { |
@@ -95,9 +95,9 @@ |
||
95 | 95 | $this->_conn->insert('modify_limit_table2', array('test_int' => 2)); |
96 | 96 | |
97 | 97 | $sql = "SELECT modify_limit_table.test_int FROM modify_limit_table " . |
98 | - "INNER JOIN modify_limit_table2 ON modify_limit_table.test_int = modify_limit_table2.test_int ". |
|
99 | - "GROUP BY modify_limit_table.test_int " . |
|
100 | - "ORDER BY modify_limit_table.test_int ASC"; |
|
98 | + "INNER JOIN modify_limit_table2 ON modify_limit_table.test_int = modify_limit_table2.test_int ". |
|
99 | + "GROUP BY modify_limit_table.test_int " . |
|
100 | + "ORDER BY modify_limit_table.test_int ASC"; |
|
101 | 101 | $this->assertLimitResult(array(1, 2), $sql, 10, 0); |
102 | 102 | $this->assertLimitResult(array(1), $sql, 1, 0); |
103 | 103 | $this->assertLimitResult(array(2), $sql, 1, 1); |
@@ -16,7 +16,7 @@ discard block |
||
16 | 16 | { |
17 | 17 | parent::setUp(); |
18 | 18 | |
19 | - if (!self::$tableCreated) { |
|
19 | + if ( ! self::$tableCreated) { |
|
20 | 20 | /* @var $sm \Doctrine\DBAL\Schema\AbstractSchemaManager */ |
21 | 21 | $table = new \Doctrine\DBAL\Schema\Table("modify_limit_table"); |
22 | 22 | $table->addColumn('test_int', 'integer'); |
@@ -95,7 +95,7 @@ discard block |
||
95 | 95 | $this->_conn->insert('modify_limit_table2', array('test_int' => 2)); |
96 | 96 | |
97 | 97 | $sql = "SELECT modify_limit_table.test_int FROM modify_limit_table " . |
98 | - "INNER JOIN modify_limit_table2 ON modify_limit_table.test_int = modify_limit_table2.test_int ". |
|
98 | + "INNER JOIN modify_limit_table2 ON modify_limit_table.test_int = modify_limit_table2.test_int " . |
|
99 | 99 | "GROUP BY modify_limit_table.test_int " . |
100 | 100 | "ORDER BY modify_limit_table.test_int ASC"; |
101 | 101 | $this->assertLimitResult(array(1, 2), $sql, 10, 0); |
@@ -265,19 +265,19 @@ |
||
265 | 265 | { |
266 | 266 | return array( |
267 | 267 | 'fetch' => array( |
268 | - function (Statement $stmt) { |
|
268 | + function(Statement $stmt) { |
|
269 | 269 | return $stmt->fetch(); |
270 | 270 | }, |
271 | 271 | false, |
272 | 272 | ), |
273 | 273 | 'fetch-column' => array( |
274 | - function (Statement $stmt) { |
|
274 | + function(Statement $stmt) { |
|
275 | 275 | return $stmt->fetchColumn(); |
276 | 276 | }, |
277 | 277 | false, |
278 | 278 | ), |
279 | 279 | 'fetch-all' => array( |
280 | - function (Statement $stmt) { |
|
280 | + function(Statement $stmt) { |
|
281 | 281 | return $stmt->fetchAll(); |
282 | 282 | }, |
283 | 283 | array(), |
@@ -103,18 +103,18 @@ discard block |
||
103 | 103 | |
104 | 104 | $stmt = $conn->query('SELECT * FROM portability_table'); |
105 | 105 | foreach ($stmt as $row) { |
106 | - $this->assertFetchResultRow($row); |
|
106 | + $this->assertFetchResultRow($row); |
|
107 | 107 | } |
108 | 108 | |
109 | 109 | $stmt = $conn->query('SELECT * FROM portability_table'); |
110 | 110 | while (($row = $stmt->fetch())) { |
111 | - $this->assertFetchResultRow($row); |
|
111 | + $this->assertFetchResultRow($row); |
|
112 | 112 | } |
113 | 113 | |
114 | 114 | $stmt = $conn->prepare('SELECT * FROM portability_table'); |
115 | 115 | $stmt->execute(); |
116 | 116 | while (($row = $stmt->fetch())) { |
117 | - $this->assertFetchResultRow($row); |
|
117 | + $this->assertFetchResultRow($row); |
|
118 | 118 | } |
119 | 119 | } |
120 | 120 | |
@@ -150,8 +150,8 @@ discard block |
||
150 | 150 | ->getMock(); |
151 | 151 | |
152 | 152 | $driverMock->expects($this->once()) |
153 | - ->method('connect') |
|
154 | - ->will($this->returnValue(null)); |
|
153 | + ->method('connect') |
|
154 | + ->will($this->returnValue(null)); |
|
155 | 155 | |
156 | 156 | $connection = new ConnectionPortability($params, $driverMock); |
157 | 157 |
@@ -37,7 +37,7 @@ discard block |
||
37 | 37 | $portabilityMode = ConnectionPortability::PORTABILITY_ALL, |
38 | 38 | $case = ColumnCase::LOWER |
39 | 39 | ) { |
40 | - if (!$this->portableConnection) { |
|
40 | + if ( ! $this->portableConnection) { |
|
41 | 41 | $params = $this->_conn->getParams(); |
42 | 42 | |
43 | 43 | $params['wrapperClass'] = ConnectionPortability::class; |
@@ -59,7 +59,7 @@ discard block |
||
59 | 59 | |
60 | 60 | $this->portableConnection->insert('portability_table', array('Test_Int' => 1, 'Test_String' => 'foo', 'Test_Null' => '')); |
61 | 61 | $this->portableConnection->insert('portability_table', array('Test_Int' => 2, 'Test_String' => 'foo ', 'Test_Null' => null)); |
62 | - } catch(\Exception $e) { |
|
62 | + } catch (\Exception $e) { |
|
63 | 63 | |
64 | 64 | } |
65 | 65 | } |
@@ -66,7 +66,7 @@ discard block |
||
66 | 66 | |
67 | 67 | public function testTransactionNestingBehaviorWithSavepoints() |
68 | 68 | { |
69 | - if (!$this->_conn->getDatabasePlatform()->supportsSavepoints()) { |
|
69 | + if ( ! $this->_conn->getDatabasePlatform()->supportsSavepoints()) { |
|
70 | 70 | $this->markTestSkipped('This test requires the platform to support savepoints.'); |
71 | 71 | } |
72 | 72 | |
@@ -105,7 +105,7 @@ discard block |
||
105 | 105 | |
106 | 106 | public function testTransactionNestingBehaviorCantBeChangedInActiveTransaction() |
107 | 107 | { |
108 | - if (!$this->_conn->getDatabasePlatform()->supportsSavepoints()) { |
|
108 | + if ( ! $this->_conn->getDatabasePlatform()->supportsSavepoints()) { |
|
109 | 109 | $this->markTestSkipped('This test requires the platform to support savepoints.'); |
110 | 110 | } |
111 | 111 |
@@ -141,7 +141,7 @@ |
||
141 | 141 | $options = is_array($url) ? $url : ['url' => $url]; |
142 | 142 | |
143 | 143 | if (isset($options['pdo'])) { |
144 | - if (! extension_loaded('pdo')) { |
|
144 | + if ( ! extension_loaded('pdo')) { |
|
145 | 145 | $this->markTestSkipped('PDO is not installed'); |
146 | 146 | } |
147 | 147 |
@@ -1,6 +1,6 @@ |
||
1 | 1 | <?php |
2 | 2 | |
3 | -declare(strict_types=1); |
|
3 | +declare(strict_types = 1); |
|
4 | 4 | |
5 | 5 | namespace Doctrine\Tests\DBAL\Schema; |
6 | 6 |
@@ -46,76 +46,76 @@ discard block |
||
46 | 46 | { |
47 | 47 | public function testCompareSame1() |
48 | 48 | { |
49 | - $schema1 = new Schema( array( |
|
49 | + $schema1 = new Schema(array( |
|
50 | 50 | 'bugdb' => new Table('bugdb', |
51 | - array ( |
|
52 | - 'integerfield1' => new Column('integerfield1', Type::getType('integer' ) ), |
|
51 | + array( |
|
52 | + 'integerfield1' => new Column('integerfield1', Type::getType('integer')), |
|
53 | 53 | ) |
54 | 54 | ), |
55 | - ) ); |
|
56 | - $schema2 = new Schema( array( |
|
55 | + )); |
|
56 | + $schema2 = new Schema(array( |
|
57 | 57 | 'bugdb' => new Table('bugdb', |
58 | - array ( |
|
59 | - 'integerfield1' => new Column('integerfield1', Type::getType('integer') ), |
|
58 | + array( |
|
59 | + 'integerfield1' => new Column('integerfield1', Type::getType('integer')), |
|
60 | 60 | ) |
61 | 61 | ), |
62 | - ) ); |
|
62 | + )); |
|
63 | 63 | |
64 | 64 | $expected = new SchemaDiff(); |
65 | 65 | $expected->fromSchema = $schema1; |
66 | - self::assertEquals($expected, Comparator::compareSchemas( $schema1, $schema2 ) ); |
|
66 | + self::assertEquals($expected, Comparator::compareSchemas($schema1, $schema2)); |
|
67 | 67 | } |
68 | 68 | |
69 | 69 | public function testCompareSame2() |
70 | 70 | { |
71 | - $schema1 = new Schema( array( |
|
71 | + $schema1 = new Schema(array( |
|
72 | 72 | 'bugdb' => new Table('bugdb', |
73 | - array ( |
|
73 | + array( |
|
74 | 74 | 'integerfield1' => new Column('integerfield1', Type::getType('integer')), |
75 | 75 | 'integerfield2' => new Column('integerfield2', Type::getType('integer')), |
76 | 76 | ) |
77 | 77 | ), |
78 | - ) ); |
|
79 | - $schema2 = new Schema( array( |
|
78 | + )); |
|
79 | + $schema2 = new Schema(array( |
|
80 | 80 | 'bugdb' => new Table('bugdb', |
81 | - array ( |
|
81 | + array( |
|
82 | 82 | 'integerfield2' => new Column('integerfield2', Type::getType('integer')), |
83 | 83 | 'integerfield1' => new Column('integerfield1', Type::getType('integer')), |
84 | 84 | ) |
85 | 85 | ), |
86 | - ) ); |
|
86 | + )); |
|
87 | 87 | |
88 | 88 | $expected = new SchemaDiff(); |
89 | 89 | $expected->fromSchema = $schema1; |
90 | - self::assertEquals($expected, Comparator::compareSchemas( $schema1, $schema2 ) ); |
|
90 | + self::assertEquals($expected, Comparator::compareSchemas($schema1, $schema2)); |
|
91 | 91 | } |
92 | 92 | |
93 | 93 | public function testCompareMissingTable() |
94 | 94 | { |
95 | 95 | $schemaConfig = new \Doctrine\DBAL\Schema\SchemaConfig; |
96 | - $table = new Table('bugdb', array ('integerfield1' => new Column('integerfield1', Type::getType('integer')))); |
|
96 | + $table = new Table('bugdb', array('integerfield1' => new Column('integerfield1', Type::getType('integer')))); |
|
97 | 97 | $table->setSchemaConfig($schemaConfig); |
98 | 98 | |
99 | - $schema1 = new Schema( array($table), array(), $schemaConfig ); |
|
100 | - $schema2 = new Schema( array(), array(), $schemaConfig ); |
|
99 | + $schema1 = new Schema(array($table), array(), $schemaConfig); |
|
100 | + $schema2 = new Schema(array(), array(), $schemaConfig); |
|
101 | 101 | |
102 | - $expected = new SchemaDiff( array(), array(), array('bugdb' => $table), $schema1 ); |
|
102 | + $expected = new SchemaDiff(array(), array(), array('bugdb' => $table), $schema1); |
|
103 | 103 | |
104 | - self::assertEquals($expected, Comparator::compareSchemas( $schema1, $schema2 ) ); |
|
104 | + self::assertEquals($expected, Comparator::compareSchemas($schema1, $schema2)); |
|
105 | 105 | } |
106 | 106 | |
107 | 107 | public function testCompareNewTable() |
108 | 108 | { |
109 | 109 | $schemaConfig = new \Doctrine\DBAL\Schema\SchemaConfig; |
110 | - $table = new Table('bugdb', array ('integerfield1' => new Column('integerfield1', Type::getType('integer')))); |
|
110 | + $table = new Table('bugdb', array('integerfield1' => new Column('integerfield1', Type::getType('integer')))); |
|
111 | 111 | $table->setSchemaConfig($schemaConfig); |
112 | 112 | |
113 | - $schema1 = new Schema( array(), array(), $schemaConfig ); |
|
114 | - $schema2 = new Schema( array($table), array(), $schemaConfig ); |
|
113 | + $schema1 = new Schema(array(), array(), $schemaConfig); |
|
114 | + $schema2 = new Schema(array($table), array(), $schemaConfig); |
|
115 | 115 | |
116 | - $expected = new SchemaDiff( array('bugdb' => $table), array(), array(), $schema1 ); |
|
116 | + $expected = new SchemaDiff(array('bugdb' => $table), array(), array(), $schema1); |
|
117 | 117 | |
118 | - self::assertEquals($expected, Comparator::compareSchemas( $schema1, $schema2 ) ); |
|
118 | + self::assertEquals($expected, Comparator::compareSchemas($schema1, $schema2)); |
|
119 | 119 | } |
120 | 120 | |
121 | 121 | public function testCompareOnlyAutoincrementChanged() |
@@ -132,26 +132,26 @@ discard block |
||
132 | 132 | public function testCompareMissingField() |
133 | 133 | { |
134 | 134 | $missingColumn = new Column('integerfield1', Type::getType('integer')); |
135 | - $schema1 = new Schema( array( |
|
135 | + $schema1 = new Schema(array( |
|
136 | 136 | 'bugdb' => new Table('bugdb', |
137 | - array ( |
|
137 | + array( |
|
138 | 138 | 'integerfield1' => $missingColumn, |
139 | 139 | 'integerfield2' => new Column('integerfield2', Type::getType('integer')), |
140 | 140 | ) |
141 | 141 | ), |
142 | - ) ); |
|
143 | - $schema2 = new Schema( array( |
|
142 | + )); |
|
143 | + $schema2 = new Schema(array( |
|
144 | 144 | 'bugdb' => new Table('bugdb', |
145 | - array ( |
|
145 | + array( |
|
146 | 146 | 'integerfield2' => new Column('integerfield2', Type::getType('integer')), |
147 | 147 | ) |
148 | 148 | ), |
149 | - ) ); |
|
149 | + )); |
|
150 | 150 | |
151 | - $expected = new SchemaDiff ( array(), |
|
152 | - array ( |
|
153 | - 'bugdb' => new TableDiff( 'bugdb', array(), array(), |
|
154 | - array ( |
|
151 | + $expected = new SchemaDiff(array(), |
|
152 | + array( |
|
153 | + 'bugdb' => new TableDiff('bugdb', array(), array(), |
|
154 | + array( |
|
155 | 155 | 'integerfield1' => $missingColumn, |
156 | 156 | ) |
157 | 157 | ) |
@@ -160,31 +160,31 @@ discard block |
||
160 | 160 | $expected->fromSchema = $schema1; |
161 | 161 | $expected->changedTables['bugdb']->fromTable = $schema1->getTable('bugdb'); |
162 | 162 | |
163 | - self::assertEquals($expected, Comparator::compareSchemas( $schema1, $schema2 ) ); |
|
163 | + self::assertEquals($expected, Comparator::compareSchemas($schema1, $schema2)); |
|
164 | 164 | } |
165 | 165 | |
166 | 166 | public function testCompareNewField() |
167 | 167 | { |
168 | - $schema1 = new Schema( array( |
|
168 | + $schema1 = new Schema(array( |
|
169 | 169 | 'bugdb' => new Table('bugdb', |
170 | - array ( |
|
170 | + array( |
|
171 | 171 | 'integerfield1' => new Column('integerfield1', Type::getType('integer')), |
172 | 172 | ) |
173 | 173 | ), |
174 | - ) ); |
|
175 | - $schema2 = new Schema( array( |
|
174 | + )); |
|
175 | + $schema2 = new Schema(array( |
|
176 | 176 | 'bugdb' => new Table('bugdb', |
177 | - array ( |
|
177 | + array( |
|
178 | 178 | 'integerfield1' => new Column('integerfield1', Type::getType('integer')), |
179 | 179 | 'integerfield2' => new Column('integerfield2', Type::getType('integer')), |
180 | 180 | ) |
181 | 181 | ), |
182 | - ) ); |
|
182 | + )); |
|
183 | 183 | |
184 | - $expected = new SchemaDiff ( array(), |
|
185 | - array ( |
|
186 | - 'bugdb' => new TableDiff ('bugdb', |
|
187 | - array ( |
|
184 | + $expected = new SchemaDiff(array(), |
|
185 | + array( |
|
186 | + 'bugdb' => new TableDiff('bugdb', |
|
187 | + array( |
|
188 | 188 | 'integerfield2' => new Column('integerfield2', Type::getType('integer')), |
189 | 189 | ) |
190 | 190 | ), |
@@ -193,7 +193,7 @@ discard block |
||
193 | 193 | $expected->fromSchema = $schema1; |
194 | 194 | $expected->changedTables['bugdb']->fromTable = $schema1->getTable('bugdb'); |
195 | 195 | |
196 | - self::assertEquals($expected, Comparator::compareSchemas( $schema1, $schema2 ) ); |
|
196 | + self::assertEquals($expected, Comparator::compareSchemas($schema1, $schema2)); |
|
197 | 197 | } |
198 | 198 | |
199 | 199 | public function testCompareChangedColumns_ChangeType() |
@@ -244,13 +244,13 @@ discard block |
||
244 | 244 | |
245 | 245 | public function testCompareRemovedIndex() |
246 | 246 | { |
247 | - $schema1 = new Schema( array( |
|
247 | + $schema1 = new Schema(array( |
|
248 | 248 | 'bugdb' => new Table('bugdb', |
249 | - array ( |
|
249 | + array( |
|
250 | 250 | 'integerfield1' => new Column('integerfield1', Type::getType('integer')), |
251 | 251 | 'integerfield2' => new Column('integerfield2', Type::getType('integer')), |
252 | 252 | ), |
253 | - array ( |
|
253 | + array( |
|
254 | 254 | 'primary' => new Index('primary', |
255 | 255 | array( |
256 | 256 | 'integerfield1' |
@@ -259,20 +259,20 @@ discard block |
||
259 | 259 | ) |
260 | 260 | ) |
261 | 261 | ), |
262 | - ) ); |
|
263 | - $schema2 = new Schema( array( |
|
262 | + )); |
|
263 | + $schema2 = new Schema(array( |
|
264 | 264 | 'bugdb' => new Table('bugdb', |
265 | - array ( |
|
265 | + array( |
|
266 | 266 | 'integerfield1' => new Column('integerfield1', Type::getType('integer')), |
267 | 267 | 'integerfield2' => new Column('integerfield2', Type::getType('integer')), |
268 | 268 | ) |
269 | 269 | ), |
270 | - ) ); |
|
270 | + )); |
|
271 | 271 | |
272 | - $expected = new SchemaDiff ( array(), |
|
273 | - array ( |
|
274 | - 'bugdb' => new TableDiff( 'bugdb', array(), array(), array(), array(), array(), |
|
275 | - array ( |
|
272 | + $expected = new SchemaDiff(array(), |
|
273 | + array( |
|
274 | + 'bugdb' => new TableDiff('bugdb', array(), array(), array(), array(), array(), |
|
275 | + array( |
|
276 | 276 | 'primary' => new Index('primary', |
277 | 277 | array( |
278 | 278 | 'integerfield1' |
@@ -286,26 +286,26 @@ discard block |
||
286 | 286 | $expected->fromSchema = $schema1; |
287 | 287 | $expected->changedTables['bugdb']->fromTable = $schema1->getTable('bugdb'); |
288 | 288 | |
289 | - self::assertEquals($expected, Comparator::compareSchemas( $schema1, $schema2 ) ); |
|
289 | + self::assertEquals($expected, Comparator::compareSchemas($schema1, $schema2)); |
|
290 | 290 | } |
291 | 291 | |
292 | 292 | public function testCompareNewIndex() |
293 | 293 | { |
294 | - $schema1 = new Schema( array( |
|
294 | + $schema1 = new Schema(array( |
|
295 | 295 | 'bugdb' => new Table('bugdb', |
296 | - array ( |
|
296 | + array( |
|
297 | 297 | 'integerfield1' => new Column('integerfield1', Type::getType('integer')), |
298 | 298 | 'integerfield2' => new Column('integerfield2', Type::getType('integer')), |
299 | 299 | ) |
300 | 300 | ), |
301 | - ) ); |
|
302 | - $schema2 = new Schema( array( |
|
301 | + )); |
|
302 | + $schema2 = new Schema(array( |
|
303 | 303 | 'bugdb' => new Table('bugdb', |
304 | - array ( |
|
304 | + array( |
|
305 | 305 | 'integerfield1' => new Column('integerfield1', Type::getType('integer')), |
306 | 306 | 'integerfield2' => new Column('integerfield2', Type::getType('integer')), |
307 | 307 | ), |
308 | - array ( |
|
308 | + array( |
|
309 | 309 | 'primary' => new Index('primary', |
310 | 310 | array( |
311 | 311 | 'integerfield1' |
@@ -314,12 +314,12 @@ discard block |
||
314 | 314 | ) |
315 | 315 | ) |
316 | 316 | ), |
317 | - ) ); |
|
317 | + )); |
|
318 | 318 | |
319 | - $expected = new SchemaDiff ( array(), |
|
320 | - array ( |
|
321 | - 'bugdb' => new TableDiff( 'bugdb', array(), array(), array(), |
|
322 | - array ( |
|
319 | + $expected = new SchemaDiff(array(), |
|
320 | + array( |
|
321 | + 'bugdb' => new TableDiff('bugdb', array(), array(), array(), |
|
322 | + array( |
|
323 | 323 | 'primary' => new Index('primary', |
324 | 324 | array( |
325 | 325 | 'integerfield1' |
@@ -333,18 +333,18 @@ discard block |
||
333 | 333 | $expected->fromSchema = $schema1; |
334 | 334 | $expected->changedTables['bugdb']->fromTable = $schema1->getTable('bugdb'); |
335 | 335 | |
336 | - self::assertEquals($expected, Comparator::compareSchemas( $schema1, $schema2 ) ); |
|
336 | + self::assertEquals($expected, Comparator::compareSchemas($schema1, $schema2)); |
|
337 | 337 | } |
338 | 338 | |
339 | 339 | public function testCompareChangedIndex() |
340 | 340 | { |
341 | - $schema1 = new Schema( array( |
|
341 | + $schema1 = new Schema(array( |
|
342 | 342 | 'bugdb' => new Table('bugdb', |
343 | - array ( |
|
343 | + array( |
|
344 | 344 | 'integerfield1' => new Column('integerfield1', Type::getType('integer')), |
345 | 345 | 'integerfield2' => new Column('integerfield2', Type::getType('integer')), |
346 | 346 | ), |
347 | - array ( |
|
347 | + array( |
|
348 | 348 | 'primary' => new Index('primary', |
349 | 349 | array( |
350 | 350 | 'integerfield1' |
@@ -353,26 +353,26 @@ discard block |
||
353 | 353 | ) |
354 | 354 | ) |
355 | 355 | ), |
356 | - ) ); |
|
357 | - $schema2 = new Schema( array( |
|
356 | + )); |
|
357 | + $schema2 = new Schema(array( |
|
358 | 358 | 'bugdb' => new Table('bugdb', |
359 | - array ( |
|
359 | + array( |
|
360 | 360 | 'integerfield1' => new Column('integerfield1', Type::getType('integer')), |
361 | 361 | 'integerfield2' => new Column('integerfield2', Type::getType('integer')), |
362 | 362 | ), |
363 | - array ( |
|
363 | + array( |
|
364 | 364 | 'primary' => new Index('primary', |
365 | 365 | array('integerfield1', 'integerfield2'), |
366 | 366 | true |
367 | 367 | ) |
368 | 368 | ) |
369 | 369 | ), |
370 | - ) ); |
|
370 | + )); |
|
371 | 371 | |
372 | - $expected = new SchemaDiff ( array(), |
|
373 | - array ( |
|
374 | - 'bugdb' => new TableDiff( 'bugdb', array(), array(), array(), array(), |
|
375 | - array ( |
|
372 | + $expected = new SchemaDiff(array(), |
|
373 | + array( |
|
374 | + 'bugdb' => new TableDiff('bugdb', array(), array(), array(), array(), |
|
375 | + array( |
|
376 | 376 | 'primary' => new Index('primary', |
377 | 377 | array( |
378 | 378 | 'integerfield1', |
@@ -387,38 +387,38 @@ discard block |
||
387 | 387 | $expected->fromSchema = $schema1; |
388 | 388 | $expected->changedTables['bugdb']->fromTable = $schema1->getTable('bugdb'); |
389 | 389 | |
390 | - self::assertEquals($expected, Comparator::compareSchemas( $schema1, $schema2 )); |
|
390 | + self::assertEquals($expected, Comparator::compareSchemas($schema1, $schema2)); |
|
391 | 391 | } |
392 | 392 | |
393 | 393 | public function testCompareChangedIndexFieldPositions() |
394 | 394 | { |
395 | - $schema1 = new Schema( array( |
|
395 | + $schema1 = new Schema(array( |
|
396 | 396 | 'bugdb' => new Table('bugdb', |
397 | - array ( |
|
397 | + array( |
|
398 | 398 | 'integerfield1' => new Column('integerfield1', Type::getType('integer')), |
399 | 399 | 'integerfield2' => new Column('integerfield2', Type::getType('integer')), |
400 | 400 | ), |
401 | - array ( |
|
401 | + array( |
|
402 | 402 | 'primary' => new Index('primary', array('integerfield1', 'integerfield2'), true) |
403 | 403 | ) |
404 | 404 | ), |
405 | - ) ); |
|
406 | - $schema2 = new Schema( array( |
|
405 | + )); |
|
406 | + $schema2 = new Schema(array( |
|
407 | 407 | 'bugdb' => new Table('bugdb', |
408 | - array ( |
|
408 | + array( |
|
409 | 409 | 'integerfield1' => new Column('integerfield1', Type::getType('integer')), |
410 | 410 | 'integerfield2' => new Column('integerfield2', Type::getType('integer')), |
411 | 411 | ), |
412 | - array ( |
|
412 | + array( |
|
413 | 413 | 'primary' => new Index('primary', array('integerfield2', 'integerfield1'), true) |
414 | 414 | ) |
415 | 415 | ), |
416 | - ) ); |
|
416 | + )); |
|
417 | 417 | |
418 | - $expected = new SchemaDiff ( array(), |
|
419 | - array ( |
|
418 | + $expected = new SchemaDiff(array(), |
|
419 | + array( |
|
420 | 420 | 'bugdb' => new TableDiff('bugdb', array(), array(), array(), array(), |
421 | - array ( |
|
421 | + array( |
|
422 | 422 | 'primary' => new Index('primary', array('integerfield2', 'integerfield1'), true) |
423 | 423 | ) |
424 | 424 | ), |
@@ -427,7 +427,7 @@ discard block |
||
427 | 427 | $expected->fromSchema = $schema1; |
428 | 428 | $expected->changedTables['bugdb']->fromTable = $schema1->getTable('bugdb'); |
429 | 429 | |
430 | - self::assertEquals($expected, Comparator::compareSchemas( $schema1, $schema2 )); |
|
430 | + self::assertEquals($expected, Comparator::compareSchemas($schema1, $schema2)); |
|
431 | 431 | } |
432 | 432 | |
433 | 433 | public function testCompareSequences() |
@@ -821,7 +821,7 @@ discard block |
||
821 | 821 | $c = new \Doctrine\DBAL\Schema\Comparator; |
822 | 822 | $diff = $c->compare($schema, $schemaNew); |
823 | 823 | |
824 | - self::assertSame($diff->changedSequences[0] , $schemaNew->getSequence('baz')); |
|
824 | + self::assertSame($diff->changedSequences[0], $schemaNew->getSequence('baz')); |
|
825 | 825 | } |
826 | 826 | |
827 | 827 | /** |
@@ -849,7 +849,7 @@ discard block |
||
849 | 849 | $oldSchema = new Schema(array(), array(), $config); |
850 | 850 | $oldSchema->createTable('bar'); |
851 | 851 | |
852 | - $newSchema= new Schema(array(), array(), $config); |
|
852 | + $newSchema = new Schema(array(), array(), $config); |
|
853 | 853 | $newSchema->createTable('foo.bar'); |
854 | 854 | |
855 | 855 | $expected = new SchemaDiff(); |
@@ -870,7 +870,7 @@ discard block |
||
870 | 870 | $oldSchema->createTable('taz'); |
871 | 871 | $oldSchema->createTable('war.tab'); |
872 | 872 | |
873 | - $newSchema= new Schema(array(), array(), $config); |
|
873 | + $newSchema = new Schema(array(), array(), $config); |
|
874 | 874 | $newSchema->createTable('bar.tab'); |
875 | 875 | $newSchema->createTable('baz.tab'); |
876 | 876 | $newSchema->createTable('war.tab'); |
@@ -1072,7 +1072,7 @@ discard block |
||
1072 | 1072 | * @param int $changeTableCount |
1073 | 1073 | * @param int $removeTableCount |
1074 | 1074 | */ |
1075 | - public function assertSchemaTableChangeCount($diff, $newTableCount=0, $changeTableCount=0, $removeTableCount=0) |
|
1075 | + public function assertSchemaTableChangeCount($diff, $newTableCount = 0, $changeTableCount = 0, $removeTableCount = 0) |
|
1076 | 1076 | { |
1077 | 1077 | self::assertCount($newTableCount, $diff->newTables); |
1078 | 1078 | self::assertCount($changeTableCount, $diff->changedTables); |
@@ -1085,7 +1085,7 @@ discard block |
||
1085 | 1085 | * @param int $changeSequenceCount |
1086 | 1086 | * @param int $changeSequenceCount |
1087 | 1087 | */ |
1088 | - public function assertSchemaSequenceChangeCount($diff, $newSequenceCount=0, $changeSequenceCount=0, $removeSequenceCount=0) |
|
1088 | + public function assertSchemaSequenceChangeCount($diff, $newSequenceCount = 0, $changeSequenceCount = 0, $removeSequenceCount = 0) |
|
1089 | 1089 | { |
1090 | 1090 | self::assertCount($newSequenceCount, $diff->newSequences, "Expected number of new sequences is wrong."); |
1091 | 1091 | self::assertCount($changeSequenceCount, $diff->changedSequences, "Expected number of changed sequences is wrong."); |
@@ -1240,7 +1240,7 @@ discard block |
||
1240 | 1240 | |
1241 | 1241 | public function testForeignKeyRemovalWithRenamedLocalColumn() |
1242 | 1242 | { |
1243 | - $fromSchema = new Schema( array( |
|
1243 | + $fromSchema = new Schema(array( |
|
1244 | 1244 | 'table1' => new Table('table1', |
1245 | 1245 | array( |
1246 | 1246 | 'id' => new Column('id', Type::getType('integer')), |
@@ -1255,7 +1255,7 @@ discard block |
||
1255 | 1255 | new ForeignKeyConstraint(array('id_table1'), 'table1', array('id'), 'fk_table2_table1') |
1256 | 1256 | )) |
1257 | 1257 | )); |
1258 | - $toSchema = new Schema( array( |
|
1258 | + $toSchema = new Schema(array( |
|
1259 | 1259 | 'table2' => new Table('table2', |
1260 | 1260 | array( |
1261 | 1261 | 'id' => new Column('id', Type::getType('integer')), |
@@ -12,14 +12,14 @@ discard block |
||
12 | 12 | ->setMethods(array('getCreateTableSql', 'getCreateSequenceSql', 'getCreateForeignKeySql')) |
13 | 13 | ->getMock(); |
14 | 14 | $platformMock->expects($this->exactly(2)) |
15 | - ->method('getCreateTableSql') |
|
16 | - ->will($this->returnValue(array("foo"))); |
|
15 | + ->method('getCreateTableSql') |
|
16 | + ->will($this->returnValue(array("foo"))); |
|
17 | 17 | $platformMock->expects($this->exactly(1)) |
18 | - ->method('getCreateSequenceSql') |
|
19 | - ->will($this->returnValue("bar")); |
|
18 | + ->method('getCreateSequenceSql') |
|
19 | + ->will($this->returnValue("bar")); |
|
20 | 20 | $platformMock->expects($this->exactly(1)) |
21 | - ->method('getCreateForeignKeySql') |
|
22 | - ->will($this->returnValue("baz")); |
|
21 | + ->method('getCreateForeignKeySql') |
|
22 | + ->will($this->returnValue("baz")); |
|
23 | 23 | |
24 | 24 | $schema = $this->createFixtureSchema(); |
25 | 25 | |
@@ -34,14 +34,14 @@ discard block |
||
34 | 34 | ->setMethods(array('getDropTableSql', 'getDropSequenceSql', 'getDropForeignKeySql')) |
35 | 35 | ->getMock(); |
36 | 36 | $platformMock->expects($this->exactly(2)) |
37 | - ->method('getDropTableSql') |
|
38 | - ->will($this->returnValue("tbl")); |
|
37 | + ->method('getDropTableSql') |
|
38 | + ->will($this->returnValue("tbl")); |
|
39 | 39 | $platformMock->expects($this->exactly(1)) |
40 | - ->method('getDropSequenceSql') |
|
41 | - ->will($this->returnValue("seq")); |
|
40 | + ->method('getDropSequenceSql') |
|
41 | + ->will($this->returnValue("seq")); |
|
42 | 42 | $platformMock->expects($this->exactly(1)) |
43 | - ->method('getDropForeignKeySql') |
|
44 | - ->will($this->returnValue("fk")); |
|
43 | + ->method('getDropForeignKeySql') |
|
44 | + ->will($this->returnValue("fk")); |
|
45 | 45 | |
46 | 46 | $schema = $this->createFixtureSchema(); |
47 | 47 |