Skip to content

Commit 82bb968

Browse files
Merge pull request #144 from soul-rise/up_dependency
work in php 7.4
2 parents 4e71b88 + ce7a51b commit 82bb968

File tree

7 files changed

+26
-22
lines changed

7 files changed

+26
-22
lines changed

composer.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,12 +15,12 @@
1515
"email": "david@panmedia.co.nz"
1616
}],
1717
"require": {
18-
"php": ">=5.3.2",
18+
"php": ">=7.1",
1919
"symfony/console": "^2.0||^3.0||^4.0||^5.0",
2020
"symfony/config": "^2.0||^3.0||^4.0||^5.0"
2121
},
2222
"require-dev": {
23-
"phpunit/phpunit": "3.*",
23+
"phpunit/phpunit": "^9.2",
2424
"mockery/mockery": "*@dev"
2525
},
2626
"suggest": {

phpunit.xml.dist

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,6 @@
1010
convertWarningsToExceptions = "true"
1111
processIsolation = "false"
1212
stopOnFailure = "false"
13-
syntaxCheck = "false"
1413
bootstrap = "vendor/autoload.php" >
1514

1615
<testsuites>

src/Phpmig/Console/Command/InitCommand.php

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,8 @@ protected function execute(InputInterface $input, OutputInterface $output)
5252

5353
$this->initMigrationsDir($migrations, $output);
5454
$this->initBootstrap($bootstrap, $relative, $output);
55+
56+
return 0;
5557
}
5658

5759
/**

tests/Phpmig/Api/PhpmigApplicationTest.php

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -2,32 +2,32 @@
22

33
namespace Phpmig\Api;
44

5-
use Phpmig\Api\PhpmigApplication;
5+
use PHPUnit\Framework\TestCase;
66
use Symfony\Component\Console\Output;
77

88
/**
99
* @group unit
10-
* @coversDefaultClass Phpmig\Api\PhpmigApplication
10+
* @coversDefaultClass PhpmigApplication
1111
*
1212
* @author Cody Phillips
1313
*/
14-
class PhpmigApplicationTest extends \PHPUnit_Framework_TestCase
14+
class PhpmigApplicationTest extends TestCase
1515
{
1616
private $prev_version = '20141104210000';
1717
private $current_version = '20141104220000';
1818
private $next_version = '20141104230000';
1919
private $output;
2020
private $temp_dir;
2121

22-
public function setup()
22+
public function setUp(): void
2323
{
2424
$this->output = new Output\NullOutput();
2525
$this->setTempDir($this->makeTempDir());
2626
}
2727

28-
public function tearDown()
28+
public function tearDown(): void
2929
{
30-
$this->cleanTempDir($this->getTempDir());
30+
$this->cleanTempDir();
3131
}
3232

3333
/**
@@ -121,7 +121,6 @@ public function testGetMigrations()
121121
* @covers ::getMigrations
122122
* @covers ::loadMigrations
123123
* @covers ::migrationToClassName
124-
* @expectedException \InvalidArgumentException
125124
* @dataProvider getMigrationsExceptionProvider
126125
*/
127126
public function testGetMigrationsException($migrations, $class_names, $extends)
@@ -135,6 +134,7 @@ public function testGetMigrationsException($migrations, $class_names, $extends)
135134
$container = $this->getContainer($adapter, $migrations, $this->getTempDir());
136135

137136
$app = new PhpmigApplication($container, $this->output);
137+
$this->expectException(\InvalidArgumentException::class);
138138
$app->getMigrations(0);
139139
}
140140

