Ejemplo n.º 1
0
 /**
  * Creates a Client.
  *
  * @param array $options An array of options to pass to the createKernel class
  * @param array $server  An array of server parameters
  * @param array $cookies An array of Symfony\Component\BrowserKit\Cookie
  *
  * @return Client A Client instance
  */
 public function createClient(array $options = array(), array $server = array(), array $cookies = array())
 {
     if (null !== $this->kernel && $this->kernelReset) {
         $this->kernel->shutdown();
         $this->kernel->boot();
     }
     if (null === $this->kernel) {
         $this->kernel = $this->createKernel($options);
         $this->kernel->boot();
     }
     $client = $this->kernel->getContainer()->get('test.client');
     $client->setServerParameters($server);
     foreach ($cookies as $cookie) {
         $client->getCookieJar()->set($cookie);
     }
     return $client;
 }
Ejemplo n.º 2
0
 protected function defineCurrency(Request $request)
 {
     $currency = null;
     if ($request->query->has("currency")) {
         $currency = CurrencyQuery::create()->findOneByCode($request->query->get("currency"));
         if ($currency) {
             if (false === $this->app->getContainer()->isScopeActive('request')) {
                 $this->app->getContainer()->enterScope('request');
                 $this->app->getContainer()->set('request', $request, 'request');
             }
             $this->eventDispatcher->dispatch(TheliaEvents::CHANGE_DEFAULT_CURRENCY, new CurrencyChangeEvent($currency, $request));
         }
     } else {
         $currency = $request->getSession()->getCurrency(false);
     }
     if (null === $currency) {
         $currency = Currency::getDefaultCurrency();
     }
     return $currency;
 }
 /**
  * @return mixed
  */
 public function getContainer()
 {
     return static::$kernel->getContainer();
 }