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

add info about git and default directory #43

Merged
merged 3 commits into from
Sep 6, 2017

Conversation

benharold
Copy link
Contributor

While I was working through the docker-phpqa tutorial, I ran into a couple of gotchas. Specifically:

  • If you run phpqa outside of a git repo it throws an error
  • If you run phpqa without creating the default phpt/ directory, it throws an error

I've updated the tutorial to indicate these circumstances.

@ramsey
Copy link
Member

ramsey commented Aug 15, 2017

@brunoric and @jpjoao, would you mind reviewing this?

Copy link
Contributor

@brunoric brunoric left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

HI @benharold, thank you so much for your contribution! You found an edge case in the phpqa generate command. I just opened an issue about it and I will work on it.


The `phpqa` tool expects you to be operating in the context of a `git`
repository. So before continuing, you'll want to decide where you'll be storing
your test files, and create a `git` repo in that directory.
Copy link
Contributor

@brunoric brunoric Aug 15, 2017

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You don't need a git repository. You can store your .phpt files anywhere in your system. For example, you can simply create a .phpt file in your $HOME folder and run phpqa run $HOME/your_test.phpt and it should work. If this is not working as expected for you could you please open an issue at the docker-phpqa repository? I just opened one about the phpqa generate command, but please feel free to add more info there or open any other issue if you think that you are facing something else.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sorry, I should have been more specific. This is related to the phpqa generate command, not the phpqa run command.

It is also important that you have a `phpt/` directory within that repo.
By default, `phpqa` places tests that it generates in the `phpt/` directory and
will throw an error if the directory does not exist. You can override this
behavior as described below.
Copy link
Contributor

@brunoric brunoric Aug 15, 2017

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Early versions of phpqa were indeed with phpt as default directory, but this is not required since a couple of weeks. Could you please make sure that you have the latest version of the tool?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm not sure how to check the version. I ran phpqa -v and phpqa --version but neither gave me a version. I just installed this today from the PHP TestFest tutorial instructions.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Great, the tool misses indeed a version info. Just created another issue to implement that. It will for sure help when any user needs to report a problem.

the `phpt/` directory.

If you want to override the destination directory where the files are generated
you can pass it as the first argument of the generate command:
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The recommended way, for now, is to always pass the target directory. Maybe this tutorial is not clear enough about it or even we could improve a bit the API in order to consider the directory as the current one when the generate command doesn't receive one.

@brunoric
Copy link
Contributor

Just finished a fix for the misleading error that you reported @benharold. As soon as the pull request gets approved it should solve the default directory problem for the phpqa generate command. I would suggest updating this pull request (this one you created for the phptestfest tutorial) with the information about the behaviour when not providing a target directory.

@ramsey
Copy link
Member

ramsey commented Sep 4, 2017

Is this pull request still relevant?

@benharold
Copy link
Contributor Author

The phpqa tool has been updated so it no longer expects to find itself in a git repo. I've updated this pull request accordingly. The rest of the changes are basically editorial.

@ramsey ramsey merged commit ca62da2 into phpcommunity:master Sep 6, 2017
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.

None yet

3 participants