-
- {% if years is empty %}
- {{ widgets.callout('warning', 'error.no_entries_found') }}
- {% endif %}
-
-
-
- {% for year,yearStat in years %}
-
{{ year }}
-
-
-
-
- {% endfor %}
-
-
{% for formName, form in forms %}
{{ form_start(form) }}
- {{ form_widget(form) }}
-
+ {{ form_widget(form) }}
+
{{ form_end(form) }}
{% endfor %}
@@ -120,131 +27,3 @@
{% endblock %}
-
-{% macro profile_infos(user, stats, local_time) %}
-
-{% endmacro %}
-
-{% macro profile_box(user, stats) %}
- {% import "@AdminLTE/Macros/default.html.twig" as macro %}
- {% import "macros/widgets.html.twig" as widgets %}
-
-
-
- {{ macro.avatar(user.avatar, user.username, 'profile-user-img img-responsive img-circle') }}
-
{{ widgets.username(user) }}
-
-
{{ user.title }}
-
-
-
-
-
-{% endmacro %}
-
-{# -------------------------------- UNUSED FOR NOW -------------------------------- #}
-{% macro profile_list_unused(user, items, color) %}
- {% import "@AdminLTE/Macros/default.html.twig" as macro %}
- {% import "macros/widgets.html.twig" as widgets %}
-
-
-
-
-
-
-{% endmacro %}
-
-{# -------------------------------- UNUSED FOR NOW -------------------------------- #}
-{% macro profile_box_unused(user, stats, color) %}
- {% import "@AdminLTE/Macros/default.html.twig" as macro %}
- {% import "macros/widgets.html.twig" as widgets %}
-
-
-{% endmacro %}
\ No newline at end of file
diff --git a/templates/user/stats.html.twig b/templates/user/stats.html.twig
new file mode 100644
index 00000000..d2e993c0
--- /dev/null
+++ b/templates/user/stats.html.twig
@@ -0,0 +1,97 @@
+{% extends 'user/layout.html.twig' %}
+{% import "macros/actions.html.twig" as actions %}
+{% import "macros/widgets.html.twig" as widgets %}
+
+{% block profile_content %}
+
+ {% if years is empty %}
+ {{ widgets.callout('warning', 'error.no_entries_found') }}
+ {% endif %}
+
+
+
+ {% for year,yearStat in years %}
+
+ {% embed '@AdminLTE/Widgets/box-widget.html.twig' %}
+ {% block box_title %}{{ year }}{% endblock %}
+ {% block box_body %}
+
+
+
+
+
+ {% endblock %}
+ {% endembed %}
+
+ {% endfor %}
+
+{% endblock %}
diff --git a/tests/API/TimesheetControllerTest.php b/tests/API/TimesheetControllerTest.php
index 01479eb8..afa399a9 100644
--- a/tests/API/TimesheetControllerTest.php
+++ b/tests/API/TimesheetControllerTest.php
@@ -38,7 +38,7 @@ class TimesheetControllerTest extends APIControllerBaseTest
->setHourlyRate(true)
->setAmount(10)
->setUser($this->getUserByRole($em, $role))
- ->setStartDate((new \DateTime('-10 days'))->setTime(0, 0, 1))
+ ->setStartDate((new \DateTime('first day of this month'))->setTime(0, 0, 1))
->setAllowEmptyDescriptions(false)
;
$this->importFixture($em, $fixture);
@@ -124,9 +124,9 @@ class TimesheetControllerTest extends APIControllerBaseTest
public function testGetCollectionWithQuery()
{
- $begin = new \DateTime('-10 days');
+ $begin = new \DateTime('first day of this month');
$begin->setTime(0, 0, 0);
- $end = new \DateTime();
+ $end = new \DateTime('last day of this month');
$end->setTime(23, 59, 59);
$query = [
@@ -162,14 +162,14 @@ class TimesheetControllerTest extends APIControllerBaseTest
->setExported(true)
->setAmount(7)
->setUser($this->getUserByRole($em, User::ROLE_USER))
- ->setStartDate(new \DateTime('-10 days'))
+ ->setStartDate(new \DateTime('first day of this month'))
->setAllowEmptyDescriptions(false)
;
$this->importFixture($em, $fixture);
- $begin = new \DateTime('-10 days');
+ $begin = new \DateTime('first day of this month');
$begin->setTime(0, 0, 0);
- $end = new \DateTime();
+ $end = new \DateTime('last day of this month');
$end->setTime(23, 59, 59);
$query = [
diff --git a/tests/Controller/AboutControllerTest.php b/tests/Controller/AboutControllerTest.php
index 3d7a9831..3a18a230 100644
--- a/tests/Controller/AboutControllerTest.php
+++ b/tests/Controller/AboutControllerTest.php
@@ -17,21 +17,38 @@ use App\Entity\User;
*/
class AboutControllerTest extends ControllerBaseTest
{
- public function testIsSecure()
+ public function testDebugIsSecure()
{
- $this->assertUrlIsSecured('/admin/about');
- $this->assertUrlIsSecuredForRole(User::ROLE_ADMIN, '/admin/about');
+ $this->assertUrlIsSecured('/about/debug');
+ $this->assertUrlIsSecuredForRole(User::ROLE_ADMIN, '/about/debug');
}
public function testIndexAction()
+ {
+ $client = $this->getClientForAuthenticatedUser(User::ROLE_USER);
+ $this->assertAccessIsGranted($client, '/about');
+
+ $result = $client->getCrawler()->filter('ul.nav.nav-stacked li a');
+ $this->assertEquals(3, count($result));
+
+ $result = $client->getCrawler()->filter('div.box-body pre');
+ $this->assertEquals(1, count($result));
+ $this->assertContains('MIT License', $result->text());
+ }
+
+ public function testDebugAction()
{
$client = $this->getClientForAuthenticatedUser(User::ROLE_SUPER_ADMIN);
- $this->assertAccessIsGranted($client, '/admin/about');
+ $this->assertAccessIsGranted($client, '/about/debug');
- $result = $client->getCrawler()->filter('div.nav-tabs-custom ul.nav.nav-tabs li');
- $this->assertEquals(3, count($result));
+ $content = $client->getResponse()->getContent();
+ $this->assertContains('
Environment
', $content);
+ $this->assertContains('
PHP
', $content);
+ $this->assertContains('
Server
', $content);
- $result = $client->getCrawler()->filter('div.nav-tabs-custom div.tab-content div.tab-pane');
- $this->assertEquals(3, count($result));
+ $this->assertContains('Actions', $content);
+ $this->assertContains('', $content);
+ $this->assertContains('PHP', $content);
+ $this->assertContains('
assertTrue($client->getResponse()->isSuccessful());
$this->assertMainContentClass($client, 'dashboard');
}
+
+ /**
+ * This is not a test for the dashbaord, but for the general layout
+ */
+ public function testUserMenuIsAvailable()
+ {
+ $client = $this->getClientForAuthenticatedUser(User::ROLE_USER);
+
+ $em = $client->getContainer()->get('doctrine.orm.entity_manager');
+ $user = $this->getUserByRole($em, User::ROLE_USER);
+
+ $this->request($client, '/dashboard/');
+ $this->assertTrue($client->getResponse()->isSuccessful());
+
+ $content = $client->getResponse()->getContent();
+
+ $this->assertContains('