Completed
Push — master ( ad3607...e552c5 )
by Gaetano
16:21 queued 12:56
created
Tests/phpunit/Core/ConfigurationTest.php 1 patch
Spacing   +121 added lines, -121 removed lines patch added patch discarded remove patch
@@ -28,27 +28,27 @@  discard block
 block discarded – undo
28 28
     public function setUp() {
29 29
         parent::setUp();
30 30
 
31
-        $this->configuration = new Configuration( $this->connection, new ConsoleOutput() );
31
+        $this->configuration = new Configuration($this->connection, new ConsoleOutput());
32 32
 
33 33
     }
34 34
 
35 35
     public function testGetConnection() {
36 36
         $conn = $this->configuration->getConnection();
37 37
 
38
-        $this->assertTrue( $conn instanceof Connection );
38
+        $this->assertTrue($conn instanceof Connection);
39 39
     }
40 40
 
41 41
     public function testGetVersions() {
42 42
         $version = $this->configuration->getVersions();
43 43
 
44
-        $this->assertTrue( is_array($version ) );
44
+        $this->assertTrue(is_array($version));
45 45
     }
46 46
 
47 47
     public function testcreateVersionTableIfNeeded()
48 48
     {
49 49
         $result = $this->configuration->createVersionTableIfNeeded();
50 50
 
51
-        $this->assertTrue( $result );
51
+        $this->assertTrue($result);
52 52
     }
53 53
 
54 54
     /**
@@ -61,19 +61,19 @@  discard block
 block discarded – undo
61 61
         $conn = $this->configuration->getConnection();
62 62
 
63 63
 
64
-        $time = date( 'YmdHis', time() );
64
+        $time = date('YmdHis', time());
65 65
         $bundle = 'testBundle';
66
-        $sql = sprintf( "INSERT INTO %s ( 'bundle', 'version' ) VALUES( '%s', '%s' )", $this->configuration->versionTableName, $bundle, $time );
66
+        $sql = sprintf("INSERT INTO %s ( 'bundle', 'version' ) VALUES( '%s', '%s' )", $this->configuration->versionTableName, $bundle, $time);
67 67
 
68
-        $conn->executeQuery( $sql );
68
+        $conn->executeQuery($sql);
69 69
 
70 70
         /** @var $versions array */
71
-        $versions = $this->configuration->getMigratedVersionsByBundle( $bundle );
71
+        $versions = $this->configuration->getMigratedVersionsByBundle($bundle);
72 72
 
73
-        $this->assertTrue( is_array( $versions ) );
74
-        $this->assertEquals( 1, count( $versions ) );
73
+        $this->assertTrue(is_array($versions));
74
+        $this->assertEquals(1, count($versions));
75 75
 
76
-        $this->assertEquals( $time, $versions[0] );
76
+        $this->assertEquals($time, $versions[0]);
77 77
     }
78 78
 
