Lately I've been learning about phpspec and gulp and decided to integrate them in my workflow. When I installed phpspec via composer, I get the file structure of:
- vendor
- bin
- phpspec
- bin
there are more files but and folders but these are the relevant.
In my CMD I'm currently pointing the root of my project and trying to run:
vendor/bin/phpspec
However, I get an error saying 'vendor' isn't recognizes as internal or external command...
so I moved into my bin folder by doing cd vendor/bin and then run phpspec and it indeed works. However, when I try to describe a class phpspec describe SeatsHandler it creates my files not in the root directory it creates them inside the vendor/bin folder:
- vendor
- bin
- phpspec
- spec
- src
- bin
I tried to see how I can configure that and read about phpspec.yml. I've created such file along with app directory in my main folder (would love to get rid of app directory):
suites:
app_suite:
src_path: app
I tried putting this file in my main directory, but it didn't work, I got the same result as before. I also tried moving this file into vendor/bin but no avail.
How can I make phpspec create the files in my root directory instead of inside vendor/bin? Also, why does it ignore the phpspec.yml?
EDIT:
I managed to make it work by modifying my phpspec.yml into:
suites:
app_suite:
src_path: ../../src/
spec_path: ../../
And put it in vendor/bin. However, a question still remains, how can I run phpspec without going inside the vendor/bin directory in CMD?
in your composer.json file, just add the
"bin-dir": "bin"underconfiglike so:and youll get a
binfolder on your root directory along with thevendordirectory.then you can run phpspec on your root directory exactly as you want.