added configurable view after login (#523)

This commit is contained in:
Kevin Papst
2019-01-29 02:15:12 +01:00
committed by GitHub
parent 67dab35b57
commit fe4c3c10d6
8 changed files with 144 additions and 6 deletions

View File

@@ -11,6 +11,7 @@ namespace App\Tests\Controller;
use App\Entity\User;
use App\Entity\UserPreference;
use App\Form\Type\InitialViewType;
use App\Form\Type\LanguageType;
/**
@@ -31,13 +32,20 @@ class HomepageControllerTest extends ControllerBaseTest
$this->assertIsRedirect($client, '/en/timesheet/');
}
public function testIndexActionWithChangedLanguage()
public function testIndexActionWithChangedPreferences()
{
$client = $this->getClientForAuthenticatedUser(User::ROLE_USER);
$em = $client->getContainer()->get('doctrine.orm.entity_manager');
$user = $this->getUserByRole($em, User::ROLE_USER);
$pref = (new UserPreference())
->setName('login.initial_view')
->setValue('my_profile')
->setType(InitialViewType::class);
$user->addPreference($pref);
$pref = (new UserPreference())
->setName('language')
->setValue('ar')
@@ -48,6 +56,6 @@ class HomepageControllerTest extends ControllerBaseTest
$em->persist($pref);
$this->request($client, '/homepage');
$this->assertIsRedirect($client, '/ar/timesheet/');
$this->assertIsRedirect($client, '/ar/profile/');
}
}