@@ -208,7 +208,7 @@ public function testGetVersion()
208208
*/
209209
protected function getAdapter(array $versions = array())
210210
{
211-
$adapter = $this->getMock('Phpmig\Adapter\AdapterInterface');
211+
$adapter = $this->createMock('Phpmig\Adapter\AdapterInterface');
212212
$adapter->expects($this->any())
213213
->method('fetchAll')
214214
->will($this->returnValue($versions));
@@ -225,7 +225,7 @@ protected function getAdapter(array $versions = array())
225225
*/
226226
protected function getMigrator($adapter, $container, $output, $times_up, $times_down)
227227
{
228-
$migrator = $this->getMock("Phpmig\Migration\Migrator", array("up", "down"), array($adapter, $container, $output));
228+
$migrator = $this->createMock("Phpmig\Migration\Migrator", array("up", "down"), array($adapter, $container, $output));
229229
if ($times_up > 0) {
230230
$migrator->expects($this->exactly($times_up))
231231
->method("up")

tests/Phpmig/Console/Command/InitCommandTest.php

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2,24 +2,25 @@
22

33
namespace Phpmig\Console\Command;
44

5+
use PHPUnit\Framework\TestCase;
56
use Symfony\Component\Console\Application;
67
use Symfony\Component\Console\Command\Command;
78
use Symfony\Component\Console\Tester\CommandTester;
89

910
/**
1011
* @group unit
1112
*/
12-
class InitCommandTest extends \PHPUnit_Framework_TestCase
13+
class InitCommandTest extends TestCase
1314
{
1415
/** @var string */
1516
private $tempDir;
1617

17-
public function setUp()
18+
public function setUp(): void
1819
{
1920
$this->setTempDir($this->createTempDir());
2021
}
2122

22-
public function tearDown()
23+
public function tearDown(): void
2324
{
2425
$this->cleanUpTempDir($this->getTempDir());
2526
}
@@ -52,7 +53,7 @@ public function testExecuteMigrationDirAlreadyExists()
5253

5354
$tester->execute(array('command' => $command->getName()));
5455

55-
$this->assertContains('migrations already exists', $tester->getDisplay());
56+
$this->assertStringContainsStringIgnoringCase('migrations already exists', $tester->getDisplay());
5657
}
5758

5859
public function testExecuteCreatesBootstrapFile()
@@ -80,7 +81,7 @@ public function testExecuteBootstrapFileExists()
8081

8182
$tester->execute(array('command' => $command->getName()));
8283

83-
$this->assertContains('phpmig.php already exists', $tester->getDisplay());
84+
$this->assertStringContainsStringIgnoringCase('phpmig.php already exists', $tester->getDisplay());
8485
}
8586

8687
/**
@@ -160,4 +161,4 @@ private function createCommand()
160161

161162
return $app->find('init');
162163
}
163-
}
164+
}

tests/Phpmig/Migration/MigrationTest.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,11 +3,11 @@
33
namespace Phpmig\Migration;
44

55
use Mockery as m;
6-
use Phpmig\Migration\Migration;
6+
use PHPUnit\Framework\TestCase;
77
use Symfony\Component\Console\Helper\DialogHelper;
88
use Symfony\Component\Console\Output\OutputInterface;
99

10-
class MigrationTest extends \PHPUnit_Framework_TestCase
10+
class MigrationTest extends TestCase
1111
{
1212
/**
1313
* @var OutputInterface|m\MockInterface
@@ -24,7 +24,7 @@ class MigrationTest extends \PHPUnit_Framework_TestCase
2424
*/
2525
private $migration;
2626

27-
public function setup()
27+
public function setUp(): void
2828
{
2929
$this->migrationOutput = m::mock('Symfony\Component\Console\Output\OutputInterface')->shouldIgnoreMissing();
3030
$this->migrationDialogHelper = m::mock('Symfony\Component\Console\Helper\DialogHelper')->shouldIgnoreMissing();

tests/Phpmig/PhpmigApplicationTest.php

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,10 +2,12 @@
22

33
namespace Phpmig\Console;
44

5+
use PHPUnit\Framework\TestCase;
6+
57
/**
68
* @group unit
79
*/
8-
class PhpmigApplicationTest extends \PHPUnit_Framework_TestCase
10+
class PhpmigApplicationTest extends TestCase
911
{
1012
public function testAllCommandsRegistered()
1113
{

0 commit comments

Comments
 (0)