/** * Test delete logout reason cookie * @return void */ public function testDeleteLogoutReasonCookie() { $frontName = 'FrontName'; $this->createCookieMetaData(); $this->backendDataMock->expects($this->once())->method('getAreaFrontName')->willReturn($frontName); $this->cookieMetadataMock->expects($this->once())->method('setPath')->with('/' . $frontName)->willReturnSelf(); $this->cookieMetadataMock->expects($this->once())->method('setDuration')->with(-1)->willReturnSelf(); $this->phpCookieManagerMock->expects($this->once())->method('setPublicCookie')->with(SecurityCookie::LOGOUT_REASON_CODE_COOKIE_NAME, '', $this->cookieMetadataMock)->willReturnSelf(); $this->assertEquals($this->model, $this->model->deleteLogoutReasonCookie()); }
/** * @param bool $isPost * @param int $numOfCalls * @dataProvider afterDispatchTestDataProvider */ public function testAfterDispatch($isPost, $numOfCalls) { $this->messageManagerMock->expects($this->exactly($numOfCalls))->method('hasMessages')->will($this->returnValue(true)); $this->requestMock->expects($this->once())->method('isPost')->will($this->returnValue($isPost)); $this->cookieMetadataFactoryMock->expects($this->exactly($numOfCalls))->method('createPublicCookieMetadata')->will($this->returnValue($this->publicCookieMetadataMock)); $this->publicCookieMetadataMock->expects($this->exactly($numOfCalls))->method('setDuration')->with(MessageBox::COOKIE_PERIOD)->will($this->returnValue($this->publicCookieMetadataMock)); $this->publicCookieMetadataMock->expects($this->exactly($numOfCalls))->method('setPath')->with('/')->will($this->returnValue($this->publicCookieMetadataMock)); $this->publicCookieMetadataMock->expects($this->exactly($numOfCalls))->method('setHttpOnly')->with(false)->will($this->returnValue($this->publicCookieMetadataMock)); $this->cookieManagerMock->expects($this->exactly($numOfCalls))->method('setPublicCookie')->with(MessageBox::COOKIE_NAME, 1, $this->publicCookieMetadataMock); $this->assertSame($this->responseMock, $this->msgBox->afterDispatch($this->objectMock, $this->responseMock)); }