ILIAS  trunk Revision v11.0_alpha-3011-gc6b235a2e85
UserActionTest.php
Go to the documentation of this file.
1<?php
2
19declare(strict_types=1);
20
22
24use PHPUnit\Framework\TestCase;
26use ilObjUser;
27use DateTimeImmutable;
28
29require_once __DIR__ . '/ContainerMock.php';
30
31class UserActionTest extends TestCase
32{
33 use ContainerMock;
34
35 public function testConstruct(): void
36 {
37 $this->assertInstanceOf(UserAction::class, new UserAction($this->mock(ilObjUser::class), $this->mock(Clock::class)));
38 }
39
40 public function testModifiedNow(): void
41 {
42 $date = new DateTimeImmutable();
43
44 $instance = new UserAction($this->mockTree(ilObjUser::class, ['getId' => 34]), $this->mockTree(Clock::class, ['now' => $date]));
45
46 $edit = $instance->modifiedNow();
47 $this->assertSame(34, $edit->user());
48 $this->assertSame($date, $edit->time());
49 }
50}
User class.