User profile layout (#2402)

This commit is contained in:
Kevin Papst
2021-03-06 12:34:34 +01:00
committed by GitHub
parent d3099aca39
commit 5583caa9e4
30 changed files with 550 additions and 268 deletions

View File

@@ -74,7 +74,7 @@ class ProfileControllerTest extends ControllerBaseTest
protected function assertHasProfileBox(HttpKernelBrowser $client, string $username)
{
$profileBox = $client->getCrawler()->filter('div.box-body.box-profile');
$profileBox = $client->getCrawler()->filter('div.box-user-profile');
$this->assertEquals(1, $profileBox->count());
$profileAvatar = $profileBox->filter('img.img-circle');
$this->assertEquals(1, $profileAvatar->count());
@@ -87,8 +87,7 @@ class ProfileControllerTest extends ControllerBaseTest
{
$content = $client->getResponse()->getContent();
$this->assertStringContainsString('<h3 class="box-title">About me</h3>', $content);
$this->assertStringContainsString('<td class="text-nowrap pull-right">' . $username . '</td>', $content);
$this->assertStringContainsString('About me', $content);
}
public function getTabTestData()

View File

@@ -153,7 +153,7 @@ class AppExtensionTest extends TestCase
],
'kimai.theme' => [
'active_warning' => 3,
'box_color' => 'green',
'box_color' => 'blue',
'select_type' => 'selectpicker',
'show_about' => true,
'chart' => [

View File

@@ -340,7 +340,7 @@ class ConfigurationTest extends TestCase
],
'theme' => [
'active_warning' => 3,
'box_color' => 'green',
'box_color' => 'blue',
'select_type' => 'selectpicker',
'auto_reload_datatable' => false,
'show_about' => true,

View File

@@ -0,0 +1,44 @@
<?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\Event;
use App\Entity\User;
use App\Event\PageActionsEvent;
use PHPUnit\Framework\TestCase;
/**
* @covers \App\Event\PageActionsEvent
*/
class PageActionsEventTest extends TestCase
{
public function testDefaultValues()
{
$user = new User();
$user->setAlias('foo');
$sut = new PageActionsEvent($user, [], 'foo');
$this->assertSame($user, $sut->getUser());
$this->assertEquals([], $sut->getActions());
$this->assertEquals(['actions' => []], $sut->getPayload());
$sut = new PageActionsEvent($user, ['hello' => 'world'], 'foo');
$this->assertSame($user, $sut->getUser());
$this->assertEquals([], $sut->getActions());
$this->assertEquals(['hello' => 'world', 'actions' => []], $sut->getPayload());
}
public function testSetActions()
{
$sut = new PageActionsEvent(new User(), ['hello' => 'world'], 'foo');
$sut->setActions(['foo' => ['url' => 'bar']]);
$this->assertEquals(['foo' => ['url' => 'bar']], $sut->getActions());
$this->assertEquals(['hello' => 'world', 'actions' => ['foo' => ['url' => 'bar']]], $sut->getPayload());
}
}

View File

@@ -18,6 +18,14 @@ use PHPUnit\Framework\TestCase;
*/
class ThemeEventTest extends TestCase
{
public function testEmpty()
{
$sut = new ThemeEvent();
$this->assertNull($sut->getUser());
$this->assertNull($sut->getPayload());
$this->assertEquals('', $sut->getContent());
}
public function testDefaultValues()
{
$user = new User();
@@ -25,21 +33,7 @@ class ThemeEventTest extends TestCase
$sut = new ThemeEvent($user);
$this->assertNull($sut->getPayload());
$this->assertEquals('', $sut->getContent());
}
/**
* @group legacy
*/
public function testDeprecation()
{
$user = new User();
$user->setAlias('foo');
$sut = new ThemeEvent($user);
$this->assertEquals($user, $sut->getUser());
$this->assertSame($user, $sut->getUser());
}
public function testGetterAndSetter()

View File

@@ -37,7 +37,7 @@ class RuntimeExtensionsTest extends TestCase
public function testGetFunctions()
{
$expected = ['trigger', 'javascript_translations', 'timesheet_exporter', 'active_timesheets', 'encore_entry_css_source', 'render_widget'];
$expected = ['trigger', 'actions', 'javascript_translations', 'timesheet_exporter', 'active_timesheets', 'encore_entry_css_source', 'render_widget'];
$i = 0;
$sut = new RuntimeExtensions();