79 79
     /**
@@ -86,23 +86,23 @@  discard block
 block discarded – undo
86 86
 
87 87
         $conn = $this->configuration->getConnection();
88 88
 
89
-        $time = date( 'YmdHis', time() - 3600 );
89
+        $time = date('YmdHis', time() - 3600);
90 90
         $bundle = 'testBundle';
91 91
 
92
-        $this->configuration->setVersions( array( $bundle => array() ) );
92
+        $this->configuration->setVersions(array($bundle => array()));
93 93
 
94
-        $sql = sprintf( "INSERT INTO %s ( 'bundle', 'version' ) VALUES( '%s', '%s' )", $this->configuration->versionTableName, $bundle, $time );
94
+        $sql = sprintf("INSERT INTO %s ( 'bundle', 'version' ) VALUES( '%s', '%s' )", $this->configuration->versionTableName, $bundle, $time);
95 95
 
96
-        $conn->executeQuery( $sql );
96
+        $conn->executeQuery($sql);
97 97
 
98
-        $time = date( 'YmdHis', time() );
99
-        $sql = sprintf( "INSERT INTO %s ( 'bundle', 'version' ) VALUES( '%s', '%s' )", $this->configuration->versionTableName, $bundle, $time );
98
+        $time = date('YmdHis', time());
99
+        $sql = sprintf("INSERT INTO %s ( 'bundle', 'version' ) VALUES( '%s', '%s' )", $this->configuration->versionTableName, $bundle, $time);
100 100
 
101
-        $conn->executeQuery( $sql );
101
+        $conn->executeQuery($sql);
102 102
 
103
-        $version = $this->configuration->getCurrentVersionByBundle( $bundle );
103
+        $version = $this->configuration->getCurrentVersionByBundle($bundle);
104 104
 
105
-        $this->assertEquals( (int)$time, $version );
105
+        $this->assertEquals((int)$time, $version);
106 106
     }
107 107
 
108 108
     /**
@@ -116,37 +116,37 @@  discard block
 block discarded – undo
116 116
 
117 117
         $conn = $this->configuration->getConnection();
118 118
 
119
-        $time = date( 'YmdHis', time() - 3600 );
119
+        $time = date('YmdHis', time() - 3600);
120 120
         $bundle1 = 'testBundle';
121 121
         $bundle2 = 'testBundle2';
122 122
 
123
-        $this->configuration->setVersions( array( $bundle1 => array(), $bundle2 => array() ) );
123
+        $this->configuration->setVersions(array($bundle1 => array(), $bundle2 => array()));
124 124
 
125
-        $sql = sprintf( "INSERT INTO %s ( 'bundle', 'version' ) VALUES( '%s', '%s' )", $this->configuration->versionTableName, $bundle1, $time );
125
+        $sql = sprintf("INSERT INTO %s ( 'bundle', 'version' ) VALUES( '%s', '%s' )", $this->configuration->versionTableName, $bundle1, $time);
126 126
 
127
-        $conn->executeQuery( $sql );
127
+        $conn->executeQuery($sql);
128 128
 
129
-        $sql = sprintf( "INSERT INTO %s ( 'bundle', 'version' ) VALUES( '%s', '%s' )", $this->configuration->versionTableName, $bundle2, $time );
129
+        $sql = sprintf("INSERT INTO %s ( 'bundle', 'version' ) VALUES( '%s', '%s' )", $this->configuration->versionTableName, $bundle2, $time);
130 130
 
131
-        $conn->executeQuery( $sql );
131
+        $conn->executeQuery($sql);
132 132
 
133
-        $time = date( 'YmdHis', time() );
134
-        $sql = sprintf( "INSERT INTO %s ( 'bundle', 'version' ) VALUES( '%s', '%s' )", $this->configuration->versionTableName, $bundle1, $time );
133
+        $time = date('YmdHis', time());
134
+        $sql = sprintf("INSERT INTO %s ( 'bundle', 'version' ) VALUES( '%s', '%s' )", $this->configuration->versionTableName, $bundle1, $time);
135 135
 
136
-        $conn->executeQuery( $sql );
136
+        $conn->executeQuery($sql);
137 137
 
138
-        $time2 = date( 'YmdHis', time() );
139
-        $sql = sprintf( "INSERT INTO %s ( 'bundle', 'version' ) VALUES( '%s', '%s' )", $this->configuration->versionTableName, $bundle2, $time2 );
138
+        $time2 = date('YmdHis', time());
139
+        $sql = sprintf("INSERT INTO %s ( 'bundle', 'version' ) VALUES( '%s', '%s' )", $this->configuration->versionTableName, $bundle2, $time2);
140 140
 
141
-        $conn->executeQuery( $sql );
141
+        $conn->executeQuery($sql);
142 142
 
143 143
         $versions = $this->configuration->getCurrentBundleVersions();
144 144
 
145
-        $this->assertTrue( is_array( $versions ) );
146
-        $this->assertEquals( 2, count( $versions ) );
145
+        $this->assertTrue(is_array($versions));
146
+        $this->assertEquals(2, count($versions));
147 147
 
148
-        $this->assertEquals( (int)$time, $versions[$bundle1] );
149
-        $this->assertEquals( (int)$time2, $versions[$bundle2] );
148
+        $this->assertEquals((int)$time, $versions[$bundle1]);
149
+        $this->assertEquals((int)$time2, $versions[$bundle2]);
150 150
     }
151 151
 
152 152
     /**
@@ -158,46 +158,46 @@  discard block
 block discarded – undo
158 158
 
159 159
         $conn = $this->configuration->getConnection();
160 160
 
161
-        $time = date( 'YmdHis', time() - 3600 );
161
+        $time = date('YmdHis', time() - 3600);
162 162
         $bundle1 = 'testBundle';
163 163
         $bundle2 = 'testBundle2';
164 164
 
165
-        $this->configuration->setVersions( array( $bundle1 => array(), $bundle2 => array() ) );
165
+        $this->configuration->setVersions(array($bundle1 => array(), $bundle2 => array()));
166 166
 
167
-        $sql = sprintf( "INSERT INTO %s ( 'bundle', 'version' ) VALUES( '%s', '%s' )", $this->configuration->versionTableName, $bundle1, $time );
167
+        $sql = sprintf("INSERT INTO %s ( 'bundle', 'version' ) VALUES( '%s', '%s' )", $this->configuration->versionTableName, $bundle1, $time);
168 168
 
169
-        $conn->executeQuery( $sql );
169
+        $conn->executeQuery($sql);
170 170
 
171
-        $sql = sprintf( "INSERT INTO %s ( 'bundle', 'version' ) VALUES( '%s', '%s' )", $this->configuration->versionTableName, $bundle2, $time );
171
+        $sql = sprintf("INSERT INTO %s ( 'bundle', 'version' ) VALUES( '%s', '%s' )", $this->configuration->versionTableName, $bundle2, $time);
172 172
 
173
-        $conn->executeQuery( $sql );
173
+        $conn->executeQuery($sql);
174 174
 
175
-        $time1 = date( 'YmdHis', time() );
176
-        $sql = sprintf( "INSERT INTO %s ( 'bundle', 'version' ) VALUES( '%s', '%s' )", $this->configuration->versionTableName, $bundle1, $time1 );
175
+        $time1 = date('YmdHis', time());
176
+        $sql = sprintf("INSERT INTO %s ( 'bundle', 'version' ) VALUES( '%s', '%s' )", $this->configuration->versionTableName, $bundle1, $time1);
177 177
 
178
-        $conn->executeQuery( $sql );
178
+        $conn->executeQuery($sql);
179 179
 
180
-        $time2 = date( 'YmdHis', time() );
181
-        $sql = sprintf( "INSERT INTO %s ( 'bundle', 'version' ) VALUES( '%s', '%s' )", $this->configuration->versionTableName, $bundle2, $time2 );
180
+        $time2 = date('YmdHis', time());
181
+        $sql = sprintf("INSERT INTO %s ( 'bundle', 'version' ) VALUES( '%s', '%s' )", $this->configuration->versionTableName, $bundle2, $time2);
182 182
 
183
-        $conn->executeQuery( $sql );
183
+        $conn->executeQuery($sql);
184 184
 
185 185
         $versions = $this->configuration->getMigratedVersions();
186 186
 
187
-        $this->assertTrue( is_array( $versions ) );
188
-        $this->assertEquals( 2, count( $versions ) );
189
-        $this->assertArrayHasKey( $bundle1, $versions );
190
-        $this->assertArrayHasKey( $bundle2, $versions );
187
+        $this->assertTrue(is_array($versions));
188
+        $this->assertEquals(2, count($versions));
189
+        $this->assertArrayHasKey($bundle1, $versions);
190
+        $this->assertArrayHasKey($bundle2, $versions);
191 191
 
192
-        $this->assertTrue( is_array( $versions[$bundle1] ) );
193
-        $this->assertTrue( is_array( $versions[$bundle2] ) );
194
-        $this->assertEquals( 2, count( $versions[$bundle1] ) );
195
-        $this->assertEquals( 2, count( $versions[$bundle2] ) );
192
+        $this->assertTrue(is_array($versions[$bundle1]));
193
+        $this->assertTrue(is_array($versions[$bundle2]));
194
+        $this->assertEquals(2, count($versions[$bundle1]));
195
+        $this->assertEquals(2, count($versions[$bundle2]));
196 196
 
197
-        $this->assertEquals( $time, $versions[$bundle1][0] );
198
-        $this->assertEquals( $time, $versions[$bundle2][0] );
199
-        $this->assertEquals( $time1, $versions[$bundle1][1] );
200
-        $this->assertEquals( $time2, $versions[$bundle2][1] );
197
+        $this->assertEquals($time, $versions[$bundle1][0]);
198
+        $this->assertEquals($time, $versions[$bundle2][0]);
199
+        $this->assertEquals($time1, $versions[$bundle1][1]);
200
+        $this->assertEquals($time2, $versions[$bundle2][1]);
201 201
     }
202 202
 
203 203
     /**
@@ -209,10 +209,10 @@  discard block
 block discarded – undo
209 209
 
210 210
         $conn = $this->configuration->getConnection();
211 211
 
212
-        $time = date( 'YmdHis', time() - 3600 );
213
-        $time1 = date( 'YmdHis', time() );
214
-        $time2 = date( 'YmdHis', time() + 3600 );
215
-        $time3 = date( 'YmdHis', time() + 7200 );
212
+        $time = date('YmdHis', time() - 3600);
213
+        $time1 = date('YmdHis', time());
214
+        $time2 = date('YmdHis', time() + 3600);
215
+        $time3 = date('YmdHis', time() + 7200);
216 216
         $bundle1 = 'testBundle';
217 217
         $bundle2 = 'testBundle2';
218 218
 
@@ -229,35 +229,35 @@  discard block
 block discarded – undo
229 229
             )
230 230
         );
231 231
 
232
-        $this->configuration->setVersions( $versions );
232
+        $this->configuration->setVersions($versions);
233 233
 
234
-        $sql = sprintf( "INSERT INTO %s ( 'bundle', 'version' ) VALUES( '%s', '%s' )", $this->configuration->versionTableName, $bundle1, $time );
234
+        $sql = sprintf("INSERT INTO %s ( 'bundle', 'version' ) VALUES( '%s', '%s' )", $this->configuration->versionTableName, $bundle1, $time);
235 235
 
236
-        $conn->executeQuery( $sql );
236
+        $conn->executeQuery($sql);
237 237
 
238
-        $sql = sprintf( "INSERT INTO %s ( 'bundle', 'version' ) VALUES( '%s', '%s' )", $this->configuration->versionTableName, $bundle2, $time );
238
+        $sql = sprintf("INSERT INTO %s ( 'bundle', 'version' ) VALUES( '%s', '%s' )", $this->configuration->versionTableName, $bundle2, $time);
239 239
 
240
-        $conn->executeQuery( $sql );
240
+        $conn->executeQuery($sql);
241 241
 
242
-        $sql = sprintf( "INSERT INTO %s ( 'bundle', 'version' ) VALUES( '%s', '%s' )", $this->configuration->versionTableName, $bundle1, $time1 );
242
+        $sql = sprintf("INSERT INTO %s ( 'bundle', 'version' ) VALUES( '%s', '%s' )", $this->configuration->versionTableName, $bundle1, $time1);
243 243
 
244
-        $conn->executeQuery( $sql );
244
+        $conn->executeQuery($sql);
245 245
 
246
-        $sql = sprintf( "INSERT INTO %s ( 'bundle', 'version' ) VALUES( '%s', '%s' )", $this->configuration->versionTableName, $bundle2, $time2 );
246
+        $sql = sprintf("INSERT INTO %s ( 'bundle', 'version' ) VALUES( '%s', '%s' )", $this->configuration->versionTableName, $bundle2, $time2);
247 247
 
248
-        $conn->executeQuery( $sql );
248
+        $conn->executeQuery($sql);
249 249
 
250 250
         $results = $this->configuration->migrationsToExecute();
251 251
 
252
-        $this->assertTrue( is_array( $results ) );
253
-        $this->assertEquals( 2, count( $results ) );
254
-        $this->assertArrayHasKey( $bundle1, $results );
255
-        $this->assertArrayHasKey( $bundle2, $results );
252
+        $this->assertTrue(is_array($results));
253
+        $this->assertEquals(2, count($results));
254
+        $this->assertArrayHasKey($bundle1, $results);
255
+        $this->assertArrayHasKey($bundle2, $results);
256 256
 
257
-        $this->assertEquals( 1, count( $results[$bundle1] ) );
258
-        $this->assertEquals( $time2, key( $results[$bundle1] ) );
259
-        $this->assertEquals( 1, count( $results[$bundle2] ) );
260
-        $this->assertEquals( $time3, key( $results[$bundle2] ) );
257
+        $this->assertEquals(1, count($results[$bundle1]));
258
+        $this->assertEquals($time2, key($results[$bundle1]));
259
+        $this->assertEquals(1, count($results[$bundle2]));
260
+        $this->assertEquals($time3, key($results[$bundle2]));
261 261
     }
262 262
 
263 263
     /**
@@ -270,16 +270,16 @@  discard block
 block discarded – undo
270 270
         $bundle = 'testBundle';
271 271
         $version = '1';
272 272
 
273
-        $versions = $this->configuration->getMigratedVersionsByBundle( $bundle );
274
-        $this->assertTrue( is_array( $versions ) );
275
-        $this->assertEquals( 0, count( $versions ) );
273
+        $versions = $this->configuration->getMigratedVersionsByBundle($bundle);
274
+        $this->assertTrue(is_array($versions));
275
+        $this->assertEquals(0, count($versions));
276 276
 
277
-        $this->configuration->markVersionMigrated( $bundle, $version );
278
-        $versions = $this->configuration->getMigratedVersionsByBundle( $bundle );
277
+        $this->configuration->markVersionMigrated($bundle, $version);
278
+        $versions = $this->configuration->getMigratedVersionsByBundle($bundle);
279 279
 
280
-        $this->assertTrue( is_array( $versions ) );
281
-        $this->assertEquals( 1, count( $versions ) );
282
-        $this->assertEquals( $version, $versions[0] );
280
+        $this->assertTrue(is_array($versions));
281
+        $this->assertEquals(1, count($versions));
282
+        $this->assertEquals($version, $versions[0]);
283 283
     }
284 284
 
285 285
     /**
@@ -294,25 +294,25 @@  discard block
 block discarded – undo
294 294
         $version1 = '1';
295 295
         $version2 = '2';
296 296
 
297
-        $versions = $this->configuration->getMigratedVersionsByBundle( $bundle );
298
-        $this->assertTrue( is_array( $versions ) );
299
-        $this->assertEquals( 0, count( $versions ) );
297
+        $versions = $this->configuration->getMigratedVersionsByBundle($bundle);
298
+        $this->assertTrue(is_array($versions));
299
+        $this->assertEquals(0, count($versions));
300 300
 
301
-        $this->configuration->markVersionMigrated( $bundle, $version1 );
302
-        $versions = $this->configuration->getMigratedVersionsByBundle( $bundle );
301
+        $this->configuration->markVersionMigrated($bundle, $version1);
302
+        $versions = $this->configuration->getMigratedVersionsByBundle($bundle);
303 303
 
304
-        $this->assertTrue( is_array( $versions ) );
305
-        $this->assertEquals( 1, count( $versions ) );
306
-        $this->assertEquals( $version1, $versions[0] );
304
+        $this->assertTrue(is_array($versions));
305
+        $this->assertEquals(1, count($versions));
306
+        $this->assertEquals($version1, $versions[0]);
307 307
 
308
-        $this->configuration->markVersionMigrated( $bundle, $version2 );
309
-        $this->configuration->markVersionNotMigrated( $bundle, $version1 );
308
+        $this->configuration->markVersionMigrated($bundle, $version2);
309
+        $this->configuration->markVersionNotMigrated($bundle, $version1);
310 310
 
311
-        $versions = $this->configuration->getMigratedVersionsByBundle( $bundle );
311
+        $versions = $this->configuration->getMigratedVersionsByBundle($bundle);
312 312
 
313
-        $this->assertTrue( is_array( $versions ) );
314
-        $this->assertEquals( 1, count( $versions ) );
315
-        $this->assertEquals( $version2, $versions[0] );
313
+        $this->assertTrue(is_array($versions));
314
+        $this->assertEquals(1, count($versions));
315
+        $this->assertEquals($version2, $versions[0]);
316 316
     }
317 317
 
318 318
     /**
@@ -322,21 +322,21 @@  discard block
 block discarded – undo
322 322
     public function testRegisterVersionFromDirectories() {
323 323
         try {
324 324
             $this->setupVfsStructure();
325
-        } catch ( \Exception $e ) {
326
-            var_dump( $e->getMessage() );
327
-            $this->markTestSkipped( "The VfsStream bundle is not installed." );
325
+        } catch (\Exception $e) {
326
+            var_dump($e->getMessage());
327
+            $this->markTestSkipped("The VfsStream bundle is not installed.");
328 328
         }
329 329
 
330 330
         $paths = array(
331
-            'bundle1' => array( vfsStream::url( 'bundles/bundle1/MigrationVersions' ) ),
332
-            'bundle2' => array( vfsStream::url( 'bundles/bundle2/MigrationVersions' ) )
331
+            'bundle1' => array(vfsStream::url('bundles/bundle1/MigrationVersions')),
332
+            'bundle2' => array(vfsStream::url('bundles/bundle2/MigrationVersions'))
333 333
         );
334 334
 
335 335
         $this->configuration->createVersionTableIfNeeded();
336 336
 
337
-        $versions = $this->configuration->registerVersionFromDirectories( $paths );
337
+        $versions = $this->configuration->registerVersionFromDirectories($paths);
338 338
 
339
-        $this->markTestSkipped( "FIXME: figure out a way to test this" );
339
+        $this->markTestSkipped("FIXME: figure out a way to test this");
340 340
     }
341 341
 
342 342
     /**
@@ -344,9 +344,9 @@  discard block
 block discarded – undo
344 344
      */
