public function setUp() { $this->pwfc = $this->getMockBuilder('Symfony\\Cmf\\Bundle\\CoreBundle\\PublishWorkflow\\PublishWorkflowChecker')->disableOriginalConstructor()->getMock(); $this->container = $this->getMock('Symfony\\Component\\DependencyInjection\\ContainerInterface'); $this->container->expects($this->any())->method('get')->with('cmf_core.publish_workflow.checker')->will($this->returnValue($this->pwfc)); $this->voter = new MenuContentVoter($this->container); $this->token = new AnonymousToken('', ''); }
/** * {@inheritdoc} */ protected function setUp() { $this->container = $this->getMock('Symfony\\Component\\DependencyInjection\\ContainerInterface'); $this->command = new FixMediaContextCommand(); $this->command->setContainer($this->container); $this->application = new Application(); $this->application->add($this->command); $this->tester = new CommandTester($this->application->find('sonata:media:fix-media-context')); $this->pool = $pool = $this->getMockBuilder('Sonata\\MediaBundle\\Provider\\Pool')->disableOriginalConstructor()->getMock(); $this->contextManger = $contextManger = $this->getMock('Sonata\\ClassificationBundle\\Model\\ContextManagerInterface'); $this->categoryManger = $categoryManger = $this->getMockBuilder('Sonata\\ClassificationBundle\\Entity\\CategoryManager')->disableOriginalConstructor()->getMock(); $this->container->expects($this->any())->method('get')->will($this->returnCallback(function ($id) use($pool, $contextManger, $categoryManger) { switch ($id) { case 'sonata.media.pool': return $pool; case 'sonata.classification.manager.context': return $contextManger; case 'sonata.classification.manager.category': return $categoryManger; } return; })); }