/** * @expectedException \League\Tactician\Exception\MissingHandlerException */ public function testGetHandlerThrowsExceptionForNotFound() { $definitions = ['OtherCommand' => 'my_bundle.order.id']; $this->container->shouldReceive('get')->never(); $this->locator = new ContainerBasedHandlerLocator($this->container, $definitions); $this->locator->getHandlerForCommand('MyFakeCommand'); }
public function setUp() { $this->role = 'IS_FOOBAR'; $this->container = \Mockery::mock('Symfony\\Component\\DependencyInjection\\ContainerInterface'); $this->sc = \Mockery::mock('Symfony\\Component\\Security\\Core\\SecurityContextInterface'); $this->doc = \Mockery::mock('Symfony\\Cmf\\Bundle\\CoreBundle\\PublishWorkflow\\PublishableReadInterface'); $this->adm = \Mockery::mock('Symfony\\Component\\Security\\Core\\Authorization\\AccessDecisionManagerInterface'); $this->stdClass = new \stdClass(); $this->pwfc = new PublishWorkflowChecker($this->container, $this->adm, $this->role); $this->container->shouldReceive('get')->with('security.context')->andReturn($this->sc); // assuming Symfony <2.6 $this->container->shouldReceive('has')->with('security.context')->andReturn(true); $this->container->shouldReceive('has')->with('security.token_storage')->andReturn(false); }
/** * @covers Braincrafted\Bundle\BootstrapBundle\Command\GenerateCommand::execute() */ public function testExecuteNoLessFilter() { $this->container->shouldReceive('getParameter')->with('braincrafted_bootstrap.customize')->andReturn(array('variables_file' => __DIR__ . '/x/variables.less')); $this->container->shouldReceive('getParameter')->with('braincrafted_bootstrap.less_filter')->andReturn('none'); // mock the Kernel or create one depending on your needs $application = new Application($this->kernel); $application->add(new GenerateCommand()); $command = $application->find('braincrafted:bootstrap:generate'); $commandTester = new CommandTester($command); $commandTester->execute(array('command' => $command->getName())); $this->assertRegExp('/configured with "less" or "lessphp"/', $commandTester->getDisplay()); }
public function testBundleCallsForTypeRegistryDuringBoot() { $this->container->shouldReceive('get')->with('enum.type.registry')->once(); $this->bundle->boot(); }