public function testSessionUrlVarWithoutMatchedHostsAndBaseUrl()
    {
        $requestMock = $this->getRequestMock();
        $model = $this->getUrlModel(
            [
                'session' => $this->sessionMock,
                'request' => $requestMock,
                'sidResolver' => $this->sidResolverMock,
                'scopeResolver' => $this->scopeResolverMock,
                'routeParamsResolverFactory' => $this->getRouteParamsResolverFactory(),
            ]
        );

        $requestMock->expects($this->once())->method('getHttpHost')->will($this->returnValue('localhost'));
        $this->scopeMock->expects($this->once())
            ->method('getBaseUrl')
            ->will($this->returnValue('http://example.com'));
        $this->scopeResolverMock->expects($this->any())
            ->method('getScope')
            ->will($this->returnValue($this->scopeMock));
        $this->sidResolverMock->expects($this->once())->method('getSessionIdQueryParam')
            ->will($this->returnValue('SID'));
        $this->sessionMock->expects($this->once())->method('getSessionId')
            ->will($this->returnValue('session-id'));

        $this->assertEquals(
            '<a href="http://example.com/?SID=session-id">www.example.com</a>',
            $model->sessionUrlVar('<a href="http://example.com/?___SID=U">www.example.com</a>')
        );
    }
Exemplo n.º 2
0
 /**
  * Generate cache identifier taking into account current area/package/theme/store
  *
  * @param string $suffix
  * @return string
  */
 protected function generateCacheId($suffix = '')
 {
     return "LAYOUT_{$this->theme->getArea()}_STORE{$this->scope->getId()}_{$this->theme->getId()}{$suffix}";
 }