GuestUserContextTest.php 1.1 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344
  1. <?php
  2. /**
  3. * Copyright © Magento, Inc. All rights reserved.
  4. * See COPYING.txt for license details.
  5. */
  6. namespace Magento\Webapi\Test\Unit\Model\Authorization;
  7. use Magento\Authorization\Model\UserContextInterface;
  8. /**
  9. * Tests Magento\Webapi\Model\Authorization\GuestUserContext
  10. */
  11. class GuestUserContextTest extends \PHPUnit\Framework\TestCase
  12. {
  13. /**
  14. * @var \Magento\Framework\TestFramework\Unit\Helper\ObjectManager
  15. */
  16. protected $objectManager;
  17. /**
  18. * @var \Magento\Webapi\Model\Authorization\GuestUserContext
  19. */
  20. protected $guestUserContext;
  21. protected function setUp()
  22. {
  23. $this->objectManager = new \Magento\Framework\TestFramework\Unit\Helper\ObjectManager($this);
  24. $this->guestUserContext = $this->objectManager->getObject(
  25. \Magento\Webapi\Model\Authorization\GuestUserContext::class
  26. );
  27. }
  28. public function testGetUserId()
  29. {
  30. $this->assertEquals(null, $this->guestUserContext->getUserId());
  31. }
  32. public function testGetUserType()
  33. {
  34. $this->assertEquals(UserContextInterface::USER_TYPE_GUEST, $this->guestUserContext->getUserType());
  35. }
  36. }