1

我正在为我的 Symfony2 项目中的一些服务编写一些单元测试。我需要通过服务容器访问服务,我正在使用这种方法:

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
}

$kernel->boot()被调用时,我得到以下错误:'MongoCursor' not found in Doctrine/Bundle/MongoDBBundle/DependencyInjection/Configuration.php。我查看了 Configuration.php 并没有提到MongoCursor。这是Bundle的版本问题吗?

环境Symfony2.1.6DoctrineMongoDBundle 的 2.0.1 版本

4

1 回答 1

0

由于一个愚蠢的错误,我遇到了同样的问题——我没有启用 mongodb 扩展。

于 2013-04-29T09:31:55.557 回答