function it_adds_code_with_type_text_by_default(FormEvent $event, FormInterface $form, CodeAwareInterface $resource)
 {
     $event->getData()->willReturn($resource);
     $event->getForm()->willReturn($form);
     $resource->getCode()->shouldBeCalled()->willReturn('Code12');
     $form->add('code', 'text', Argument::containing(true))->shouldBeCalled();
     $this->preSetData($event);
 }
示例#2
0
 function it_adds_a_novalidate_option($html)
 {
     // Expect
     $html->attributes(Arg::containing('novalidate'))->shouldBeCalled();
     // When
     $this->novalidate(true);
     $this->open(['method' => 'GET']);
 }
 function it_sets_code_as_disabled_when_resource_is_not_new(FormEvent $event, FormInterface $form, CodeAwareInterface $resource)
 {
     $event->getData()->willReturn($resource);
     $event->getForm()->willReturn($form);
     $resource->getCode()->shouldBeCalled()->willReturn(null);
     $form->add('code', Argument::type('string'), Argument::containing(false))->shouldBeCalled();
     $this->preSetData($event);
 }
 public function testTagging()
 {
     $definitionObserver = $this->prophesize('\\Symfony\\Component\\DependencyInjection\\Definition');
     $definitionObserver->addMethodCall("addHelper", Argument::allOf(Argument::containing('test'), Argument::containing(new Reference('handlebars.helper.test'))))->shouldBeCalled();
     $containerObserver = $this->prophesize('\\Symfony\\Component\\DependencyInjection\\ContainerBuilder');
     $containerObserver->has('handlebars.helper')->willReturn(true)->shouldBeCalled();
     $containerObserver->findDefinition('handlebars.helper')->willReturn($definitionObserver->reveal())->shouldBeCalled();
     $taggedServices = ['handlebars.helper.test' => [['id' => 'test']]];
     $containerObserver->findTaggedServiceIds('handlebars.helper')->willReturn($taggedServices)->shouldBeCalled();
     $helperPass = new HelperPass();
     $helperPass->process($containerObserver->reveal());
 }
 function it_should_pop_changes_when_an_error_occurs(Repository $repository)
 {
     $event = new RunnerEvent(new TasksCollection(), new GitPreCommitContext(new FilesCollection()), new TaskResultCollection());
     $repository->run('stash', Argument::containing('save'))->shouldBeCalled();
     $repository->run('stash', Argument::containing('pop'))->shouldBeCalled();
     $this->saveStash($event);
     $this->handleErrors();
 }
 /**
  * @param \Zend\EventManager\EventManager $eventManager
  */
 public function it_should_attach_an_eventlistener($eventManager)
 {
     $eventManager->attach('create', Argument::containing('create'), 1000)->shouldBeCalled();
     $this->attach($eventManager);
 }
 /**
  * @param \Symfony\Component\DependencyInjection\ContainerBuilder $container
  * @param \Symfony\Component\DependencyInjection\Definition $def
  */
 function it_adds_globals($container, $def)
 {
     $container->getParameter(Argument::any())->willReturn('test');
     $def->addMethodCall('addGlobal', Argument::containing('test'))->shouldBeCalled();
     $this->process($container);
 }
示例#8
0
 function let(RouteParser $parser, FastrouteDispatcherFactory $factory, Route $route, Dispatcher $dispatcher)
 {
     $parser->parse(Argument::containing($route->getWrappedObject()))->willReturn(['parsed']);
     $factory->create(['parsed'])->willReturn($dispatcher);
     $this->beConstructedWith($parser, $factory);
 }
 public function testRender()
 {
     $loader = $this->prophesize('JaySDe\\HandlebarsBundle\\Loader\\FilesystemLoader');
     $helper = $this->prophesize('JaySDe\\HandlebarsBundle\\HandlebarsHelperService');
     $profiler = $this->prophesize('JaySDe\\HandlebarsBundle\\HandlebarsProfileExtension');
     $profiler->enter(Argument::type('Twig_Profiler_Profile'))->shouldBeCalled();
     $profiler->leave(Argument::type('Twig_Profiler_Profile'))->shouldBeCalled();
     $cache = $this->prophesize('JaySDe\\HandlebarsBundle\\Cache\\Filesystem');
     $cache->generateKey('test')->willReturn('test');
     $cache->isFresh('test')->willReturn(true);
     $cache->load('test')->willReturn(function () {
         return 'hello world';
     });
     $cache->write('test', Argument::any(), Argument::containing(Argument::type('Symfony\\Component\\Config\\Resource\\FileResource')))->shouldBeCalled();
     $environment = new HandlebarsEnvironment($loader->reveal(), $helper->reveal(), ['auto_reload' => true], $cache->reveal(), $profiler->reveal());
     $this->assertSame('hello world', $environment->render('test', []));
 }
示例#10
0
 function it_traces_the_span(ConsumerInterface $decoratedConsumer, Tracer $tracer)
 {
     $tracer->trace(Argument::containing(Argument::type(Span::class)))->shouldBeCalled();
     $this->execute(new AMQPMessage(''));
 }