@@ -49,7 +49,7 @@ discard block |
||
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 |
||
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); |
@@ -1,7 +1,7 @@ |
||
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 |
@@ -10,6 +10,6 @@ |
||
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 | } |
@@ -180,7 +180,7 @@ |
||
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)) { |
@@ -67,7 +67,7 @@ discard block |
||
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 |
||
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 |
||
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 |
||
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; |
@@ -57,7 +57,7 @@ discard block |
||
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 |
||
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(); |
@@ -15,9 +15,9 @@ discard block |
||
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 |
||
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 |
||
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 |
||
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) |
@@ -1,7 +1,6 @@ |
||
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; |
@@ -52,7 +52,7 @@ discard block |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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( |
@@ -1,6 +1,6 @@ discard block |
||
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 |
||
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 |
||
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 |
||
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); |