/** * @dataProvider getSlug */ public function testBoot($text, $expected) { $bundle = new SonataProductBundle(); $container = $this->getMock('Symfony\\Component\\DependencyInjection\\ContainerInterface'); $container->expects($this->exactly(2))->method('getParameter')->will($this->returnCallback(function ($value) { if ($value == 'sonata.product.product.class') { return 'Sonata\\Test\\ProductBundle\\Product'; } if ($value == 'sonata.product.slugify_service') { return 'slug_service'; } })); $container->expects($this->once())->method('get')->will($this->returnValue(Slugify::create())); $bundle->setContainer($container); $bundle->boot(); $product = new Product(); $product->setSlug($text); $this->assertEquals($product->getSlug(), $expected); }