Skip to content

Commit

Permalink
Fixed tests
Browse files Browse the repository at this point in the history
  • Loading branch information
PavlosIsaris committed Dec 16, 2024
1 parent d257eba commit 3a21306
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions tests/Unit/Controllers/UserControllerTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
namespace Tests\Unit\Controllers;

use App\BusinessLogicLayer\Questionnaire\QuestionnaireResponseManager;
use App\BusinessLogicLayer\Solution\SolutionManager;
use App\BusinessLogicLayer\User\UserDashboardManager;
use App\BusinessLogicLayer\User\UserManager;
use App\Http\Controllers\User\UserController;
Expand All @@ -17,21 +18,23 @@ class UserControllerTest extends TestCase {
private UserDashboardManager $userDashboardManager;
private UserManager $userManager;
private QuestionnaireResponseManager $questionnaireResponseManager;
private SolutionManager $solutionManager;

protected function setUp(): void {
parent::setUp();
$this->user = User::factory()->create();
$this->userDashboardManager = $this->createMock(UserDashboardManager::class);
$this->userManager = $this->createMock(UserManager::class);
$this->questionnaireResponseManager = $this->createMock(QuestionnaireResponseManager::class);
$this->solutionManager = $this->createMock(SolutionManager::class);
Auth::shouldReceive('user')->andReturn($this->user);
}

public function testMyDashboardWithNoBadges() {
$this->userDashboardManager->method('getUserDashboardViewModel')
->willReturn($this->createDashboardViewModel(0, 0, 0));

$controller = new UserController($this->userManager, $this->questionnaireResponseManager, $this->userDashboardManager);
$controller = new UserController($this->userManager, $this->questionnaireResponseManager, $this->userDashboardManager, $this->solutionManager);
$response = $controller->myDashboard();

$this->assertEquals('backoffice.my-dashboard', $response->name());
Expand All @@ -46,7 +49,7 @@ public function testMyDashboardWithBadges() {
$this->userDashboardManager->method('getUserDashboardViewModel')
->willReturn($this->createDashboardViewModel(3, 2, 1));

$controller = new UserController($this->userManager, $this->questionnaireResponseManager, $this->userDashboardManager);
$controller = new UserController($this->userManager, $this->questionnaireResponseManager, $this->userDashboardManager, $this->solutionManager);
$response = $controller->myDashboard();

$this->assertEquals('backoffice.my-dashboard', $response->name());
Expand Down

0 comments on commit 3a21306

Please sign in to comment.