phpspec / phpspec

SpecBDD Framework for PHP
http://www.phpspec.net
Other
1.87k stars 276 forks source link

0 examples error #26

Closed cordoval closed 12 years ago

cordoval commented 12 years ago

cordoval@ms:~/sites-2/FormModelProjectBundle/src/Cordova/Bundle/PhpSpecBundle/Description$ phpspec NewBowlingGame.php -c -b

Finished in 0.000943 seconds 0 examples

MarcelloDuarte commented 12 years ago

Can we see a gist of your NewBowlingGame.php?

cordoval commented 12 years ago

sure

<?php
namespace Cordova\Bundle\PhpSpecBundle\Description;

class DescribeNewBowlingGame extends \PHPSpec\Context
{

    private $bowling = null;

    public function before()
    {
        $this->bowling = $this->spec(new Bowling);
    }

    public function itShouldScore0ForGutterGame()
    {
        for ($i=1; $i<=20; $i++) {
            // someone is really bad at bowling!
            $this->bowling->hit(0);
        }
        $this->bowling->score->should->equal(0);
    }

}
cordoval commented 12 years ago

I am now trying adding the Describe word before the class name and the file ...

MarcelloDuarte commented 12 years ago

You should call your file NewBowlingGameSpec.php. DescribeNewBowlingGame should also work, but the former is common in other Spec frameworks.

cordoval commented 12 years ago

yes very weird, did somewhat work after I played with the names however

PHP Fatal error:  Class 'Cordova\Bundle\PhpSpecBundle\Description\Bowling' not found in /home/cordoval/sites-    2/FormModelProjectBundle/src/Cordova/Bundle/PhpSpecBundle/Description/NewBowlingGameSpec.php on line 13

I am putting the namespace and everything and it will not find Bowling in the same folder, does it have to have Spec too?

MarcelloDuarte commented 12 years ago

you need to require it somehow. PHPSpec autoload will not load the Cordova\Bundle\PhpSpecBundle\Description\Bowling class

cordoval commented 12 years ago

can i use the sf2 autoloader for that? trying that first, this should work, it worked for Zend, for PHPUnit, why not PHPSpec, that is why i thought in the bundle....

cordoval commented 12 years ago

there should at least be a bootstrapper or something like on behat

cordoval commented 12 years ago

/home/cordoval/sites-2/FormModelProjectBundle/vendor/behat/mink/tests/bootstrap.php ???

cordoval commented 12 years ago

got it but the problem to have a bootstrap remains

cordoval commented 12 years ago

thanks @MarcelloDuarte