[TASK] Re-work/simplify copyright header in PHP files - Part 2
[Packages/TYPO3.CMS.git] / typo3 / sysext / install / Tests / Unit / Service / SqlSchemaMigrationServiceTest.php
1 <?php
2 namespace TYPO3\CMS\Install\Tests\Unit\Service;
3
4 /**
5 * This file is part of the TYPO3 CMS project.
6 *
7 * It is free software; you can redistribute it and/or modify it under
8 * the terms of the GNU General Public License, either version 2
9 * of the License, or any later version.
10 *
11 * For the full copyright and license information, please read the
12 * LICENSE.txt file that was distributed with this source code.
13 *
14 * The TYPO3 project - inspiring people to share!
15 */
16
17 use TYPO3\CMS\Install\Service\SqlSchemaMigrationService;
18
19 /**
20 * Test case
21 *
22 * @author Mario Rimann <mario.rimann@typo3.org>
23 */
24 class SqlSchemaMigrationServiceTest extends \TYPO3\CMS\Core\Tests\UnitTestCase {
25
26 /**
27 * @var \TYPO3\CMS\Install\Service\SqlSchemaMigrationService
28 */
29 protected $fixture;
30
31 /**
32 * Sets up the fixture for testing
33 */
34 public function setUp() {
35 $this->fixture = new SqlSchemaMigrationService();
36 }
37
38 /**
39 * @test
40 */
41 public function getDatabaseExtraFindsChangedFields() {
42 $differenceArray = $this->fixture->getDatabaseExtra(
43 array(
44 'tx_foo' => array(
45 'fields' => array(
46 'foo' => 'varchar(999) DEFAULT \'0\' NOT NULL'
47 )
48 )
49 ),
50 array(
51 'tx_foo' => array(
52 'fields' => array(
53 'foo' => 'varchar(255) DEFAULT \'0\' NOT NULL'
54 )
55 )
56 )
57 );
58
59
60
61 $this->assertEquals(
62 $differenceArray,
63 array(
64 'extra' => array(),
65 'diff' => array(
66 'tx_foo' => array(
67 'fields' => array(
68 'foo' => 'varchar(999) DEFAULT \'0\''
69 )
70 )
71 ),
72 'diff_currentValues' => array(
73 'tx_foo' => array(
74 'fields' => array(
75 'foo' => 'varchar(255) DEFAULT \'0\''
76 )
77 )
78 )
79 )
80 );
81 }
82
83 /**
84 * @test
85 */
86 public function getDatabaseExtraIgnoresCaseDifference() {
87 $differenceArray = $this->fixture->getDatabaseExtra(
88 array(
89 'tx_foo' => array(
90 'fields' => array(
91 'foo' => 'INT(11) DEFAULT \'0\' NOT NULL'
92 )
93 )
94 ),
95 array(
96 'tx_foo' => array(
97 'fields' => array(
98 'foo' => 'int(11) DEFAULT \'0\' NOT NULL'
99 )
100 )
101 )
102 );
103
104
105 $this->assertEquals(
106 $differenceArray,
107 array(
108 'extra' => array(),
109 'diff' => array(),
110 'diff_currentValues' => NULL
111 )
112 );
113 }
114
115 /**
116 * @test
117 */
118 public function getDatabaseExtraDoesNotLowercaseReservedWordsForTheComparison() {
119 $differenceArray = $this->fixture->getDatabaseExtra(
120 array(
121 'tx_foo' => array(
122 'fields' => array(
123 'PRIMARY KEY (md5hash)'
124 )
125 )
126 ),
127 array(
128 'tx_foo' => array(
129 'fields' => array(
130 'PRIMARY KEY (md5hash)')
131 )
132 )
133 );
134
135
136 $this->assertEquals(
137 $differenceArray,
138 array(
139 'extra' => array(),
140 'diff' => array(),
141 'diff_currentValues' => NULL
142 )
143 );
144 }
145 }