本文整理汇总了PHP中Thelia\Core\HttpFoundation\Request::setSession方法的典型用法代码示例。如果您正苦于以下问题:PHP Request::setSession方法的具体用法?PHP Request::setSession怎么用?PHP Request::setSession使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Thelia\Core\HttpFoundation\Request
的用法示例。
在下文中一共展示了Request::setSession方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: setUp
protected function setUp()
{
$this->controller = $controller = $this->getMock("Thelia\\Controller\\BaseController", ["getParser", "render", "renderRaw"]);
/**
* Reset static :: $formDefinition on controllers
*/
$this->definitionReflection = $reflection = (new \ReflectionObject($this->controller))->getProperty('formDefinition');
$reflection->setAccessible(true);
$this->formDefinition = $reflection->getValue();
$reflection->setValue(null);
/**
* Add the test type to the factory and
* the form to the container
*/
$factory = new FormFactoryBuilder();
$factory->addExtension(new CoreExtension());
$factory->addType(new TestType());
/**
* Construct the container
*/
$container = new Container();
$container->set("thelia.form_factory_builder", $factory);
$container->set("thelia.translator", new Translator($container));
$container->setParameter("thelia.parser.forms", array("test_form" => "Thelia\\Tests\\Resources\\Form\\TestForm"));
$request = new Request();
$request->setSession(new Session(new MockArraySessionStorage()));
$container->set("request", $request);
$container->set("thelia.forms.validator_builder", new ValidatorBuilder());
$container->set("event_dispatcher", new EventDispatcher());
$this->controller->setContainer($container);
}
示例2: getGetResponseEvent
protected function getGetResponseEvent()
{
$request = new Request();
$request->setSession(new Session(new MockArraySessionStorage()));
/** @var HttpKernelInterface $kernelMock */
$kernelMock = $this->getMockBuilder('Symfony\\Component\\HttpKernel\\HttpKernelInterface')->disableOriginalConstructor()->getMock();
return new GetResponseEvent($kernelMock, $request, HttpKernelInterface::MASTER_REQUEST);
}
示例3: getContainer
public function getContainer()
{
$container = new \Symfony\Component\DependencyInjection\ContainerBuilder();
$container->set("event_dispatcher", $this->getDispatcher());
$request = new Request();
$request->setSession($this->session);
$container->set("request", $request);
return $container;
}
示例4: setUp
public function setUp()
{
$this->request = new Request();
$this->session = new Session(new MockArraySessionStorage());
$this->request->setSession($this->session);
$translator = new Translator($this->getMock('\\Symfony\\Component\\DependencyInjection\\ContainerInterface'));
$this->cartAction = new \Thelia\Action\Cart($this->request, new TokenProvider($this->request, $translator, 'baba au rhum'));
$this->dispatcherNull = $this->getMock('Symfony\\Component\\EventDispatcher\\EventDispatcherInterface');
$this->dispatcher = $this->getMock('Symfony\\Component\\EventDispatcher\\EventDispatcherInterface', array(), array(), '', true, true, true, false);
$this->dispatcher->expects($this->any())->method('dispatch')->will($this->returnCallback(function ($type, $event) {
$event->setDispatcher($this->dispatcher);
if ($type == TheliaEvents::CART_RESTORE_CURRENT) {
$this->cartAction->restoreCurrentCart($event);
} elseif ($type == TheliaEvents::CART_CREATE_NEW) {
$this->cartAction->createEmptyCart($event);
}
}));
}
示例5: init
protected function init()
{
$container = $this->getContainer();
$request = new Request();
$request->setSession(new Session(new MockArraySessionStorage()));
/** @var RequestStack $requestStack */
$requestStack = $container->get('request_stack');
$requestStack->push($request);
}
示例6: setUp
public function setUp()
{
$session = new Session(new MockArraySessionStorage());
$request = new Request();
$request->setSession($session);
$this->mailerFactory = $this->getMockBuilder("Thelia\\Mailer\\MailerFactory")->disableOriginalConstructor()->getMock();
$translator = new Translator(new Container());
$this->tokenProvider = new TokenProvider($request, $translator, 'test');
}
示例7: getContainer
public function getContainer()
{
$container = new ContainerBuilder();
$container->set("event_dispatcher", $this->getDispatcher());
$request = new Request();
$request->setSession($this->session);
$container->set("request", $request);
return $container;
}
示例8: setUp
public function setUp()
{
parent::setUp();
$session = new Session(new MockArraySessionStorage());
$request = new Request();
$request->setSession($session);
$this->requestStack = new RequestStack();
$this->requestStack->push($request);
}
示例9: getContainer
public function getContainer()
{
$container = new \Symfony\Component\DependencyInjection\ContainerBuilder();
$dispatcher = $this->getMock("Symfony\\Component\\EventDispatcher\\EventDispatcherInterface");
$container->set("event_dispatcher", $dispatcher);
$fileManager = new FileManager(["document.product" => "Thelia\\Model\\ProductDocument", "image.product" => "Thelia\\Model\\ProductImage", "document.category" => "Thelia\\Model\\CategoryDocument", "image.category" => "Thelia\\Model\\CategoryImage", "document.content" => "Thelia\\Model\\ContentDocument", "image.content" => "Thelia\\Model\\ContentImage", "document.folder" => "Thelia\\Model\\FolderDocument", "image.folder" => "Thelia\\Model\\FolderImage", "document.brand" => "Thelia\\Model\\BrandDocument", "image.brand" => "Thelia\\Model\\BrandImage"]);
$container->set("thelia.file_manager", $this->getFileManager());
$request = new Request();
$request->setSession($this->session);
$container->set("request", $request);
return $container;
}
示例10: getContainer
public function getContainer()
{
$container = new \Symfony\Component\DependencyInjection\ContainerBuilder();
$container->set("thelia.translator", new Translator(new Container()));
$dispatcher = $this->getMock("Symfony\\Component\\EventDispatcher\\EventDispatcherInterface");
$container->set("event_dispatcher", $dispatcher);
$request = new Request();
$request->setSession($this->getSession());
$container->set("request", $request);
$container->set("thelia.securitycontext", new SecurityContext($request));
$this->buildContainer($container);
return $container;
}
示例11: getContainer
public function getContainer()
{
$container = new ContainerBuilder();
$container->set("thelia.translator", new Translator(new Container()));
$dispatcher = $this->getMockEventDispatcher();
$container->set("event_dispatcher", $dispatcher);
$request = new Request();
$request->setSession($this->getSession());
$container->set("request", $request);
$requestStack = new RequestStack();
$requestStack->push($request);
$container->set("request_stack", $requestStack);
new Translator($container);
$container->set("thelia.securitycontext", new SecurityContext($requestStack));
$this->buildContainer($container);
return $container;
}
示例12: setUp
public function setUp()
{
$this->container = new ContainerBuilder();
$this->container->setParameter("thelia.parser.loops", ["tested-loop" => $this->getTestedClassName()]);
$session = new Session(new MockArraySessionStorage());
$request = new Request();
$requestStack = new RequestStack();
$request->setSession($session);
/*$stubEventdispatcher = $this->getMockBuilder('\Symfony\Component\EventDispatcher\EventDispatcher')
->disableOriginalConstructor()
->getMock();
$stubSecurityContext = $this->getMockBuilder('\Thelia\Core\Security\SecurityContext')
->disableOriginalConstructor()
->getMock();*/
/*$stubAdapter->expects($this->any())
->method('getTranslator')
->will($this->returnValue($stubTranslator));*/
/*$this->request = new Request();
$this->request->setSession(new Session(new MockArraySessionStorage()));
$this->dispatcher = new EventDispatcher();
$this->securityContext = new SecurityContext($this->request);*/
$stubRouterAdmin = $this->getMockBuilder('\\Symfony\\Component\\Routing\\Router')->disableOriginalConstructor()->setMethods(array('getContext'))->getMock();
$stubRequestContext = $this->getMockBuilder('\\Symfony\\Component\\Routing\\RequestContext')->disableOriginalConstructor()->setMethods(array('getHost'))->getMock();
$stubRequestContext->expects($this->any())->method('getHost')->will($this->returnValue('localhost'));
$stubRouterAdmin->expects($this->any())->method('getContext')->will($this->returnValue($stubRequestContext));
$requestStack->push($request);
$this->container->set('request', $request);
$this->container->set('request_stack', $requestStack);
$this->container->set('event_dispatcher', new EventDispatcher());
$this->container->set('thelia.translator', new Translator($this->container));
$this->container->set('thelia.securityContext', new SecurityContext($requestStack));
$this->container->set('router.admin', $stubRouterAdmin);
$this->container->set('thelia.url.manager', new URL($this->container));
$this->container->set('thelia.taxEngine', new TaxEngine($requestStack));
$this->instance = $this->getTestedInstance();
$this->instance->initializeArgs($this->getMandatoryArguments());
}
示例13: setUp
public function setUp()
{
$this->backup_mail_template = ConfigQuery::read('active-mail-template', 'default');
ConfigQuery::write('active-mail-template', 'test');
@mkdir(TemplateHelper::getInstance()->getActiveMailTemplate()->getAbsolutePath(), 0777, true);
$container = new ContainerBuilder();
$session = new Session(new MockArraySessionStorage());
$request = new Request();
$dispatcher = $this->getMock("Symfony\\Component\\EventDispatcher\\EventDispatcherInterface");
$request->setSession($session);
/*
* public function __construct(
Request $request, EventDispatcherInterface $dispatcher, ParserContext $parserContext,
$env = "prod", $debug = false)
*/
$container->set("event_dispatcher", $dispatcher);
$container->set('request', $request);
$this->parser = new SmartyParser($request, $dispatcher, new ParserContext($request), 'dev', true);
$this->parser->setTemplateDefinition(TemplateHelper::getInstance()->getActiveMailTemplate());
$container->set('thelia.parser', $this->parser);
$this->container = $container;
}
示例14: setUp
protected function setUp()
{
/**
* Add the test type to the factory and
* the form to the container
*/
$factory = new FormFactoryBuilder();
$factory->addExtension(new CoreExtension());
$factory->addType(new TestType());
/**
* Construct the container
*/
$container = new Container();
$container->set("thelia.form_factory_builder", $factory);
$container->set("thelia.translator", new Translator($container));
$container->setParameter("thelia.parser.forms", $definition = array("test_form" => "Thelia\\Tests\\Resources\\Form\\TestForm"));
$request = new Request();
$request->setSession(new Session(new MockArraySessionStorage()));
$container->set("request", $request);
$container->set("thelia.forms.validator_builder", new ValidatorBuilder());
$container->set("event_dispatcher", new EventDispatcher());
$this->factory = new TheliaFormFactory($request, $container, $definition);
}
示例15: setUp
public function setUp()
{
$session = new Session(new MockArraySessionStorage());
$request = new Request();
$request->setSession($session);
$this->container = new ContainerBuilder();
$this->container->set("event_dispatcher", $this->getMockEventDispatcher());
$this->container->set('request', $request);
$this->requestStack = new RequestStack();
$this->requestStack->push($request);
$this->container->set('request_stack', $this->requestStack);
$this->securityContext = new SecurityContext($this->requestStack);
$this->orderEvent = new OrderEvent(new OrderModel());
$mailerFactory = new MailerFactory($this->getMockEventDispatcher(), $this->getMockParserInterface());
$this->orderAction = new Order($this->requestStack, $mailerFactory, $this->securityContext);
/* load customer */
$this->customer = $this->loadCustomer();
if (null === $this->customer) {
return;
}
/* fill cart */
$this->cart = $this->fillCart();
}