objectManager = new \Magento\Framework\TestFramework\Unit\Helper\ObjectManager($this); $this->guestUserContext = $this->objectManager->getObject( \Magento\Webapi\Model\Authorization\GuestUserContext::class ); } public function testGetUserId() { $this->assertEquals(null, $this->guestUserContext->getUserId()); } public function testGetUserType() { $this->assertEquals(UserContextInterface::USER_TYPE_GUEST, $this->guestUserContext->getUserType()); } }