Upgraded drupal core with security updates
[yaffs-website] / web / core / tests / Drupal / Tests / Core / Session / AnonymousUserSessionTest.php
1 <?php
2
3 namespace Drupal\Tests\Core\Session;
4
5 use Drupal\Tests\UnitTestCase;
6 use Drupal\Core\Session\AnonymousUserSession;
7 use Drupal\user\RoleInterface;
8
9 /**
10  * @coversDefaultClass \Drupal\Core\Session\AnonymousUserSession
11  * @group Session
12  */
13 class AnonymousUserSessionTest extends UnitTestCase {
14
15   /**
16    * Tests the method getRoles exclude or include locked roles based in param.
17    *
18    * @covers ::getRoles
19    * @todo Move roles constants to a class/interface
20    */
21   public function testUserGetRoles() {
22     $anonymous_user = new AnonymousUserSession();
23     $this->assertEquals([RoleInterface::ANONYMOUS_ID], $anonymous_user->getRoles());
24     $this->assertEquals([], $anonymous_user->getRoles(TRUE));
25   }
26
27 }