Skip to content
This repository was archived by the owner on Jan 29, 2020. It is now read-only.

Commit 0426703

Browse files
committed
Added DefaultUser test
1 parent 4c3313c commit 0426703

File tree

1 file changed

+37
-0
lines changed

1 file changed

+37
-0
lines changed

test/DefaultUserTest.php

Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
<?php
2+
/**
3+
* @see https://github.com/zendframework/zend-expressive-authentication for the canonical source repository
4+
* @copyright Copyright (c) 2018 Zend Technologies USA Inc. (https://www.zend.com)
5+
* @license https://github.com/zendframework/zend-expressive-authentication/blob/master/LICENSE.md New BSD License
6+
*/
7+
8+
declare(strict_types=1);
9+
10+
namespace ZendTest\Expressive\Authentication;
11+
12+
use PHPUnit\Framework\TestCase;
13+
use Zend\Expressive\Authentication\DefaultUser;
14+
use Zend\Expressive\Authentication\UserInterface;
15+
16+
class DefaultUserTest extends TestCase
17+
{
18+
public function testConstructor()
19+
{
20+
$user = new DefaultUser();
21+
$this->assertInstanceOf(UserInterface::class, $user);
22+
}
23+
24+
public function testSetGetIdentity()
25+
{
26+
$user = new DefaultUser();
27+
$user->setIdentity('foo');
28+
$this->assertEquals('foo', $user->getIdentity());
29+
}
30+
31+
public function testSetGetRoles()
32+
{
33+
$user = new DefaultUser();
34+
$user->setRoles(['foo', 'bar']);
35+
$this->assertEquals(['foo', 'bar'], $user->getRoles());
36+
}
37+
}

0 commit comments

Comments
 (0)