mirror of
https://github.com/kevinveenbirkenbach/infinito.git
synced 2025-01-09 14:07:25 +01:00
Implemented more tests for user
This commit is contained in:
parent
577f30e0f7
commit
60a071c428
@ -54,6 +54,7 @@ class User extends BaseUser implements UserInterface
|
||||
parent::__construct();
|
||||
$this->isActive = true;
|
||||
$this->source = new UserSource();
|
||||
$this->source->setUser($this);
|
||||
//LawModificator::grantAllRights($this->source->getNode()->getLaw(), $this->source->getNode());
|
||||
}
|
||||
}
|
||||
|
36
application/tests/Unit/Entity/Attribut/UserAttributTest.php
Normal file
36
application/tests/Unit/Entity/Attribut/UserAttributTest.php
Normal file
@ -0,0 +1,36 @@
|
||||
<?php
|
||||
|
||||
namespace Tests\Unit\Entity\Attribut;
|
||||
|
||||
use PHPUnit\Framework\TestCase;
|
||||
use App\Entity\Attribut\UserAttributInterface;
|
||||
use App\Entity\Attribut\UserAttribut;
|
||||
use App\Entity\UserInterface;
|
||||
|
||||
class UserAttributTest extends TestCase
|
||||
{
|
||||
/**
|
||||
* @var UserAttributInterface
|
||||
*/
|
||||
public $user;
|
||||
|
||||
public function setUp(): void
|
||||
{
|
||||
$this->user = new class() implements UserAttributInterface {
|
||||
use UserAttribut;
|
||||
};
|
||||
}
|
||||
|
||||
public function testConstructor(): void
|
||||
{
|
||||
$this->expectException(\TypeError::class);
|
||||
$this->user->getUser();
|
||||
}
|
||||
|
||||
public function testAccessors(): void
|
||||
{
|
||||
$user = $this->createMock(UserInterface::class);
|
||||
$this->assertNull($this->user->setUser($user));
|
||||
$this->assertEquals($user, $this->user->getUser());
|
||||
}
|
||||
}
|
@ -24,5 +24,7 @@ class UserSourceTest extends TestCase
|
||||
{
|
||||
$this->assertInstanceOf(Collection::class, $this->userSource->getMemberships());
|
||||
$this->assertInstanceOf(NameSourceInterface::class, $this->userSource->getNameSource());
|
||||
$this->expectException(\TypeError::class);
|
||||
$this->userSource->getUser();
|
||||
}
|
||||
}
|
||||
|
@ -47,5 +47,6 @@ class UserTest extends TestCase
|
||||
public function testSource(): void
|
||||
{
|
||||
$this->assertInstanceOf(UserSource::class, $this->user->getSource());
|
||||
$this->assertEquals($this->user, $this->user->getSource()->getUser());
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user