Skip to content

Move tests to autoload-dev #140

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
Sep 16, 2018
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
1 change: 1 addition & 0 deletions .phpstan.neon
Original file line number Diff line number Diff line change
Expand Up @@ -8,3 +8,4 @@ parameters:
- '#Instantiated class Drupal.Core#'
- '#PHPPM.Laravel.SessionGuard#'
- '#Property Illuminate.Auth.SessionGuard#'
- '#Method Illuminate\\Foundation\\Application::register.. invoked with 3 parameters, 1-2 required.#'
2 changes: 1 addition & 1 deletion .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ jobs:
# Unit test
- ./vendor/bin/phpunit
# Static analyzer check
- ./vendor/bin/phpstan analyze -c .phpstan.neon --level=4 --no-progress Bootstraps Bridges Laravel || true
- ./vendor/bin/phpstan analyze -c .phpstan.neon --level=4 --no-progress Bootstraps Bridges Laravel
# Check the code style
- IFS=$'\n'; COMMIT_SCA_FILES=($(git diff --name-only --diff-filter=ACMRTUXB "${TRAVIS_COMMIT_RANGE}")); unset IFS
- ./vendor/bin/php-cs-fixer fix --config=.php_cs.php -v --dry-run --diff --stop-on-violation --using-cache=no --path-mode=intersection -- "${COMMIT_SCA_FILES[@]}"
Expand Down
29 changes: 28 additions & 1 deletion Bootstraps/Laravel.php
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,13 @@ class Laravel implements
*/
protected $app;

/**
* Laravel Application->register() parameter count
*
* @var int
*/
private $appRegisterParameters;

/**
* Instantiate the bootstrap, storing the $appenv
*
Expand Down Expand Up @@ -143,6 +150,26 @@ protected function resetProvider($providerName)
return;
}

$this->app->register($providerName, [], true);
$this->appRegister($providerName, true);
}

/**
* Register application provider
* Workaround for BC break in https://github.com/laravel/framework/pull/25028
* @param string $providerName
* @param bool $force
*/
protected function appRegister($providerName, $force = false)
{
if (!$this->appRegisterParameters) {
$method = new \ReflectionMethod(get_class($this->app), ['name' => 'register']);
$this->appRegisterParameters = count($method->getParameters());
}

if ($this->appRegisterParameters == 3) {
$this->app->register($providerName, [], $force);
} else {
$this->app->register($providerName, $force);
}
}
}
6 changes: 5 additions & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,11 @@
},
"autoload": {
"psr-4": {
"PHPPM\\": "",
"PHPPM\\": ""
}
},
"autoload-dev": {
"psr-4": {
"PHPPM\\Tests\\": "tests"
}
}
Expand Down