protected function registerBag(SymfonySession $session) { $bag = new AttributeBag('_' . self::BAG_NAME); $bag->setName(self::BAG_NAME); $session->registerBag($bag); $this->sessionBag = $session->getBag(self::BAG_NAME); }
protected function setUp() { $this->attributes = new AttributeBag(); $this->flashes = new FlashBag(); $this->data = array($this->attributes->getStorageKey() => array('foo' => 'bar'), $this->flashes->getStorageKey() => array('notice' => 'hello')); $this->storage = new MockArraySessionStorage(); $this->storage->registerBag($this->flashes); $this->storage->registerBag($this->attributes); $this->storage->setSessionData($this->data); }
public function testClear() { $this->bag->clear(); $this->assertEquals(array(), $this->bag->all()); }
/** * Gets the stored configuration for all the features for this provider * * @return array */ protected function getConfiguration() { $all = $this->bag->all(); return $all; }
protected function setUp() { $this->array = array('hello' => 'world', 'always' => 'be happy', 'user.login' => 'drak', 'csrf.token' => array('a' => '1234', 'b' => '4321'), 'category' => array('fishing' => array('first' => 'cod', 'second' => 'sole'))); $this->bag = new AttributeBag('_sf2'); $this->bag->initialize($this->array); }
public function getEncrypted($key) { $encryptedData = $this->bag->get($key); return $this->encryptor->decrypt($encryptedData); }
/** * @param AttributeBag $params * @throws UserException */ protected function checkParams(AttributeBag $params) { foreach (['token', 'id'] as $name) { if (!$params->has($name) || empty($params->get($name))) { throw new UserException("Missing parameter '{$name}'"); } } }
/** * {@inheritdoc} */ public function clear() { $retval = parent::clear(); $this->sessionStorage->save(); return $retval; }