Magento 2 Documentation  2.3
Documentation for Magento 2 CMS v2.3 (December 2018)
GuestUserContextTest.php
Go to the documentation of this file.
1 <?php
8 
10 
14 class GuestUserContextTest extends \PHPUnit\Framework\TestCase
15 {
19  protected $objectManager;
20 
24  protected $guestUserContext;
25 
26  protected function setUp()
27  {
28  $this->objectManager = new \Magento\Framework\TestFramework\Unit\Helper\ObjectManager($this);
29 
30  $this->guestUserContext = $this->objectManager->getObject(
31  \Magento\Webapi\Model\Authorization\GuestUserContext::class
32  );
33  }
34 
35  public function testGetUserId()
36  {
37  $this->assertEquals(null, $this->guestUserContext->getUserId());
38  }
39 
40  public function testGetUserType()
41  {
42  $this->assertEquals(UserContextInterface::USER_TYPE_GUEST, $this->guestUserContext->getUserType());
43  }
44 }