345 345
     public function testCheckDuplicateVersion()
346 346
     {
347
-        $this->configuration->setVersions( array( 'testBundle' => array( '1' ) ) );
347
+        $this->configuration->setVersions(array('testBundle' => array('1')));
348 348
 
349
-        $this->configuration->checkDuplicateVersion( 'testBundle', '1' );
349
+        $this->configuration->checkDuplicateVersion('testBundle', '1');
350 350
     }
351 351
 
352 352
     /**
@@ -356,11 +356,11 @@  discard block
 block discarded – undo
356 356
 
357 357
         try {
358 358
         $this->setupVfsStructure();
359
-        } catch( \Exception $e ) {
360
-            $this->markTestSkipped( 'Problem with VfsStream.' );
359
+        } catch (\Exception $e) {
360
+            $this->markTestSkipped('Problem with VfsStream.');
361 361
         }
362 362
 
363
-        $path = vfsStream::url( 'bundles/bundle1/MigrationVersions/Version20010101010101.php' );
363
+        $path = vfsStream::url('bundles/bundle1/MigrationVersions/Version20010101010101.php');
364 364
     }
365 365
 
366 366
     /**
@@ -374,21 +374,21 @@  discard block
 block discarded – undo
374 374
             $structure = array(
375 375
                 'bundle1' => array(
376 376
                     'MigrationVersions' => array(
377
-                        'Version20010101010101.php' => '<?php namespace MigrationVersions\bundle1;'."\n" . $this->dummyVersionContent . "\n?>",
378
-                        'Version20010101010102.php' => '<?php namespace MigrationVersions\bundle1;'."\n" . $this->dummyVersionContent . "\n?>",
377
+                        'Version20010101010101.php' => '<?php namespace MigrationVersions\bundle1;' . "\n" . $this->dummyVersionContent . "\n?>",
378
+                        'Version20010101010102.php' => '<?php namespace MigrationVersions\bundle1;' . "\n" . $this->dummyVersionContent . "\n?>",
379 379
                     )
380 380
                 ),
381 381
                 'bundle2' => array(
382 382
                     'MigrationVersions' => array(
383
-                        'Version20010101010103.php' => '<?php namespace MigrationVersions\bundle2;'."\n" . $this->dummyVersionContent . "\n?>",
383
+                        'Version20010101010103.php' => '<?php namespace MigrationVersions\bundle2;' . "\n" . $this->dummyVersionContent . "\n?>",
384 384
                     )
385 385
                 )
386 386
             );
387
-        } catch( Exception $e ) {
388
-            throw new \Exception( $e->getMessage() );
387
+        } catch (Exception $e) {
388
+            throw new \Exception($e->getMessage());
389 389
         }
390 390
 
391
-        $this->root = vfsStream::setup( 'bundles', null, $structure );
391
+        $this->root = vfsStream::setup('bundles', null, $structure);
392 392
     }
393 393
 
394 394
     /**
Please login to merge, or discard this patch.
Tests/bootstrap.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -1,6 +1,6 @@
 block discarded – undo
1 1
 <?php
2 2
 
3
-if (!file_exists($file = __DIR__.'/../vendor/autoload.php')) {
3
+if (!file_exists($file = __DIR__ . '/../vendor/autoload.php')) {
4 4
     throw new \RuntimeException('Install the dependencies to run the test suite.');
5 5
 }
6 6
 
Please login to merge, or discard this patch.
Command/MigrateCommand.php 1 patch
Spacing   +7 added lines, -7 removed lines patch added patch discarded remove patch
@@ -61,7 +61,7 @@  discard block
 block discarded – undo
61 61
     {
62 62
         $migrationsService = $this->getMigrationService();
63 63
 
64
-        $migrationDefinitions = $migrationsService->getMigrationsDefinitions($input->getOption('path')) ;
64
+        $migrationDefinitions = $migrationsService->getMigrationsDefinitions($input->getOption('path'));
65 65
         $migrations = $migrationsService->getMigrations();
66 66
 
67 67
         if (!count($migrationDefinitions)) {
@@ -71,7 +71,7 @@  discard block
 block discarded – undo
71 71
 
72 72
         // filter away all migrations except 'to do' ones
73 73
         $toExecute = array();
74
-        foreach($migrationDefinitions as $name => $migrationDefinition) {
74
+        foreach ($migrationDefinitions as $name => $migrationDefinition) {
75 75
             if (!isset($migrations[$name]) || (($migration = $migrations[$name]) && $migration->status == Migration::STATUS_TODO)) {
76 76
                 $toExecute[$name] = $migrationsService->parseMigrationDefinition($migrationDefinition);
77 77
             }
@@ -88,7 +88,7 @@  discard block
 block discarded – undo
88 88
 
89 89
         $data = array();
90 90
         $i = 1;
91
-        foreach($toExecute as $name => $migrationDefinition) {
91
+        foreach ($toExecute as $name => $migrationDefinition) {
92 92
             $notes = '';
93 93
             if ($migrationDefinition->status != MigrationDefinition::STATUS_PARSED) {
94 94
                 $notes = '<error>' . $migrationDefinition->parsingError . '</error>';
@@ -123,7 +123,7 @@  discard block
 block discarded – undo
123 123
             $output->writeln("=============================================\n");
124 124
         }
125 125
 
126
-        foreach($toExecute as $name => $migrationDefinition) {
126
+        foreach ($toExecute as $name => $migrationDefinition) {
127 127
 
128 128
             // let's skip migrations that we know are invalid - user was warned and he decide to proceed anyway
129 129
             if ($migrationDefinition->status == MigrationDefinition::STATUS_INVALID) {
@@ -135,12 +135,12 @@  discard block
 block discarded – undo
135 135
 
136 136
             try {
137 137
                 $migrationsService->executeMigration($migrationDefinition);
138
-            } catch(\Exception $e) {
138
+            } catch (\Exception $e) {
139 139
                 if ($input->getOption('ignore-failures')) {
140
-                    $output->writeln("\n<error>Migration failed!".$e->getMessage()."</error>\n");
140
+                    $output->writeln("\n<error>Migration failed!" . $e->getMessage() . "</error>\n");
141 141
                     continue;
142 142
                 }
143
-                $output->writeln("\n<error>Migration aborted!".$e->getMessage()."</error>");
143
+                $output->writeln("\n<error>Migration aborted!" . $e->getMessage() . "</error>");
144 144
                 return 1;
145 145
             }
146 146
 
Please login to merge, or discard this patch.
Command/StatusCommand.php 1 patch
Spacing   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -41,7 +41,7 @@  discard block
 block discarded – undo
41 41
     {
42 42
         $migrationsService = $this->getMigrationService();
43 43
 
44
-        $migrationDefinitions = $migrationsService->getMigrationsDefinitions($input->getOption('path')) ;
44
+        $migrationDefinitions = $migrationsService->getMigrationsDefinitions($input->getOption('path'));
45 45
         $migrations = $migrationsService->getMigrations();
46 46
 
47 47
         if (!count($migrationDefinitions) && !count($migrations)) {
@@ -51,10 +51,10 @@  discard block
 block discarded – undo
51 51
 
52 52
         // create a unique ist of all migrations (coming from db) and definitions (coming from disk)
53 53
         $index = array();
54
-        foreach($migrationDefinitions as $migrationDefinition) {
54
+        foreach ($migrationDefinitions as $migrationDefinition) {
55 55
             $index[$migrationDefinition->name] = array('definition' => $migrationDefinition);
56 56
         }
57
-        foreach($migrations as $migration) {
57
+        foreach ($migrations as $migration) {
58 58
             if (isset($index[$migration->name])) {
59 59
                 $index[$migration->name]['migration'] = $migration;
60 60
             } else {
@@ -68,7 +68,7 @@  discard block
 block discarded – undo
68 68
                         {
69 69
                             $index[$migration->name]['definition'] = reset($migrationDefinitionCollection);
70 70
                         }
71
-                    } catch(\Exception $e) {
71
+                    } catch (\Exception $e) {
72 72
                         /// @todo one day we should be able to limit the kind of exceptions we have to catch here...
73 73
                     }
74 74
                 }
@@ -80,7 +80,7 @@  discard block
 block discarded – undo
80 80
 
81 81
         $data = array();
82 82
         $i = 1;
83
-        foreach($index as $name => $value) {
83
+        foreach ($index as $name => $value) {
84 84
             if (!isset($value['migration'])) {
85 85
                 $migrationDefinition = $migrationsService->parseMigrationDefinition($value['definition']);
86 86
                 $notes = '';
Please login to merge, or discard this patch.
Command/GenerateCommand.php 1 patch
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -80,7 +80,7 @@  discard block
 block discarded – undo
80 80
         }
81 81
 
82 82
         $activeBundles = array();
83
-        foreach($this->getApplication()->getKernel()->getBundles() as $bundle)
83
+        foreach ($this->getApplication()->getKernel()->getBundles() as $bundle)
84 84
         {
85 85
             $activeBundles[] = $bundle->getName();
86 86
         }
@@ -155,7 +155,7 @@  discard block
 block discarded – undo
155 155
                     $className = 'Migration';
156 156
                 }
157 157
                 // Make sure that php class names are unique, not only migration definition file names
158
-                $existingMigrations = count(glob($migrationDirectory.'/*_' . $className .'*.php'));
158
+                $existingMigrations = count(glob($migrationDirectory . '/*_' . $className . '*.php'));
159 159
                 if ($existingMigrations) {
160 160
                     $className = $className . sprintf('%03d', $existingMigrations + 1);
161 161
                 }
@@ -201,7 +201,7 @@  discard block
 block discarded – undo
201 201
         if ($migrationType == 'role') {
202 202
             $code = $this->generateRoleTemplate($parameters['role']);
203 203
         } else {
204
-            $code = $this->getContainer()->get('twig')->render($this->thisBundle . ':MigrationTemplate:'.$template, $parameters);
204
+            $code = $this->getContainer()->get('twig')->render($this->thisBundle . ':MigrationTemplate:' . $template, $parameters);
205 205
         }
206 206
 
207 207
         file_put_contents($path, $code);
@@ -267,7 +267,7 @@  discard block
 block discarded – undo
267 267
         /** @var \eZ\Publish\API\Repository\SectionService $sectionService */
