Thank you, this did help me a lot. I don't see why the docs for phpspec are so bad aka not in depth at all.
Sep 26, 2014
11
Level 2
GUIDE Laravel 5 and phpspec Setup Instructions
This is not in the phpspec docs.
Here's how to get phpspec working with psr4:
-
run app:name Namespaceto setup Laravel 5 namespace. - add
"phpspec/phpspec": "2.1.*@dev"to composer.json -
run composer update. - write a simple phpspec.yml file in project root it should look like this:
suites:
my_suite:
namespace: Namespace (this is the same as step 1)
psr4_prefix: Namespace (again this is the same as step 1)
src_path: app
spec_prefix: spec
*note the tabs are important. Suites is left aligned. my_suite is one tab. and the remaining are double tabbed.
- test it by describing a spec. To do this run:
phpspec desc Namespace/Test. This should create a spec folder in your root with Namespace/TestSpec.php inside.
*Note phpspec SHOULD create a Namespace folder here.
- run
phpspec run. Say yes when it asks to create the file. This should create a file called Test.php in your app folder.
*Note phpspec SHOULD NOT create a Namespace folder here. Composer.json is setup to autoload files placed in the app folder with the appropriate namespace. In other words app:name sets this up automatically.
If all is well Test.php will be created and your test will return green. Code on.
Please or to participate in this conversation.