Closed cordoval closed 12 years ago
Can we see a gist of your NewBowlingGame.php?
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);
}
}
I am now trying adding the Describe word before the class name and the file ...
You should call your file NewBowlingGameSpec.php. DescribeNewBowlingGame should also work, but the former is common in other Spec frameworks.
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?
you need to require it somehow. PHPSpec autoload will not load the Cordova\Bundle\PhpSpecBundle\Description\Bowling class
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....
there should at least be a bootstrapper or something like on behat
/home/cordoval/sites-2/FormModelProjectBundle/vendor/behat/mink/tests/bootstrap.php ???
got it but the problem to have a bootstrap remains
thanks @MarcelloDuarte
cordoval@ms:~/sites-2/FormModelProjectBundle/src/Cordova/Bundle/PhpSpecBundle/Description$ phpspec NewBowlingGame.php -c -b
Finished in 0.000943 seconds 0 examples