268 268
         $sectionService = $repository->getSectionService();
269 269
 
270
-        foreach($limitation->limitationValues as $value)
270
+        foreach ($limitation->limitationValues as $value)
271 271
         {
272 272
 
273 273
         }
Please login to merge, or discard this patch.
Command/MigrationCommand.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -44,7 +44,7 @@
 block discarded – undo
44 44
      */
45 45
     protected function execute(InputInterface $input, OutputInterface $output)
46 46
     {
47
-        if (/*! $input->getOption('add') &&*/ ! $input->getOption('delete')) {
47
+        if (/*! $input->getOption('add') &&*/ !$input->getOption('delete')) {
48 48
             throw new \InvalidArgumentException('You must specify whether you want to --delete the specified migration.');
49 49
         }
50 50
 
Please login to merge, or discard this patch.
Core/Executor/UserManager.php 1 patch
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -132,7 +132,7 @@  discard block
 block discarded – undo
132 132
                 $this->dsl['user_id'] = array($this->dsl['user_id']);
133 133
             }
134 134
             foreach ($this->dsl['user_id'] as $id) {
135
-                array_push($usersToDelete,$userService->loadUser($id));
135
+                array_push($usersToDelete, $userService->loadUser($id));
136 136
             }
137 137
         }
138 138
         if (isset($this->dsl['email'])) {
@@ -140,7 +140,7 @@  discard block
 block discarded – undo
140 140
                 $this->dsl['email'] = array($this->dsl['email']);
141 141
             }
