Skip to content

Commit

Permalink
fixed tests
Browse files Browse the repository at this point in the history
  • Loading branch information
alex40724 committed Jul 3, 2024
1 parent 2ac06b6 commit 5316a66
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 3 deletions.
9 changes: 7 additions & 2 deletions Services/Container/Content/class.ViewManager.php
Original file line number Diff line number Diff line change
Expand Up @@ -29,10 +29,15 @@ class ViewManager
protected ViewSessionRepository $view_repo;

public function __construct(
ViewSessionRepository $view_repo
ViewSessionRepository $view_repo,
?int $user_id = null
) {
global $DIC; // fixes 41305, to do: move to constructor
$this->user_id = $DIC->user()->getId();
if (is_null($user_id)) {
$this->user_id = $DIC->user()->getId();
} else {
$this->user_id = $user_id;
}

$this->view_repo = $view_repo;
}
Expand Down
5 changes: 4 additions & 1 deletion Services/Container/test/ContentViewManagerTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,11 @@ class ContentViewManagerTest extends TestCase
protected function setUp(): void
{
parent::setUp();
if (!defined('ANONYMOUS_USER_ID')) {
define('ANONYMOUS_USER_ID', 13);
}
$view_repo = new \ILIAS\Container\Content\ViewSessionRepository();
$this->manager = new \ILIAS\Container\Content\ViewManager($view_repo);
$this->manager = new \ILIAS\Container\Content\ViewManager($view_repo, 5);
}

protected function tearDown(): void
Expand Down

0 comments on commit 5316a66

Please sign in to comment.