Skip to content

Fix exception #6

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Dec 5, 2016
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 1 addition & 2 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -1,9 +1,8 @@
language: php

php:
- 5.4
- 5.5
- 5.6
- 7.0

before_script:
- composer install
Expand Down
2 changes: 1 addition & 1 deletion lib/Migrator.php
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down
14 changes: 14 additions & 0 deletions tests/Functional/MigrationTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -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.
*/
Expand Down