Skip to content

Commit 515014a

Browse files
committed
fix failing EnvironmentTest tests
Signed-off-by: Matthew Peveler <matt.peveler@gmail.com>
1 parent d7eff35 commit 515014a

1 file changed

Lines changed: 72 additions & 31 deletions

File tree

tests/Phinx/Migration/Manager/EnvironmentTest.php

Lines changed: 72 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -148,10 +148,15 @@ public function testExecutingAMigrationUp()
148148
$this->environment->setAdapter($adapterStub);
149149

150150
// up
151-
$upMigration = $this->getMockBuilder('\Phinx\Migration\AbstractMigration')
152-
->setConstructorArgs(['mockenv', '20110301080000'])
153-
->onlyMethods(['up'])
154-
->getMock();
151+
$upMigration = $this->getMockForAbstractClass(
152+
'\Phinx\Migration\AbstractMigration',
153+
['mockenv', '20110301080000'],
154+
'',
155+
true,
156+
true,
157+
true,
158+
['up'],
159+
);
155160
$upMigration->expects($this->once())
156161
->method('up');
157162

@@ -171,10 +176,15 @@ public function testExecutingAMigrationDown()
171176
$this->environment->setAdapter($adapterStub);
172177

173178
// down
174-
$downMigration = $this->getMockBuilder('\Phinx\Migration\AbstractMigration')
175-
->setConstructorArgs(['mockenv', '20110301080000'])
176-
->onlyMethods(['down'])
177-
->getMock();
179+
$downMigration = $this->getMockForAbstractClass(
180+
'\Phinx\Migration\AbstractMigration',
181+
['mockenv', '20110301080000'],
182+
'',
183+
true,
184+
true,
185+
true,
186+
['down'],
187+
);
178188
$downMigration->expects($this->once())
179189
->method('down');
180190

@@ -200,10 +210,15 @@ public function testExecutingAMigrationWithTransactions()
200210
$this->environment->setAdapter($adapterStub);
201211

202212
// migrate
203-
$migration = $this->getMockBuilder('\Phinx\Migration\AbstractMigration')
204-
->setConstructorArgs(['mockenv', '20110301080000'])
205-
->onlyMethods(['up'])
206-
->getMock();
213+
$migration = $this->getMockForAbstractClass(
214+
'\Phinx\Migration\AbstractMigration',
215+
['mockenv', '20110301080000'],
216+
'',
217+
true,
218+
true,
219+
true,
220+
['up'],
221+
);
207222
$migration->expects($this->once())
208223
->method('up');
209224

@@ -223,10 +238,15 @@ public function testExecutingAChangeMigrationUp()
223238
$this->environment->setAdapter($adapterStub);
224239

225240
// migration
226-
$migration = $this->getMockBuilder('\Phinx\Migration\AbstractMigration')
227-
->setConstructorArgs(['mockenv', '20130301080000'])
228-
->onlyMethods(['change'])
229-
->getMock();
241+
$migration = $this->getMockForAbstractClass(
242+
'\Phinx\Migration\AbstractMigration',
243+
['mockenv', '20130301080000'],
244+
'',
245+
true,
246+
true,
247+
true,
248+
['change'],
249+
);
230250
$migration->expects($this->once())
231251
->method('change');
232252

@@ -246,10 +266,15 @@ public function testExecutingAChangeMigrationDown()
246266
$this->environment->setAdapter($adapterStub);
247267

248268
// migration
249-
$migration = $this->getMockBuilder('\Phinx\Migration\AbstractMigration')
250-
->setConstructorArgs(['mockenv', '20130301080000'])
251-
->onlyMethods(['change'])
252-
->getMock();
269+
$migration = $this->getMockForAbstractClass(
270+
'\Phinx\Migration\AbstractMigration',
271+
['mockenv', '20130301080000'],
272+
'',
273+
true,
274+
true,
275+
true,
276+
['change'],
277+
);
253278
$migration->expects($this->once())
254279
->method('change');
255280

@@ -269,10 +294,15 @@ public function testExecutingAFakeMigration()
269294
$this->environment->setAdapter($adapterStub);
270295

271296
// migration
272-
$migration = $this->getMockBuilder('\Phinx\Migration\AbstractMigration')
273-
->setConstructorArgs(['mockenv', '20130301080000'])
274-
->onlyMethods(['change'])
275-
->getMock();
297+
$migration = $this->getMockForAbstractClass(
298+
'\Phinx\Migration\AbstractMigration',
299+
['mockenv', '20130301080000'],
300+
'',
301+
true,
302+
true,
303+
true,
304+
['change'],
305+
);
276306
$migration->expects($this->never())
277307
->method('change');
278308

@@ -301,10 +331,15 @@ public function testExecuteMigrationCallsInit()
301331
$this->environment->setAdapter($adapterStub);
302332

303333
// up
304-
$upMigration = $this->getMockBuilder('\Phinx\Migration\AbstractMigration')
305-
->setConstructorArgs(['mockenv', '20110301080000'])
306-
->onlyMethods(['up', 'init'])
307-
->getMock();
334+
$upMigration = $this->getMockForAbstractClass(
335+
'\Phinx\Migration\AbstractMigration',
336+
['mockenv', '20130301080000'],
337+
'',
338+
true,
339+
true,
340+
true,
341+
['up', 'init'],
342+
);
308343
$upMigration->expects($this->once())
309344
->method('up');
310345
$upMigration->expects($this->once())
@@ -323,9 +358,15 @@ public function testExecuteSeedInit()
323358
$this->environment->setAdapter($adapterStub);
324359

325360
// up
326-
$seed = $this->getMockBuilder('\Phinx\Seed\AbstractSeed')
327-
->onlyMethods(['run', 'init'])
328-
->getMock();
361+
$seed = $this->getMockForAbstractClass(
362+
'\Phinx\Seed\AbstractSeed',
363+
[],
364+
'',
365+
true,
366+
true,
367+
true,
368+
['run', 'init'],
369+
);
329370

330371
$seed->expects($this->once())
331372
->method('run');

0 commit comments

Comments
 (0)