added avatars, show user teams in list, new team dashboard widgets (#1150)

This commit is contained in:
Kevin Papst
2019-10-03 13:44:16 +02:00
committed by GitHub
parent 718ad4b398
commit e8c25d8ac5
120 changed files with 2585 additions and 642 deletions

View File

@@ -16,12 +16,6 @@ use App\Entity\User;
*/
class AboutControllerTest extends ControllerBaseTest
{
public function testDebugIsSecure()
{
$this->assertUrlIsSecured('/about/debug');
$this->assertUrlIsSecuredForRole(User::ROLE_ADMIN, '/about/debug');
}
public function testIndexAction()
{
$client = $this->getClientForAuthenticatedUser(User::ROLE_USER);
@@ -34,18 +28,4 @@ class AboutControllerTest extends ControllerBaseTest
$this->assertEquals(1, count($result));
$this->assertContains('MIT License', $result->text());
}
public function testDebugAction()
{
$client = $this->getClientForAuthenticatedUser(User::ROLE_SUPER_ADMIN);
$this->assertAccessIsGranted($client, '/about/debug');
$content = $client->getResponse()->getContent();
$this->assertContains('<h3 class="box-title">Environment</h3>', $content);
$this->assertContains('<h3 class="box-title">PHP</h3>', $content);
$this->assertContains('<h3 class="box-title">Server</h3>', $content);
$this->assertContains('', $content);
$this->assertContains('PHP', $content);
}
}

View File

@@ -9,6 +9,7 @@
namespace App\Tests\Controller;
use App\DataFixtures\UserFixtures;
use App\Entity\User;
/**
@@ -29,6 +30,19 @@ class DashboardControllerTest extends ControllerBaseTest
$this->assertMainContentClass($client, 'dashboard');
}
public function testIndexActionForUserWithTeams()
{
$client = self::createClient([], [
'PHP_AUTH_USER' => 'test_user_1',
'PHP_AUTH_PW' => UserFixtures::DEFAULT_PASSWORD,
]);
$this->request($client, '/dashboard/');
$this->assertTrue($client->getResponse()->isSuccessful());
self::assertEquals(1, $client->getCrawler()->filter('section.content .WidgetUserTeams')->count());
// team 1 has no project assignment right now
self::assertEquals(0, $client->getCrawler()->filter('section.content .WidgetUserTeamProjects')->count());
}
public function testIndexActionForAdmin()
{
$client = $this->getClientForAuthenticatedUser(User::ROLE_ADMIN);

View File

@@ -0,0 +1,33 @@
<?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;
/**
* @group integration
*/
class DoctorControllerTest extends ControllerBaseTest
{
public function testDoctorIsSecure()
{
$this->assertUrlIsSecured('/doctor');
$this->assertUrlIsSecuredForRole(User::ROLE_ADMIN, '/doctor');
}
public function testIndexAction()
{
$client = $this->getClientForAuthenticatedUser(User::ROLE_SUPER_ADMIN);
$this->assertAccessIsGranted($client, '/doctor');
$result = $client->getCrawler()->filter('.content .box-header');
$this->assertEquals(7, count($result));
}
}

View File

@@ -35,7 +35,7 @@ class ProfileControllerTest extends ControllerBaseTest
$this->assertTrue($client->getResponse()->isSuccessful());
$this->assertHasNoEntriesWithFilter($client);
$this->assertHasProfileBox($client, UserFixtures::USERNAME_USER);
$this->assertHasProfileBox($client, 'John Doe');
$this->assertHasAboutMeBox($client, UserFixtures::USERNAME_USER);
}
@@ -68,7 +68,7 @@ class ProfileControllerTest extends ControllerBaseTest
$this->assertContains('var userProfileChart' . $year . ' = new Chart(', $content);
}
$this->assertHasProfileBox($client, UserFixtures::USERNAME_USER);
$this->assertHasProfileBox($client, 'John Doe');
$this->assertHasAboutMeBox($client, UserFixtures::USERNAME_USER);
}
@@ -76,7 +76,7 @@ class ProfileControllerTest extends ControllerBaseTest
{
$profileBox = $client->getCrawler()->filter('div.box-body.box-profile');
$this->assertEquals(1, $profileBox->count());
$profileAvatar = $profileBox->filter('img.profile-user-img');
$profileAvatar = $profileBox->filter('img.img-circle');
$this->assertEquals(1, $profileAvatar->count());
$alt = $profileAvatar->attr('alt');

View File

@@ -43,7 +43,7 @@ class TeamControllerTest extends ControllerBaseTest
'help' => 'https://www.kimai.org/documentation/teams.html'
]);
$this->assertHasDataTable($client);
$this->assertDataTableRowCount($client, 'datatable_admin_teams', 5);
$this->assertDataTableRowCount($client, 'datatable_admin_teams', 6);
}
public function testIndexActionWithSearchTermQuery()
@@ -85,7 +85,7 @@ class TeamControllerTest extends ControllerBaseTest
'name' => 'Test Team',
]
]);
$this->assertIsRedirect($client, $this->createUrl('/admin/teams/1/edit'));
$this->assertIsRedirect($client, $this->createUrl('/admin/teams/2/edit'));
$client->followRedirect();
$this->assertHasFlashSuccess($client);
$this->assertHasCustomerAndProjectPermissionBoxes($client);

View File

@@ -29,7 +29,7 @@ class UserControllerTest extends ControllerBaseTest
$client = $this->getClientForAuthenticatedUser(User::ROLE_SUPER_ADMIN);
$this->assertAccessIsGranted($client, '/admin/user/');
$this->assertHasDataTable($client);
$this->assertDataTableRowCount($client, 'datatable_user_admin', 5);
$this->assertDataTableRowCount($client, 'datatable_user_admin', 7);
}
public function testIndexActionWithSearchTermQuery()
@@ -232,6 +232,6 @@ class UserControllerTest extends ControllerBaseTest
$client = $this->getClientForAuthenticatedUser(User::ROLE_SUPER_ADMIN);
$this->assertAccessIsGranted($client, '/admin/user/permissions');
$this->assertHasDataTable($client);
$this->assertDataTableRowCount($client, 'datatable_user_admin_permissions', 81);
$this->assertDataTableRowCount($client, 'datatable_user_admin_permissions', 83);
}
}