-
Notifications
You must be signed in to change notification settings - Fork 32
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
tests: add tests for placeholder exceptions
- Loading branch information
1 parent
d03da2b
commit 37b812f
Showing
1 changed file
with
59 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -10,6 +10,7 @@ | |
use Doctum\RemoteRepository\GitHubRemoteRepository; | ||
use Doctum\Store\JsonStore; | ||
use Doctum\Version\Version; | ||
use LogicException; | ||
|
||
/** | ||
* @author William Desportes <[email protected]> | ||
|
@@ -106,6 +107,64 @@ public function testBasicNoGitCustomNameIntegration(): void | |
], $project->getVersions()); | ||
} | ||
|
||
public function testBasicGitIntegrationMissingCacheDir(): void | ||
{ | ||
$iterator = Finder::create() | ||
->files() | ||
->name('*.php') | ||
->exclude('stubs') | ||
->exclude('database') | ||
->exclude('bootstrap') | ||
->exclude('storage') | ||
->in($dir = __DIR__); | ||
|
||
$versions = GitVersionCollection::create($dir) | ||
->add('master', 'Main Branch') | ||
->add('blob', 'Fish Branch'); | ||
|
||
$doctum = new Doctum($iterator, [ | ||
'title' => 'API', | ||
'versions' => $versions, | ||
'build_dir' => __DIR__ . '/build/%version%', | ||
'default_opened_level' => 2, | ||
'remote_repository' => new GitHubRemoteRepository('RepoName', dirname($dir)), | ||
]); | ||
$this->expectExceptionMessage( | ||
'The "cache_dir" setting must have the "%version%" placeholder as the project has more than one version.' | ||
); | ||
$this->expectException(LogicException::class); | ||
$doctum->getProject(); | ||
} | ||
|
||
public function testBasicGitIntegrationMissingBuildDir(): void | ||
{ | ||
$iterator = Finder::create() | ||
->files() | ||
->name('*.php') | ||
->exclude('stubs') | ||
->exclude('database') | ||
->exclude('bootstrap') | ||
->exclude('storage') | ||
->in($dir = __DIR__); | ||
|
||
$versions = GitVersionCollection::create($dir) | ||
->add('master', 'Main Branch') | ||
->add('blob', 'Fish Branch'); | ||
|
||
$doctum = new Doctum($iterator, [ | ||
'title' => 'API', | ||
'versions' => $versions, | ||
'cache_dir' => __DIR__ . '/cache/%version%', | ||
'default_opened_level' => 2, | ||
'remote_repository' => new GitHubRemoteRepository('RepoName', dirname($dir)), | ||
]); | ||
$this->expectExceptionMessage( | ||
'The "build_dir" setting must have the "%version%" placeholder as the project has more than one version.' | ||
); | ||
$this->expectException(LogicException::class); | ||
$doctum->getProject(); | ||
} | ||
|
||
public function testCliOnlyVersion(): void | ||
{ | ||
$iterator = Finder::create() | ||
|