/**
  * Delete cookie with reason of logout
  *
  * @return $this
  */
 public function deleteLogoutReasonCookie()
 {
     $metaData = $this->createCookieMetaData();
     $metaData->setPath('/' . $this->backendData->getAreaFrontName())->setDuration(-1);
     $this->phpCookieManager->setPublicCookie(self::LOGOUT_REASON_CODE_COOKIE_NAME, '', $metaData);
     return $this;
 }
 public function testSetTooManyCookies()
 {
     /** @var PublicCookieMetadata $publicCookieMetadata */
     $publicCookieMetadata = $this->objectManager->getObject('Magento\\Framework\\Stdlib\\Cookie\\PublicCookieMetadata');
     $cookieValue = 'some_value';
     // Set self::MAX_NUM_COOKIES number of cookies in superglobal $_COOKIE.
     for ($i = count($_COOKIE); $i < self::MAX_NUM_COOKIES; $i++) {
         $_COOKIE['test_cookie_' . $i] = 'some_value';
     }
     $this->scopeMock->expects($this->once())->method('getPublicCookieMetadata')->with()->will($this->returnValue($publicCookieMetadata));
     try {
         $this->cookieManager->setPublicCookie(self::MAX_COOKIE_SIZE_TEST_NAME, $cookieValue, $publicCookieMetadata);
         $this->fail('Failed to throw exception of too many cookies.');
     } catch (CookieSizeLimitReachedException $e) {
         $this->assertEquals('Unable to send the cookie. Maximum number of cookies would be exceeded.', $e->getMessage());
     }
 }