35 $this->_objectManager = new \Magento\Framework\TestFramework\Unit\Helper\ObjectManager($this);
36 $this->httpContext = $this->getMockBuilder(\
Magento\Framework\
App\Http\Context::class)
37 ->disableOriginalConstructor()
38 ->setMethods([
'getValue'])
40 $this->_customerUrl = $this->getMockBuilder(\
Magento\Customer\Model\Url::class)
41 ->disableOriginalConstructor()
42 ->setMethods([
'getLogoutUrl',
'getLoginUrl'])
45 $context = $this->_objectManager->getObject(\
Magento\Framework\View\Element\Template\Context::class);
46 $this->_block = $this->_objectManager->getObject(
47 \
Magento\Customer\Block\Account\AuthorizationLink::class,
49 'context' => $context,
50 'httpContext' => $this->httpContext,
51 'customerUrl' => $this->_customerUrl,
58 $this->httpContext->expects($this->once())
60 ->will($this->returnValue(
true));
62 $this->assertEquals(
'Sign Out', $this->_block->getLabel());
67 $this->httpContext->expects($this->once())
69 ->will($this->returnValue(
false));
71 $this->assertEquals(
'Sign In', $this->_block->getLabel());
76 $this->httpContext->expects($this->once())
78 ->will($this->returnValue(
true));
80 $this->_customerUrl->expects($this->once())->method(
'getLogoutUrl')->will($this->returnValue(
'logout url'));
82 $this->assertEquals(
'logout url', $this->_block->getHref());
87 $this->httpContext->expects($this->once())
89 ->will($this->returnValue(
false));
91 $this->_customerUrl->expects($this->once())->method(
'getLoginUrl')->will($this->returnValue(
'login url'));
93 $this->assertEquals(
'login url', $this->_block->getHref());