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 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. */