Skip to content
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
5 changes: 5 additions & 0 deletions lib/VersionFinder.php
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,11 @@ class VersionFinder

public function __construct(array $paths)
{
if (empty($paths)) {
throw new \RuntimeException(
'No paths were provided to the version finder.'
);
}
$this->paths = $paths;
}

Expand Down
12 changes: 12 additions & 0 deletions tests/Unit/VersionFinderTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -35,4 +35,16 @@ public function testGetCollection()
$versions = $collection->getAllVersions();
$this->assertCount(3, $versions);
}

/**
* It should do nothing if no migrations paths are given.
*
* @expectedException \RuntimeException
* @expectedExceptionMessage No paths were provided
*/
public function testNoMigrationPaths()
{
$collection = (new VersionFinder(array()))->getCollection();
$versions = $collection->getAllVersions();
}
}