142 142
             foreach ($this->dsl['email'] as $email) {
143
-                $usersToDelete = array_merge($usersToDelete,$userService->loadUsersByEmail($email));
143
+                $usersToDelete = array_merge($usersToDelete, $userService->loadUsersByEmail($email));
144 144
             }
145 145
         }
146 146
         if (isset($this->dsl['username'])) {
@@ -148,11 +148,11 @@  discard block
 block discarded – undo
148 148
                 $this->dsl['username'] = array($this->dsl['username']);
149 149
             }
150 150
             foreach ($this->dsl['username'] as $username) {
151
-                array_push($usersToDelete,$userService->loadUserByLogin($username));
151
+                array_push($usersToDelete, $userService->loadUserByLogin($username));
152 152
             }
153 153
         }
154 154
 
155
-        foreach($usersToDelete as $user){
155
+        foreach ($usersToDelete as $user) {
156 156
             $userService->deleteUser($user);
157 157
         }
158 158
     }
Please login to merge, or discard this patch.
Core/Executor/ContentManager.php 1 patch
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -125,7 +125,7 @@  discard block
 block discarded – undo
125 125
         }
126 126
 
127 127
         $draft = $contentService->createContentDraft($contentInfo);
128
-        $contentService->updateContent($draft->versionInfo,$contentUpdateStruct);
128
+        $contentService->updateContent($draft->versionInfo, $contentUpdateStruct);
129 129
         $content = $contentService->publishVersion($draft->versionInfo);
