Completed
Pull Request — master (#60)
by Jérôme
07:11
created
Command/MigrationCommand.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -49,7 +49,7 @@  discard block
 block discarded – undo
49 49
      */
50 50
     protected function execute(InputInterface $input, OutputInterface $output)
51 51
     {
52
-        if (! $input->getOption('add') && ! $input->getOption('delete')) {
52
+        if (!$input->getOption('add') && !$input->getOption('delete')) {
53 53
             throw new \InvalidArgumentException('You must specify whether you want to --add or --delete the specified migration.');
54 54
         }
55 55
 
@@ -79,7 +79,7 @@  discard block
 block discarded – undo
79 79
                 throw new \InvalidArgumentException(sprintf('The path "%s" does not correspond to any migration definition.', $migrationNameOrPath));
80 80
             }
81 81
 
82
-            foreach($migrationDefinitionCollection as $migrationDefinition) {
82
+            foreach ($migrationDefinitionCollection as $migrationDefinition) {
83 83
                 $migrationName = basename($migrationDefinition->path);
84 84
 
85 85
                 $migration = $migrationService->getMigration($migrationNameOrPath);
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,7 +1,7 @@
 block discarded – undo
1 1
 <?php
2 2
 
3 3
 // try to load autoloade both when extension is top-level project and when it is installed as part of a working eZPUblish
4
-if (!file_exists($file = __DIR__.'/../vendor/autoload.php') && !file_exists($file = __DIR__.'/../../../../vendor/autoload.php')) {
4
+if (!file_exists($file = __DIR__ . '/../vendor/autoload.php') && !file_exists($file = __DIR__ . '/../../../../vendor/autoload.php')) {
5 5
     throw new \RuntimeException('Install the dependencies to run the test suite.');
6 6
 }
7 7
 
Please login to merge, or discard this patch.
Tests/phpunit/Core/BundleMigrationDBTestCase.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -10,6 +10,6 @@
 block discarded – undo
10 10
 
11 11
     public function setUp()
12 12
     {
13
-        $this->connection = DriverManager::getConnection( array( 'driver' => 'pdo_sqlite', 'memory' => true ) );
13
+        $this->connection = DriverManager::getConnection(array('driver' => 'pdo_sqlite', 'memory' => true));
14 14
     }
15 15
 }
Please login to merge, or discard this patch.
Core/Executor/ContentManager.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -180,7 +180,7 @@
 block discarded – undo
180 180
             }
181 181
 
182 182
             $draft = $contentService->createContentDraft($contentInfo);
183
-            $contentService->updateContent($draft->versionInfo,$contentUpdateStruct);
183
+            $contentService->updateContent($draft->versionInfo, $contentUpdateStruct);
184 184
             $content = $contentService->publishVersion($draft->versionInfo);
185 185
 
186 186
             if (array_key_exists('new_remote_id', $this->dsl)) {
Please login to merge, or discard this patch.
Command/MigrateCommand.php 1 patch
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -67,7 +67,7 @@  discard block
 block discarded – undo
67 67
 
68 68
         // filter away all migrations except 'to do' ones
69 69
         $toExecute = array();
70
-        foreach($migrationDefinitions as $name => $migrationDefinition) {
70
+        foreach ($migrationDefinitions as $name => $migrationDefinition) {
71 71
             if (!isset($migrations[$name]) || (($migration = $migrations[$name]) && $migration->status == Migration::STATUS_TODO)) {
72 72
                 $toExecute[$name] = $migrationsService->parseMigrationDefinition($migrationDefinition);
73 73
             }
@@ -100,7 +100,7 @@  discard block
 block discarded – undo
100 100
 
101 101
         $data = array();
102 102
         $i = 1;
103
-        foreach($toExecute as $name => $migrationDefinition) {
103
+        foreach ($toExecute as $name => $migrationDefinition) {
104 104
             $notes = '';
105 105
             if ($migrationDefinition->status != MigrationDefinition::STATUS_PARSED) {
106 106
                 $notes = '<error>' . $migrationDefinition->parsingError . '</error>';
@@ -135,7 +135,7 @@  discard block
 block discarded – undo
135 135
             $output->writeln("=============================================\n");
136 136
         }
137 137
 
138
-        foreach($toExecute as $name => $migrationDefinition) {
138
+        foreach ($toExecute as $name => $migrationDefinition) {
139 139
 
140 140
             // let's skip migrations that we know are invalid - user was warned and he decided to proceed anyway
141 141
             if ($migrationDefinition->status == MigrationDefinition::STATUS_INVALID) {
@@ -147,7 +147,7 @@  discard block
 block discarded – undo
147 147
 
148 148
             try {
149 149
                 $migrationsService->executeMigration($migrationDefinition);
150
-            } catch(\Exception $e) {
150
+            } catch (\Exception $e) {
151 151
                 if ($input->getOption('ignore-failures')) {
152 152
                     $output->writeln("\n<error>Migration failed! Reason: " . $e->getMessage() . "</error>\n");
153 153
                     continue;
Please login to merge, or discard this patch.
Tests/phpunit/CommandTest.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -57,7 +57,7 @@  discard block
 block discarded – undo
57 57
 
58 58
     protected function tearDown()
59 59
     {
60
-        foreach($this->leftovers as $file) {
60
+        foreach ($this->leftovers as $file) {
61 61
             unlink($file);
62 62
         }
63 63
 
@@ -83,7 +83,7 @@  discard block
 block discarded – undo
83 83
         );
84 84
         try {
85 85
             static::$kernel = static::createKernel($options);
86
-        } catch(\RuntimeException $e) {
86
+        } catch (\RuntimeException $e) {
87 87
             throw new \RuntimeException($e->getMessage() . " Did you forget to define the environment variable KERNEL_DIR?", $e->getCode(), $e->getPrevious());
88 88
         }
89 89
         static::$kernel->boot();
Please login to merge, or discard this patch.
API/Collection/AbstractCollection.php 1 patch
Spacing   +7 added lines, -7 removed lines patch added patch discarded remove patch
@@ -15,9 +15,9 @@  discard block
 block discarded – undo
15 15
      * @param int $flags
16 16
      * @param string $iterator_class
17 17
      */
18
-    public function __construct ($input = array(), $flags = 0, $iterator_class = "ArrayIterator")
18
+    public function __construct($input = array(), $flags = 0, $iterator_class = "ArrayIterator")
19 19
     {
20
-        foreach($input as $value) {
20
+        foreach ($input as $value) {
21 21
             if (!is_a($value, $this->allowedClass)) {
22 22
                 $this->throwInvalid($value);
23 23
             }
@@ -29,7 +29,7 @@  discard block
 block discarded – undo
29 29
     /**
30 30
      * @param mixed $value
31 31
      */
32
-    public function append ($value)
32
+    public function append($value)
33 33
     {
34 34
         if (!is_a($value, $this->allowedClass)) {
35 35
             $this->throwInvalid($value);
@@ -42,9 +42,9 @@  discard block
 block discarded – undo
42 42
      * @param mixed $input
43 43
      * @return array the old array
44 44
      */
45
-    public function exchangeArray ($input)
45
+    public function exchangeArray($input)
46 46
     {
47
-        foreach($input as $value) {
47
+        foreach ($input as $value) {
48 48
             if (!is_a($value, $this->allowedClass)) {
49 49
                 $this->throwInvalid($value);
50 50
             }
@@ -57,13 +57,13 @@  discard block
 block discarded – undo
57 57
      * @param mixed $index
58 58
      * @param mixed $newval
59 59
      */
60
-    public function offsetSet ($index , $newval)
60
+    public function offsetSet($index, $newval)
61 61
     {
62 62
         if (!is_a($newval, $this->allowedClass)) {
63 63
             $this->throwInvalid($newval);
64 64
         }
65 65
 
66
-        return parent::offsetSet($index , $newval);
66
+        return parent::offsetSet($index, $newval);
67 67
     }
68 68
 
69 69
     protected function throwInvalid($newval)
Please login to merge, or discard this patch.
Tests/behat/FeatureContext.php 2 patches
Unused Use Statements   -1 removed lines patch added patch discarded remove patch
@@ -1,7 +1,6 @@
 block discarded – undo
1 1
 <?php
2 2
 
3 3
 use Kaliop\eZMigrationBundle\API\MigrationInterface;
4
-
5 4
 use Symfony\Component\DependencyInjection\ContainerInterface;
6 5
 use Kaliop\eZMigrationBundle\API\Value\Migration;
7 6
 use Kaliop\eZMigrationBundle\API\Value\MigrationDefinition;
Please login to merge, or discard this patch.
Spacing   +25 added lines, -25 removed lines patch added patch discarded remove patch
@@ -52,7 +52,7 @@  discard block
 block discarded – undo
52 52
     /**
53 53
      * @Given /^I have the parsed DSL:$/
54 54
      */
55
-    public function iHaveTheParsedDsl( TableNode $table )
55
+    public function iHaveTheParsedDsl(TableNode $table)
56 56
     {
57 57
         $hash = $table->getHash();
58 58
         $this->dsl = $hash[0];
@@ -61,7 +61,7 @@  discard block
 block discarded – undo
61 61
     /**
62 62
      * @Given /^the attributes:$/
63 63
      */
64
-    public function theAttributes( TableNode $table )
64
+    public function theAttributes(TableNode $table)
65 65
     {
66 66
         $this->dsl['attributes'] = $table->getHash();
67 67
     }
@@ -69,23 +69,23 @@  discard block
 block discarded – undo
69 69
     /**
70 70
      * @When /^I create a "([^"]*)"$/
71 71
      */
72
-    public function iCreateA( $className )
72
+    public function iCreateA($className)
73 73
     {
74
-        $this->stepResults = $this->createObject( $className );
74
+        $this->stepResults = $this->createObject($className);
75 75
 
76 76
     }
77 77
 
78 78
     /**
79 79
      * @Then /^I should get an object of "([^"]*)"$/
80 80
      */
81
-    public function iShouldGetAnObjectOf( $className )
81
+    public function iShouldGetAnObjectOf($className)
82 82
     {
83
-        switch( $className ) {
83
+        switch ($className) {
84 84
             case 'ContentCreateStruct':
85
-                Assertion::assertInstanceOf( 'eZ\Publish\Core\Repository\Values\Content\ContentCreateStruct', $this->stepResults );
85
+                Assertion::assertInstanceOf('eZ\Publish\Core\Repository\Values\Content\ContentCreateStruct', $this->stepResults);
86 86
                 break;
87 87
             default:
88
-                throw new PendingException( 'Handling for class name: ' . $className . ' not implemented.' );
88
+                throw new PendingException('Handling for class name: ' . $className . ' not implemented.');
89 89
         }
90 90
 
91 91
     }
@@ -93,58 +93,58 @@  discard block
 block discarded – undo
93 93
     /**
94 94
      * @Given /^it should have (\d+) fields of type "([^"]*)"$/
95 95
      */
96
-    public function itShouldHaveFieldsOfType( $numberOfFields, $className )
96
+    public function itShouldHaveFieldsOfType($numberOfFields, $className)
97 97
     {
98
-        switch( $className )
98
+        switch ($className)
99 99
         {
100 100
             case 'Field':
101 101
                 $fieldType = 'eZ\Publish\API\Repository\Values\Content\Field';
102 102
                 break;
103 103
             default:
104
-                throw new PendingException( 'Handling for class ' . $className . ' not implemented' );
104
+                throw new PendingException('Handling for class ' . $className . ' not implemented');
105 105
         }
106 106
 
107
-        $fieldCount = count( $this->stepResults->fields );
107
+        $fieldCount = count($this->stepResults->fields);
108 108
 
109
-        Assertion::assertEquals( $numberOfFields, $fieldCount );
110
-        foreach( $this->stepResults->fields as $field )
109
+        Assertion::assertEquals($numberOfFields, $fieldCount);
110
+        foreach ($this->stepResults->fields as $field)
111 111
         {
112
-            Assertion::assertInstanceOf( $fieldType, $field );
112
+            Assertion::assertInstanceOf($fieldType, $field);
113 113
         }
114 114
     }
115 115
 
116 116
     /**
117 117
      * @Given /^the fields should have the values:$/
118 118
      */
119
-    public function theFieldsShouldHaveTheValues(TableNode $table )
119
+    public function theFieldsShouldHaveTheValues(TableNode $table)
120 120
     {
121 121
         throw new PendingException();
122 122
     }
123 123
 
124
-    private function createObject( $className )
124
+    private function createObject($className)
125 125
     {
126 126
         $object = null;
127 127
 
128
-        switch( $className )
128
+        switch ($className)
129 129
         {
130 130
             case 'ContentCreateStruct':
131 131
                 /** @var $repository \eZ\Publish\API\Repository\Repository */
132
-                $repository = $this->kernel->getContainer()->get( 'ezpublish.api.repository' );
132
+                $repository = $this->kernel->getContainer()->get('ezpublish.api.repository');
133 133
 
134 134
                 $contentService = $repository->getContentService();
135 135
 
136 136
                 $contentType = $this->createArticleContentType();
137 137
 
138
-                $object = $contentService->newContentCreateStruct( $contentType, self::DEFAULT_LANGUAGE_CODE );
138
+                $object = $contentService->newContentCreateStruct($contentType, self::DEFAULT_LANGUAGE_CODE);
139 139
 
140
-                foreach( $this->dsl['attributes'][0] as $field => $value )
140
+                foreach ($this->dsl['attributes'][0] as $field => $value)
141 141
                 {
142
-                    $object->setField( $field, $value );
142
+                    $object->setField($field, $value);
143 143
                 }
144 144
 
145 145
                 break;
146 146
             default:
147
-                throw new UndefinedException( $className );
147
+                throw new UndefinedException($className);
148 148
         }
149 149
 
150 150
         return $object;
@@ -159,7 +159,7 @@  discard block
 block discarded – undo
159 159
         $fieldDefinitions = $this->createArticleFieldDefinitions();
160 160
 
161 161
         $dateTime = new DateTime();
162
-        $dateTime->setTimestamp( time() );
162
+        $dateTime->setTimestamp(time());
163 163
 
164 164
         return new ContentType(
165 165
             array(
@@ -282,7 +282,7 @@  discard block
 block discarded – undo
282 282
     private function createContentTypeGroup()
283 283
     {
284 284
         $dateTime = new DateTime();
285
-        $dateTime->setTimestamp( time() );
285
+        $dateTime->setTimestamp(time());
286 286
 
287 287
         return new ContentTypeGroup(
288 288
             array(
Please login to merge, or discard this patch.
Tests/phpunit/2_MigrateTest.php 1 patch
Spacing   +10 added lines, -10 removed lines patch added patch discarded remove patch
@@ -1,6 +1,6 @@  discard block
 block discarded – undo
1 1
 <?php
2 2
 
3
-include_once(__DIR__.'/CommandTest.php');
3
+include_once(__DIR__ . '/CommandTest.php');
4 4
 
5 5
 use Symfony\Component\Console\Input\ArrayInput;
6 6
 
@@ -115,13 +115,13 @@  discard block
 block discarded – undo
115 115
 
116 116
     public function goodDSLProvider()
117 117
     {
118
-        $dslDir = $this->dslDir.'/good';
119
-        if(!is_dir($dslDir)) {
118
+        $dslDir = $this->dslDir . '/good';
119
+        if (!is_dir($dslDir)) {
120 120
             return array();
121 121
         }
122 122
 
123 123
         $out = array();
124
-        foreach(scandir($dslDir) as $fileName) {
124
+        foreach (scandir($dslDir) as $fileName) {
125 125
             $filePath = $dslDir . '/' . $fileName;
126 126
             if (is_file($filePath)) {
127 127
                 $out[] = array($filePath);
@@ -132,13 +132,13 @@  discard block
 block discarded – undo
132 132
 
133 133
     public function invalidDSLProvider()
134 134
     {
135
-        $dslDir = $this->dslDir.'/bad/parsing';
136
-        if(!is_dir($dslDir)) {
135
+        $dslDir = $this->dslDir . '/bad/parsing';
136
+        if (!is_dir($dslDir)) {
137 137
             return array();
138 138
         }
139 139
 
140 140
         $out = array();
141
-        foreach(scandir($dslDir) as $fileName) {
141
+        foreach (scandir($dslDir) as $fileName) {
142 142
             $filePath = $dslDir . '/' . $fileName;
143 143
             if (is_file($filePath)) {
144 144
                 $out[] = array($filePath);
@@ -149,13 +149,13 @@  discard block
 block discarded – undo
149 149
 
150 150
     public function badDSLProvider()
151 151
     {
152
-        $dslDir = $this->dslDir.'/bad/execution';
153
-        if(!is_dir($dslDir)) {
152
+        $dslDir = $this->dslDir . '/bad/execution';
153
+        if (!is_dir($dslDir)) {
154 154
             return array();
155 155
         }
156 156
 
157 157
         $out = array();
158
-        foreach(scandir($dslDir) as $fileName) {
158
+        foreach (scandir($dslDir) as $fileName) {
159 159
             $filePath = $dslDir . '/' . $fileName;
160 160
             if (is_file($filePath)) {
161 161
                 $out[] = array($filePath);
Please login to merge, or discard this patch.