ILIAS  trunk Revision v11.0_alpha-1715-g7fc467680fb
All Data Structures Namespaces Files Functions Variables Enumerations Enumerator Modules Pages
UserActionTest.php
Go to the documentation of this file.
1 <?php
2 
19 declare(strict_types=1);
20 
22 
26 use ilObjUser;
28 
29 require_once __DIR__ . '/ContainerMock.php';
30 
31 class 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 }