@@ -110,39 +110,44 @@ private function setUpPhpcrDatabase($suite)
110
110
{
111
111
echo PHP_EOL .PHP_EOL ;
112
112
113
+ // initialize PHPCR DBAL (new way)
113
114
$ process = $ this ->processBuilder
114
115
->setArguments (array_merge ($ this ->prefix , array ('doctrine:phpcr:init:dbal ' , '--drop ' , '--force ' )))
115
116
->getProcess ();
117
+
116
118
$ process ->run ();
117
119
118
- while (true ) {
119
- if ($ process ->isTerminated ()) {
120
- if (!$ process ->isSuccessful ()) {
121
- $ output = null !== $ process ->getErrorOutput () ? $ process ->getErrorOutput () : $ process ->getOutput ();
122
- $ suite ->markTestSuiteSkipped ('[PHPCR] Error when initializing dbal: ' .$ output );
123
- } else {
124
- $ process = $ this ->processBuilder
125
- ->setArguments (array_merge ($ this ->prefix , array ('doctrine:phpcr:repository:init ' )))
126
- ->getProcess ();
127
- $ process ->run ();
128
-
129
- while (true ) {
130
- if ($ process ->isTerminated ()) {
131
- if (!$ process ->isSuccessful ()) {
132
- $ output = null !== $ process ->getErrorOutput () ? $ process ->getErrorOutput () : $ process ->getOutput ();
133
- $ suite ->markTestSuiteSkipped ('[PHPCR] Error when initializing repositories: ' .$ output );
134
- } else {
135
- echo '[PHPCR] ' .PHP_EOL ;
136
- }
137
- }
138
-
139
- break ;
140
- }
141
- }
120
+ if (!$ process ->isSuccessful ()) {
121
+ // try initializing the old way (Jackalope <1.2)
122
+ $ process = $ this ->processBuilder
123
+ ->setArguments (array_merge ($ this ->prefix , array ('doctrine:phpcr:init:dbal ' , '--drop ' )))
124
+ ->getProcess ();
142
125
143
- break ;
126
+ $ process ->run ();
127
+
128
+ if (!$ process ->isSuccessful ()) {
129
+ $ output = null !== $ process ->getErrorOutput () ? $ process ->getErrorOutput () : $ process ->getOutput ();
130
+ $ suite ->markTestSuiteSkipped ('[PHPCR] Error when initializing dbal: ' .$ output );
131
+
132
+ return ;
144
133
}
134
+ }
135
+
136
+ // initialize repositories
137
+ $ process = $ this ->processBuilder
138
+ ->setArguments (array_merge ($ this ->prefix , array ('doctrine:phpcr:repository:init ' )))
139
+ ->getProcess ();
140
+
141
+ $ process ->run ();
142
+
143
+ if (!$ process ->isSuccessful ()) {
144
+ $ output = null !== $ process ->getErrorOutput () ? $ process ->getErrorOutput () : $ process ->getOutput ();
145
+ $ suite ->markTestSuiteSkipped ('[PHPCR] Error when initializing repositories: ' .$ output );
146
+
147
+ return ;
145
148
}
149
+
150
+ echo '[PHPCR] ' .PHP_EOL ;
146
151
}
147
152
148
153
private function setUpOrmDatabase ($ suite )
@@ -152,52 +157,42 @@ private function setUpOrmDatabase($suite)
152
157
$ process = $ this ->processBuilder
153
158
->setArguments (array_merge ($ this ->prefix , array ('doctrine:schema:drop ' , '--env=orm ' , '--force ' )))
154
159
->getProcess ();
160
+
155
161
$ process ->run ();
156
162
157
- while (true ) {
158
- if ($ process ->isTerminated ()) {
159
- if (!$ process ->isSuccessful ()) {
160
- $ output = null !== $ process ->getErrorOutput () ? $ process ->getErrorOutput () : $ process ->getOutput ();
161
- $ suite ->markTestSuiteSkipped ('[ORM] Error when dropping database: ' .$ output );
162
- return ;
163
- }
164
- break ;
165
- }
163
+ if (!$ process ->isSuccessful ()) {
164
+ $ output = null !== $ process ->getErrorOutput () ? $ process ->getErrorOutput () : $ process ->getOutput ();
165
+ $ suite ->markTestSuiteSkipped ('[ORM] Error when dropping database: ' .$ output );
166
+
167
+ return ;
166
168
}
167
169
168
170
$ process = $ this ->processBuilder
169
171
->setArguments (array_merge ($ this ->prefix , array ('doctrine:database:create ' , '--env=orm ' )))
170
172
->getProcess ();
173
+
171
174
$ process ->run ();
172
175
173
- while (true ) {
174
- if ($ process ->isTerminated ()) {
175
- if (!$ process ->isSuccessful ()) {
176
- $ output = null !== $ process ->getErrorOutput () ? $ process ->getErrorOutput () : $ process ->getOutput ();
177
- $ suite ->markTestSuiteSkipped ('[ORM] Error when creating database: ' .$ output );
178
- } else {
179
- $ process = $ this ->processBuilder
180
- ->setArguments (array_merge ($ this ->prefix , array ('doctrine:schema:create ' , '--env=orm ' )))
181
- ->getProcess ();
182
- $ process ->run ();
183
-
184
- while (true ) {
185
- if ($ process ->isTerminated ()) {
186
- if (!$ process ->isSuccessful ()) {
187
- $ output = null !== $ process ->getErrorOutput () ? $ process ->getErrorOutput () : $ process ->getOutput ();
188
- $ suite ->markTestSuiteSkipped ('[ORM] Error when creating schema: ' .$ output );
189
- } else {
190
- echo '[ORM] ' .PHP_EOL ;
191
- }
192
- }
193
-
194
- break ;
195
- }
196
- }
176
+ if (!$ process ->isSuccessful ()) {
177
+ $ output = null !== $ process ->getErrorOutput () ? $ process ->getErrorOutput () : $ process ->getOutput ();
178
+ $ suite ->markTestSuiteSkipped ('[ORM] Error when creating database: ' .$ output );
197
179
198
- break ;
199
- }
180
+ return ;
200
181
}
182
+
183
+ $ process = $ this ->processBuilder
184
+ ->setArguments (array_merge ($ this ->prefix , array ('doctrine:schema:create ' , '--env=orm ' )))
185
+ ->getProcess ();
186
+ $ process ->run ();
187
+
188
+ if (!$ process ->isSuccessful ()) {
189
+ $ output = null !== $ process ->getErrorOutput () ? $ process ->getErrorOutput () : $ process ->getOutput ();
190
+ $ suite ->markTestSuiteSkipped ('[ORM] Error when creating schema: ' .$ output );
191
+
192
+ return ;
193
+ }
194
+
195
+ echo '[ORM] ' .PHP_EOL ;
201
196
}
202
197
203
198
public function endTestSuite (\PHPUnit_Framework_TestSuite $ suite )
@@ -209,16 +204,12 @@ public function endTestSuite(\PHPUnit_Framework_TestSuite $suite)
209
204
$ process = $ this ->processBuilder
210
205
->setArguments (array_merge ($ this ->prefix , array ('doctrine:database:drop ' , '--force ' )))
211
206
->getProcess ();
207
+
212
208
$ process ->run ();
213
209
214
- while (true ) {
215
- if ($ process ->isTerminated ()) {
216
- if (!$ process ->isSuccessful ()) {
217
- $ output = null !== $ process ->getErrorOutput () ? $ process ->getErrorOutput () : $ process ->getOutput ();
218
- $ suite ->markTestSuiteSkipped ('Error when dropping database: ' .$ output );
219
- }
220
- }
221
- break ;
210
+ if (!$ process ->isSuccessful ()) {
211
+ $ output = null !== $ process ->getErrorOutput () ? $ process ->getErrorOutput () : $ process ->getOutput ();
212
+ $ suite ->markTestSuiteSkipped ('Error when dropping database: ' .$ output );
222
213
}
223
214
}
224
215
}
0 commit comments