0
0
Fork 0
mirror of https://github.com/kevinpapst/kimai2.git synced 2025-05-22 00:28:47 +00:00
kevinpapst_kimai2/tests/Controller/HomepageControllerTest.php

52 lines
1.3 KiB
PHP
Raw Permalink Normal View History

<?php
/*
* This file is part of the Kimai time-tracking app.
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace App\Tests\Controller;
use App\Entity\User;
use App\Entity\UserPreference;
use App\Form\Type\InitialViewType;
/**
* @group integration
*/
class HomepageControllerTest extends ControllerBaseTest
{
2024-02-07 23:47:25 +01:00
public function testIsSecure(): void
{
$this->assertUrlIsSecured('/homepage');
}
2024-02-07 23:47:25 +01:00
public function testIndexAction(): void
{
$client = $this->getClientForAuthenticatedUser(User::ROLE_USER);
$this->request($client, '/homepage');
$this->assertIsRedirect($client, '/en/timesheet/');
}
2024-02-07 23:47:25 +01:00
public function testIndexActionWithChangedPreferences(): void
{
$client = $this->getClientForAuthenticatedUser(User::ROLE_USER);
2020-04-08 14:50:15 +02:00
$em = $this->getEntityManager();
$user = $this->getUserByRole(User::ROLE_USER);
$pref = (new UserPreference('login_initial_view', 'my_profile'))
->setType(InitialViewType::class);
2021-10-05 15:30:29 +02:00
$em->persist($pref);
$user->addPreference($pref);
2021-10-05 15:30:29 +02:00
$user->setLanguage('ar');
$em->flush();
$this->request($client, '/homepage');
$this->assertIsRedirect($client, '/ar/profile/');
}
}