From f8b390cbe20e9ef03a06a876d38d73cc4667f765 Mon Sep 17 00:00:00 2001 From: Kevin Papst Date: Sun, 7 Jan 2018 15:11:03 +0100 Subject: [PATCH] Developer improvements, PhpCs, PhpUnit #42 (#43) * improved dev fixtures with more diversity, more data, better testcases, user avatars #42 * added customer stats to dashboard, fixed column length for 3 widgets #42 * fixed empty alias - display empty message for new user #42 * unified-ui for "new" toolbar icon #42 * use kimai2_ as database prefix #42 * added customer stats to dashboard, fixed column length for 3 widgets #42 * fix long project/customer names in "currently active" navbar flyout" #42 * added services config for dev environment #42 * added command to run unit tests #42 * added command to run integration tests #42 * added command to run code sniffer #42 * added phpcs and phpunit to composer #42 * created tests directory #42 * fixed code sniffer warnings #42 * added function to switch result type from Pagerfanta to QueryBuilder #42 * dramatically reduced database calls by using custom joined query #42 * added command to install kimai dependencies #42 * added dev:reset command #42 --- app/Resources/translations/messages.de.xliff | 12 +- app/Resources/views/dashboard/index.html.twig | 15 +- app/Resources/views/macros/widgets.html.twig | 9 +- app/Resources/views/user/profile.html.twig | 17 +- app/config/config_dev.yml | 1 + app/config/parameters.yml.dist | 2 +- app/config/security.yml | 9 +- app/config/services.yml | 91 +- app/config/services_dev.yml | 32 + composer.json | 4 +- composer.lock | 1494 ++++++++++++++++- src/AppBundle/AppBundle.php | 2 +- src/AppBundle/Command/CreateUserCommand.php | 14 +- src/AppBundle/Command/DevResetCommand.php | 131 ++ src/AppBundle/Command/InstallCommand.php | 92 + .../Command/RunCodeSnifferCommand.php | 84 + .../Command/RunIntegrationTestsCommand.php | 46 + src/AppBundle/Command/RunUnitTestsCommand.php | 94 ++ .../Controller/AbstractController.php | 6 +- .../Controller/Admin/UserController.php | 5 +- .../Controller/DashboardController.php | 41 +- .../Controller/ProfileController.php | 21 +- .../DataFixtures/ORM/LoadFixtures.php | 25 +- .../DependencyInjection/AppExtension.php | 2 +- .../DependencyInjection/CompilerPass.php | 4 +- .../Doctrine/TablePrefixSubscriber.php | 5 +- src/AppBundle/Entity/User.php | 10 +- .../Event/ConfigureMainMenuEvent.php | 4 - src/AppBundle/Event/ConfigureMenuEvent.php | 6 +- src/AppBundle/EventListener/MenuBuilder.php | 17 +- .../EventListener/NavbarShowUserListener.php | 3 +- .../RedirectToPreferredLocaleListener.php | 4 +- src/AppBundle/Form/UserRolesType.php | 2 + .../Repository/AbstractRepository.php | 19 +- src/AppBundle/Repository/Query/BaseQuery.php | 27 + src/AppBundle/Twig/Extensions.php | 14 +- .../Validator/Constraints/RoleValidator.php | 2 +- src/AppBundle/Voter/UserVoter.php | 7 +- .../Controller/ActivityController.php | 3 +- .../Controller/Admin/ActivityController.php | 8 +- .../Controller/Admin/CustomerController.php | 4 +- .../Controller/Admin/ProjectController.php | 4 +- .../Controller/Admin/TimesheetController.php | 9 +- .../Controller/TimesheetController.php | 20 +- .../Controller/TimesheetControllerTrait.php | 2 +- .../DataFixtures/ORM/LoadFixtures.php | 115 +- src/TimesheetBundle/Entity/Project.php | 6 +- src/TimesheetBundle/Entity/Timesheet.php | 8 +- src/TimesheetBundle/EventListener/Menu.php | 2 +- .../Form/Type/ActivityType.php | 22 +- src/TimesheetBundle/Form/Type/ProjectType.php | 9 +- .../Repository/ActivityRepository.php | 7 +- .../Repository/CustomerRepository.php | 4 +- .../Repository/ProjectRepository.php | 7 +- .../Repository/Query/TimesheetQuery.php | 1 - .../Repository/TimesheetRepository.php | 33 +- .../Resources/views/admin/customer.html.twig | 2 +- src/TimesheetBundle/Voter/ActivityVoter.php | 2 + src/TimesheetBundle/Voter/CustomerVoter.php | 2 + src/TimesheetBundle/Voter/ProjectVoter.php | 2 + .../Controller/DefaultControllerTest.php | 3 +- .../Repository/Query/TimesheetQueryTest.php | 72 + web/css/kimai.css | 6 + 63 files changed, 2424 insertions(+), 302 deletions(-) create mode 100644 app/config/services_dev.yml create mode 100644 src/AppBundle/Command/DevResetCommand.php create mode 100644 src/AppBundle/Command/InstallCommand.php create mode 100644 src/AppBundle/Command/RunCodeSnifferCommand.php create mode 100644 src/AppBundle/Command/RunIntegrationTestsCommand.php create mode 100644 src/AppBundle/Command/RunUnitTestsCommand.php rename {src/AppBundle/Tests => tests/AppBundle}/Controller/DefaultControllerTest.php (97%) create mode 100644 tests/TimesheetBundle/Repository/Query/TimesheetQueryTest.php diff --git a/app/Resources/translations/messages.de.xliff b/app/Resources/translations/messages.de.xliff index 712b0b4a..737607d4 100644 --- a/app/Resources/translations/messages.de.xliff +++ b/app/Resources/translations/messages.de.xliff @@ -464,7 +464,7 @@ admin_user.subtitle - Alle registrierten Nutzer + Alle registrierten Benutzer der Zeitverwaltung label.alias @@ -546,9 +546,9 @@ stats.userActiveEver Aktive Benutzer jemals - - stats.userActiveNow - Momentan aktiv + + stats.activeRecordings + Momentan aktive Zeitmessungen stats.activitiesTotal @@ -558,6 +558,10 @@ stats.projectsTotal Anzahl Projekte + + stats.customerTotal + Anzahl Kunden + -

{{ user.alias }} ({{ user.username }})

+

{{ user.alias|default(user.username) }}

{{ user.title }}