Skip to content
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

fix: adds trait_exists to ensure orchestra/testbench is installed #957

Merged
merged 12 commits into from
Oct 12, 2021

Conversation

rajyan
Copy link
Contributor

@rajyan rajyan commented Oct 9, 2021

  • Added or updated tests
  • Documented user facing changes
  • Updated CHANGELOG.md

resolves #863

Related PRs

I personally think getcwd() is not a good solution to
find Laravel Application bootstrap file, but could not find a better solution that solve cases like #856.

so, for cases that Laravel application bootstrap file cannot be loaded by getcwd().'/bootstrap/app.php',
I just don't want

Fatal error: Trait 'Orchestra\Testbench\Concerns\CreatesApplication' not found in /var/source/app/laravel/vendor/nunomaduro/larastan/src/ApplicationResolver.php on line 16

and handle bootstrap by my own.

This PR adds trait_exists to ensure Orchestra\Testbench\Concerns\CreatesApplication exists, which is called in
ApplicationResolver::resolve()
https://github.com/nunomaduro/larastan/blob/master/src/ApplicationResolver.php#L18

@rajyan rajyan marked this pull request as draft October 9, 2021 14:52
@rajyan rajyan changed the title add class_exists to ensure orchestra/testbench is installed add trait_exists to ensure orchestra/testbench is installed Oct 9, 2021
@rajyan rajyan marked this pull request as ready for review October 9, 2021 15:07
@rajyan rajyan marked this pull request as draft October 9, 2021 15:08
@rajyan
Copy link
Contributor Author

rajyan commented Oct 9, 2021

I'll wait for #955

@szepeviktor
Copy link
Collaborator

szepeviktor commented Oct 9, 2021

Thank you @rajyan. This is a very good thought.
Could you throw an exception in the else branch explaining that we couldn't find an app nor Testbench?

@szepeviktor
Copy link
Collaborator

I'll wait for #955

Resolved in #959
Please proceed.

@rajyan
Copy link
Contributor Author

rajyan commented Oct 10, 2021

@szepeviktor
Thank you for your fix & review.

I added an Exception.
Also, retried #852 , being careful about backward compatibility this time.

@rajyan rajyan marked this pull request as ready for review October 10, 2021 12:45
@szepeviktor
Copy link
Collaborator

Also, retried #852 , being careful about backward compatibility this time.

Please prioritize getcwd() as it was before.

bootstrap.php Outdated Show resolved Hide resolved
rajyan and others added 2 commits October 10, 2021 22:21
Co-authored-by: Viktor Szépe <viktor@szepe.net>
@canvural canvural changed the title add trait_exists to ensure orchestra/testbench is installed fix: adds trait_exists to ensure orchestra/testbench is installed Oct 12, 2021
@canvural canvural merged commit 74e8d7f into larastan:master Oct 12, 2021
@canvural
Copy link
Collaborator

Thank you!

@rajyan rajyan deleted the fix/issue-863 branch October 12, 2021 08:40
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Feature: Make possible to use custom bootstrap files (Don't throw fatal errors in bootstrap.php)
3 participants