Skip to content

Commit

Permalink
[Integration] Improved SetupFactory exception msgs to be user friendly
Browse files Browse the repository at this point in the history
  • Loading branch information
Andrew Longosz committed Sep 22, 2017
1 parent bf22225 commit ea6d3ab
Showing 1 changed file with 9 additions and 2 deletions.
11 changes: 9 additions & 2 deletions Repository/Tests/BaseTest.php
Expand Up @@ -158,12 +158,19 @@ protected function getSetupFactory()
{
if (null === $this->setupFactory) {
if (false === isset($_ENV['setupFactory'])) {
throw new \ErrorException('Missing mandatory setting $_ENV["setupFactory"].');
throw new \ErrorException(
'Missing mandatory setting $_ENV["setupFactory"]. You are trying to run integration tests. Use one of the available phpunit-integration-*.xml configurations'
);
}

$setupClass = $_ENV['setupFactory'];
if (false === class_exists($setupClass)) {
throw new \ErrorException('$_ENV["setupFactory"] does not reference an existing class.');
throw new \ErrorException(
sprintf(
'$_ENV["setupFactory"] does not reference an existing class. Class %s does not exist. Did you forget to install a dependency?',
$setupClass
)
);
}

$this->setupFactory = new $setupClass();
Expand Down

0 comments on commit ea6d3ab

Please sign in to comment.