Skip to content

Commit 644f414

Browse files
authored
Merge pull request #6 from phpcr/fix_exception
Fix exception
2 parents ec9f152 + 78ba5e9 commit 644f414

File tree

3 files changed

+16
-3
lines changed

3 files changed

+16
-3
lines changed

.travis.yml

+1-2
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,8 @@
11
language: php
22

33
php:
4-
- 5.4
5-
- 5.5
64
- 5.6
5+
- 7.0
76

87
before_script:
98
- composer install

lib/Migrator.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ public function __construct(
4141
public function initialize()
4242
{
4343
if ($this->versionStorage->hasVersioningNode()) {
44-
throw MigratorException('Will not re-initialize');
44+
throw new MigratorException('This repository has already been initialized. Will not re-initialize.');
4545
}
4646

4747
foreach (array_keys($this->versionCollection->getAllVersions()) as $timestamp) {

tests/Functional/MigrationTest.php

+14
Original file line numberDiff line numberDiff line change
@@ -159,6 +159,20 @@ public function testInitialize()
159159
$this->assertCount(2, $nodes);
160160
}
161161

162+
/**
163+
* It should throw an exception if trying to reiniitialize.
164+
*
165+
* @expectedException PHPCR\Migrations\Exception\MigratorException
166+
* @expectedExceptionMessage Will not re-initialize
167+
*/
168+
public function testReinitialize()
169+
{
170+
$this->addVersion(self::VERSION1);
171+
$this->addVersion(self::VERSION2);
172+
$this->getMigrator()->initialize();
173+
$this->getMigrator()->initialize();
174+
}
175+
162176
/**
163177
* It should migrate to the next version.
164178
*/

0 commit comments

Comments
 (0)