1
votes

I am writing some unit tests for some services I have on my Symfony2 project. I need to access the services via the service container and I am using this approach:

class DummyTest extends \PHPUnit_Framework_TestCase
{
   protected static $kernel;
   protected static $container;

   public static function setUpBeforeClass()
   {
      self::$kernel = new \AppKernel('test', true);
      self::$kernel->boot();
      self::$container = self::$kernel->getContainer();
   }

  //test cases
}

When $kernel->boot() is called I get the following error: 'MongoCursor' not found in Doctrine/Bundle/MongoDBBundle/DependencyInjection/Configuration.php. I looked into the Configuration.php and there was no reference to MongoCursor. Is this a Bundle's version problem?

Environment: Symfony2.1.6 and DoctrineMongoDBundle's version 2.0.1.

1
I was using a php version that did not have the necessary modules. php54 phpunit -c <folder>JVasques

1 Answers

0
votes

I came across the same problem because of a silly mistake - I haven't enabled mongodb extension.