getMock('Symfony\Component\DependencyInjection\ContainerBuilder'); $container ->expects($this->atLeastOnce()) ->method('addCompilerPass') ->with($this->isInstanceOf('Symfony\\Component\\DependencyInjection\\Compiler\\CompilerPassInterface')); $bundle = new FOSElasticaBundle(); $bundle->build($container); } }