From d80056b54af9360040897e675e5b3ea8a994a23a Mon Sep 17 00:00:00 2001 From: dantleech Date: Mon, 5 Dec 2016 17:39:13 +0000 Subject: [PATCH 1/2] Fix and test for re-initialize exception --- lib/Migrator.php | 2 +- tests/Functional/MigrationTest.php | 14 ++++++++++++++ 2 files changed, 15 insertions(+), 1 deletion(-) diff --git a/lib/Migrator.php b/lib/Migrator.php index 8b3a6be..eac6d09 100644 --- a/lib/Migrator.php +++ b/lib/Migrator.php @@ -41,7 +41,7 @@ public function __construct( public function initialize() { if ($this->versionStorage->hasVersioningNode()) { - throw MigratorException('Will not re-initialize'); + throw new MigratorException('This repository has already been initialized. Will not re-initialize.'); } foreach (array_keys($this->versionCollection->getAllVersions()) as $timestamp) { diff --git a/tests/Functional/MigrationTest.php b/tests/Functional/MigrationTest.php index 64f270a..4963b18 100644 --- a/tests/Functional/MigrationTest.php +++ b/tests/Functional/MigrationTest.php @@ -159,6 +159,20 @@ public function testInitialize() $this->assertCount(2, $nodes); } + /** + * It should throw an exception if trying to reiniitialize. + * + * @expectedException PHPCR\Migrations\Exception\MigratorException + * @expectedExceptionMessage Will not re-initialize + */ + public function testReinitialize() + { + $this->addVersion(self::VERSION1); + $this->addVersion(self::VERSION2); + $this->getMigrator()->initialize(); + $this->getMigrator()->initialize(); + } + /** * It should migrate to the next version. */ From 78ba5e9af0fdf1bb9051f940e20b11bb6bbe4838 Mon Sep 17 00:00:00 2001 From: dantleech Date: Mon, 5 Dec 2016 17:43:05 +0000 Subject: [PATCH 2/2] Bumped PHP versions --- .travis.yml | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/.travis.yml b/.travis.yml index a7af76a..cfa4dad 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,9 +1,8 @@ language: php php: - - 5.4 - - 5.5 - 5.6 + - 7.0 before_script: - composer install