コード例 #1
0
 /**
  * Test CookieInjector:inject() method.
  */
 public function testCookieInjection()
 {
     $cookieName = 'test';
     $cookieValue = 'test_value';
     $cookieInjector = new CookieInjector();
     $request = $this->createRequestMock($cookieName, $cookieValue);
     $cookieModel = new GenericCookie($cookieName);
     $cookieInjector->addCookieModel($cookieModel);
     $cookieInjector->inject($request);
     $this->assertEquals($cookieValue, $cookieModel->getValue());
 }
コード例 #2
0
 /**
  * OnKernelRequest.
  *
  * @param GetResponseEvent $event
  */
 public function onKernelRequest(GetResponseEvent $event)
 {
     $this->cookieInjector->inject($event->getRequest());
 }