Skip to content

Conversation

devmsh
Copy link
Contributor

@devmsh devmsh commented Jul 29, 2020

In order to test the BuildCommand, I changed some code to make the Builder and BuildCommand more testable

  1. Inject Builder to BuildCommand nested of Static method invocation to unit test the command. We can also provide e Builder facade and return the static method invocation if needed.
  2. Replace file_exists with $this->files->exists to allow tests code to mock it.
  3. Replace exit(1) with return 1 so we can use assertExitCode(1) and prevent the command from killing the test command.
  4. Simplifying defaultDraftFile is not related to the test code, and I can revert the change if you like the old style.

Waiting for your feedback, and if everything goes ok, please select the next candidate to be tested.

Have a nice day 👍

@jasonmccreary
Copy link
Collaborator

Seems good. I'm going to merge this. But watch for the code style failure next time.

Feel free to continue adding tests for the commands.

@jasonmccreary jasonmccreary merged commit 9d2c20f into laravel-shift:master Jul 29, 2020
@devmsh devmsh deleted the build-test branch July 29, 2020 12:00
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.

2 participants