130 130
 
131 131
         if (array_key_exists('new_remote_id', $this->dsl)) {
@@ -158,7 +158,7 @@  discard block
 block discarded – undo
158 158
 
159 159
         $contentService = $this->repository->getContentService();
160 160
 
161
-        if (isset($this->dsl['object_id'])){
161
+        if (isset($this->dsl['object_id'])) {
162 162
             if (!is_array($this->dsl['object_id'])) {
163 163
                 $this->dsl['object_id'] = array($this->dsl['object_id']);
164 164
             }
@@ -186,7 +186,7 @@  discard block
 block discarded – undo
186 186
      * @param ContentCreateStruct $createStruct
187 187
      * @param array $fields
188 188
      */
189
-    protected function setFields(ContentCreateStruct &$createStruct, array $fields)
189
+    protected function setFields(ContentCreateStruct & $createStruct, array $fields)
190 190
     {
191 191
         foreach ($fields as $field) {
192 192
             // each $field is one key value pair
@@ -214,7 +214,7 @@  discard block
 block discarded – undo
214 214
      * @param ContentUpdateStruct $updateStruct
215 215
      * @param array $fields
216 216
      */
217
-    protected function setFieldsToUpdate(ContentUpdateStruct &$updateStruct, array $fields, ContentType $contentType)
217
+    protected function setFieldsToUpdate(ContentUpdateStruct & $updateStruct, array $fields, ContentType $contentType)
218 218
     {
219 219
         foreach ($fields as $field) {
220 220
             // each $field is one key value pair
Please login to merge, or discard this patch.
Core/Executor/UserGroupManager.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -129,7 +129,7 @@
 block discarded – undo
129 129
             $groupIds = array($groupIds);
130 130
         }
131 131
 
132
-        foreach($groupIds as $groupId) {
132
+        foreach ($groupIds as $groupId) {
133 133
             $userGroup = $userService->loadUserGroup($groupId);
134 134
             $userService->deleteUserGroup($userGroup);
135 135
         }
Please login to merge, or discard this patch.