public function testGetData()
 {
     $this->object->setValue('key1', 'value1', 'default1');
     $this->object->setValue('key2', 'value2', 'default2');
     $this->object->setValue('key3', 'value3', 'value3');
     $this->object->unsValue('key1');
     $this->assertEquals(['key2' => 'value2'], $this->object->getData());
 }
Exemple #2
0
 /**
  * Send Vary coookie
  * @return void
  */
 public function sendVary()
 {
     $data = $this->context->getData();
     if (!empty($data)) {
         ksort($data);
         $vary = sha1(serialize($data));
         $this->cookie->set(self::COOKIE_VARY_STRING, $vary, null, '/');
     } else {
         $this->cookie->set(self::COOKIE_VARY_STRING, null, -1, '/');
     }
 }
Exemple #3
0
 /**
  * Send Vary cookie
  *
  * @return void
  */
 public function sendVary()
 {
     $data = $this->context->getData();
     if (!empty($data)) {
         ksort($data);
         $cookieValue = sha1(serialize($data));
         $sensitiveCookMetadata = $this->cookieMetadataFactory->createSensitiveCookieMetadata()->setPath('/');
         $this->cookieManager->setSensitiveCookie(self::COOKIE_VARY_STRING, $cookieValue, $sensitiveCookMetadata);
     } else {
         $cookieMetadata = $this->cookieMetadataFactory->createCookieMetadata()->setPath('/');
         $this->cookieManager->deleteCookie(self::COOKIE_VARY_STRING, $cookieMetadata);
     }
 }