phpspec2 example

223 views
Skip to first unread message

Bba

unread,
Dec 28, 2012, 8:29:24 AM12/28/12
to phpsp...@googlegroups.com
Hi guys,
Good Job on phpspec2!
Am having an issue ring to use the run command of phpspec2
after a desc in which it creates a file in the spec folder
any attempt to use the run command will always try to create the real class even when it is existing
Thanks

ftassi

unread,
Dec 28, 2012, 12:36:59 PM12/28/12
to phpsp...@googlegroups.com
This should be because phpspec is not able to find the class you're describing, maybe an autoload Issue or a wrong namespace ?

Cheers

Francesco

Bba

unread,
Dec 29, 2012, 10:49:38 AM12/29/12
to phpsp...@googlegroups.com

Hi Francesco,
you are right, it was an autoload  problem
fixed it
Thanks for the response

Bba

Tyler Collier

unread,
Feb 21, 2013, 2:22:52 PM2/21/13
to phpsp...@googlegroups.com
Can you explain where autoload code should go? I'm a developer but unfamiliar with PHP's autoload. I read http://www.php.net/manual/en/function.spl-autoload-register.php and get the idea but am wondering if there's a standard place that autoloading is already done in phpspec or if I'm expected to add my own? If I change the autoloading information in vendor/composer/autoload_namespaces.php, (I change the "'' => $baseDir . '/src'," line to "'' => $mypath"), phpspec no longer READS the files in src/ (it doesn't seem to use $mypath) but still wants to write them out to src/.

Konstantin Kudryashov

unread,
Feb 25, 2013, 4:30:33 AM2/25/13
to phpsp...@googlegroups.com
Composer handles autoloading on its own: http://getcomposer.org/doc/00-intro.md#autoloading

Konstantin Kudryashov
--- PHP developer, BDD evangelist, Scrum master

a: http://about.me/everzet
b: http://everzet.com
c: https://github.com/everzet

--
You received this message because you are subscribed to the Google Groups "PHPSpec - Behavior Driven Design (BDD) for PHP" group.
To unsubscribe from this group and stop receiving emails from it, send an email to phpspec-dev...@googlegroups.com.
To post to this group, send email to phpsp...@googlegroups.com.
Visit this group at http://groups.google.com/group/phpspec-dev?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.
 
 

Chris Yates

unread,
Mar 27, 2013, 5:11:46 AM3/27/13
to phpsp...@googlegroups.com

I am having the same issue - running PHPSpec2 created the object but subsequent runs don't find it and offer to create it.

I am using Windows 7 and have installed PHPSpec2 in c:\phpsepc and added it to my path to make it globally available

I am running PHPSpec2 from under my project development directory: c:\users\chris\projects\markdown\phpspec

Under this I have the spec directory and PHPSpec2 creates the src directory and the Markdown object on the first run.

Subsequent runs to not find the Markdown object.

What am I not doing and/or doing wrong?

Thanks in advance.

Luis Cordova

unread,
Apr 30, 2013, 8:02:51 PM4/30/13
to phpsp...@googlegroups.com
Did you solve the problem?
I run sometimes into problems but moving namespaces around and putting the specs into the spec folder and having the namespace for specs include `spec` in front solves the problem. This is mimicking what it used to be done in tests phpunit where you had a test folder. In this case the spec becomes part of the namespace. Yes and it is lowercase.
Reply all
Reply to author
Forward
0 new messages