From c7f0508707661de82f020a31f2eabf92d6ada71c Mon Sep 17 00:00:00 2001 From: Kevin Papst Date: Sun, 22 Dec 2024 01:25:30 +0100 Subject: [PATCH] Upgrade tests to PhpUnit 10 (#5252) --- composer.json | 2 +- composer.lock | 864 +++++++++--------- phpstan.neon | 5 - phpunit.xml.dist | 126 ++- src/WorkingTime/WorkingTimeService.php | 2 +- symfony.lock | 3 - ...Test.php => APIControllerBaseTestCase.php} | 22 +- tests/API/ActionsControllerTest.php | 10 +- tests/API/ActivityControllerTest.php | 76 +- tests/API/ApiDocControllerTest.php | 34 +- .../Authentication/AccessTokenHandlerTest.php | 6 +- tests/API/AuthenticationTest.php | 20 +- tests/API/ConfigurationControllerTest.php | 22 +- tests/API/CustomerControllerTest.php | 60 +- tests/API/InvoiceControllerTest.php | 30 +- tests/API/ProjectControllerTest.php | 86 +- tests/API/RateControllerTestTrait.php | 66 +- tests/API/StatusControllerTest.php | 22 +- tests/API/TagControllerTest.php | 70 +- tests/API/TeamControllerTest.php | 254 ++--- tests/API/TimesheetControllerTest.php | 148 +-- tests/API/UserControllerTest.php | 82 +- tests/Calendar/CalendarSourceTest.php | 18 +- tests/Calendar/GoogleSourceTest.php | 12 +- tests/Calendar/GoogleTest.php | 8 +- tests/Calendar/RecentActivitiesSourceTest.php | 14 +- tests/Calendar/TimesheetEntryTest.php | 24 +- tests/Command/ActivateUserCommandTest.php | 4 +- tests/Command/ChangePasswordCommandTest.php | 6 +- tests/Command/CreateUserCommandTest.php | 16 +- tests/Command/DeactivateUserCommandTest.php | 4 +- tests/Command/DemoteUserCommandTest.php | 8 +- tests/Command/ExportCreateCommandTest.php | 14 +- tests/Command/InvoiceCreateCommandTest.php | 26 +- tests/Command/ListUserCommandTest.php | 4 +- tests/Command/PluginCommandTest.php | 6 +- tests/Command/PromoteUserCommandTest.php | 10 +- tests/Command/VersionCommandTest.php | 4 +- tests/Configuration/LdapConfigurationTest.php | 16 +- tests/Configuration/LocaleServiceTest.php | 18 +- tests/Configuration/SamlConfigurationTest.php | 30 +- .../Configuration/SystemConfigurationTest.php | 152 +-- tests/Controller/AboutControllerTest.php | 2 +- ...php => AbstractControllerBaseTestCase.php} | 13 +- tests/Controller/ActivityControllerTest.php | 58 +- tests/Controller/CalendarControllerTest.php | 18 +- tests/Controller/ContractControllerTest.php | 2 +- tests/Controller/CustomerControllerTest.php | 56 +- tests/Controller/DashboardControllerTest.php | 4 +- tests/Controller/DoctorControllerTest.php | 2 +- tests/Controller/ExportControllerTest.php | 32 +- tests/Controller/FavoriteControllerTest.php | 4 +- tests/Controller/HelpControllerTest.php | 2 +- tests/Controller/HomepageControllerTest.php | 2 +- tests/Controller/InvoiceControllerTest.php | 84 +- tests/Controller/LayoutControllerTest.php | 28 +- tests/Controller/PermissionControllerTest.php | 14 +- tests/Controller/PluginControllerTest.php | 2 +- tests/Controller/ProfileControllerTest.php | 180 ++-- tests/Controller/ProjectControllerTest.php | 52 +- tests/Controller/QuickEntryControllerTest.php | 6 +- ... AbstractUserPeriodControllerTestCase.php} | 6 +- ...AbstractUsersPeriodControllerTestCase.php} | 10 +- .../CustomerMonthlyProjectsControllerTest.php | 10 +- .../ProjectDateRangeControllerTest.php | 4 +- .../ProjectDetailsControllerTest.php | 4 +- .../ProjectInactiveControllerTest.php | 4 +- .../Reporting/ProjectViewControllerTest.php | 6 +- .../ReportUsersMonthControllerTest.php | 2 +- .../ReportUsersWeekControllerTest.php | 2 +- .../ReportUsersYearControllerTest.php | 2 +- .../Reporting/UserMonthControllerTest.php | 2 +- .../Reporting/UserWeekControllerTest.php | 2 +- .../Reporting/UserYearControllerTest.php | 2 +- tests/Controller/ReportingControllerTest.php | 8 +- .../Security/PasswordResetControllerTest.php | 62 +- .../Security/SecurityControllerTest.php | 32 +- .../SelfRegistrationControllerTest.php | 54 +- .../SystemConfigurationControllerTest.php | 120 +-- tests/Controller/TagControllerTest.php | 10 +- tests/Controller/TeamControllerTest.php | 20 +- tests/Controller/TimesheetControllerTest.php | 166 ++-- .../TimesheetTeamControllerTest.php | 86 +- tests/Controller/UserControllerTest.php | 42 +- tests/Controller/WidgetControllerTest.php | 2 +- tests/Controller/WizardControllerTest.php | 2 +- .../DependencyInjection/AppExtensionTest.php | 56 +- tests/Doctrine/TimesheetSubscriberTest.php | 2 +- .../Doctrine/UTCDateTimeImmutableTypeTest.php | 22 +- tests/Doctrine/UTCDateTimeTypeTest.php | 22 +- ....php => AbstractCommentEntityTestCase.php} | 2 +- ...ityTest.php => AbstractEntityTestCase.php} | 18 +- ...est.php => AbstractMetaEntityTestCase.php} | 2 +- tests/Entity/AccessTokenTest.php | 24 +- tests/Entity/ActivityMetaTest.php | 2 +- tests/Entity/ActivityTest.php | 56 +- tests/Entity/BookmarkTest.php | 24 +- tests/Entity/ConfigurationTest.php | 14 +- tests/Entity/CustomerCommentTest.php | 2 +- tests/Entity/CustomerMetaTest.php | 2 +- tests/Entity/CustomerTest.php | 2 +- tests/Entity/EntityValidationTestTrait.php | 8 +- tests/Entity/InvoiceMetaTest.php | 2 +- tests/Entity/ProjectCommentTest.php | 2 +- tests/Entity/ProjectMetaTest.php | 2 +- tests/Entity/ProjectTest.php | 2 +- tests/Entity/TagTest.php | 22 +- tests/Entity/TimesheetMetaTest.php | 2 +- tests/Entity/TimesheetTest.php | 4 +- tests/Entity/UserTest.php | 2 +- tests/Entity/UserValidationTest.php | 4 +- ....php => AbstractActivityEventTestCase.php} | 2 +- ....php => AbstractCustomerEventTestCase.php} | 2 +- ...t.php => AbstractProjectEventTestCase.php} | 2 +- ...php => AbstractTimesheetEventTestCase.php} | 2 +- ...bstractTimesheetMultipleEventTestCase.php} | 2 +- tests/Event/ActivityCreateEventTest.php | 2 +- tests/Event/ActivityCreatePostEventTest.php | 2 +- tests/Event/ActivityCreatePreEventTest.php | 2 +- .../ActivityDetailControllerEventTest.php | 4 +- .../Event/ActivityMetaDefinitionEventTest.php | 2 +- tests/Event/ActivityStatisticEventTest.php | 2 +- tests/Event/ActivityUpdatePostEventTest.php | 2 +- tests/Event/ActivityUpdatePreEventTest.php | 2 +- tests/Event/CustomerCreateEventTest.php | 2 +- tests/Event/CustomerCreatePostEventTest.php | 2 +- tests/Event/CustomerCreatePreEventTest.php | 2 +- .../CustomerDetailControllerEventTest.php | 4 +- .../Event/CustomerMetaDefinitionEventTest.php | 2 +- tests/Event/CustomerStatisticEventTest.php | 2 +- tests/Event/CustomerUpdatePostEventTest.php | 2 +- tests/Event/CustomerUpdatePreEventTest.php | 2 +- tests/Event/DashboardEventTest.php | 4 +- tests/Event/EmailEventTest.php | 2 +- tests/Event/PageActionsEventTest.php | 70 +- tests/Event/PrepareUserEventTest.php | 8 +- tests/Event/ProjectCreateEventTest.php | 2 +- tests/Event/ProjectCreatePostEventTest.php | 2 +- tests/Event/ProjectCreatePreEventTest.php | 2 +- .../ProjectDetailControllerEventTest.php | 4 +- .../Event/ProjectMetaDefinitionEventTest.php | 2 +- tests/Event/ProjectStatisticEventTest.php | 2 +- tests/Event/ProjectUpdatePostEventTest.php | 2 +- tests/Event/ProjectUpdatePreEventTest.php | 2 +- tests/Event/ThemeEventTest.php | 16 +- .../ThemeJavascriptTranslationsEventTest.php | 2 +- tests/Event/TimesheetCreatePostEventTest.php | 2 +- tests/Event/TimesheetCreatePreEventTest.php | 2 +- .../TimesheetDeleteMultiplePreEventTest.php | 2 +- tests/Event/TimesheetDeletePreEventTest.php | 2 +- .../Event/TimesheetDuplicatePostEventTest.php | 2 +- .../Event/TimesheetDuplicatePreEventTest.php | 2 +- .../TimesheetMetaDefinitionEventTest.php | 2 +- tests/Event/TimesheetRestartPostEventTest.php | 2 +- tests/Event/TimesheetRestartPreEventTest.php | 2 +- tests/Event/TimesheetStopPostEventTest.php | 2 +- tests/Event/TimesheetStopPreEventTest.php | 2 +- .../TimesheetUpdateMultiplePostEventTest.php | 2 +- .../TimesheetUpdateMultiplePreEventTest.php | 2 +- tests/Event/TimesheetUpdatePostEventTest.php | 2 +- tests/Event/TimesheetUpdatePreEventTest.php | 2 +- tests/Event/UserCreateEventTest.php | 2 +- tests/Event/UserCreatePostEventTest.php | 2 +- tests/Event/UserCreatePreEventTest.php | 2 +- tests/Event/UserInteractiveLoginEventTest.php | 2 +- tests/Event/UserPreferenceEventTest.php | 10 +- tests/Event/UserUpdatePostEventTest.php | 2 +- tests/Event/UserUpdatePreEventTest.php | 2 +- ... => AbstractActionsSubscriberTestCase.php} | 10 +- .../Actions/ActivitiesSubscriberTest.php | 2 +- .../Actions/ActivitySubscriberTest.php | 2 +- .../Actions/CustomerSubscriberTest.php | 2 +- .../Actions/CustomersSubscriberTest.php | 2 +- .../Actions/InvoiceArchiveSubscriberTest.php | 2 +- .../Actions/InvoiceDocumentSubscriberTest.php | 2 +- .../Actions/InvoiceSubscriberTest.php | 2 +- .../Actions/InvoiceTemplateSubscriberTest.php | 2 +- .../InvoiceTemplatesSubscriberTest.php | 2 +- .../Actions/PermissionsSubscriberTest.php | 2 +- .../Actions/PluginSubscriberTest.php | 2 +- .../Actions/ProjectSubscriberTest.php | 2 +- .../Actions/ProjectsSubscriberTest.php | 2 +- .../Actions/TagSubscriberTest.php | 2 +- .../Actions/TagsSubscriberTest.php | 2 +- .../Actions/TeamSubscriberTest.php | 2 +- .../Actions/TeamsSubscriberTest.php | 2 +- .../Actions/TimesheetSubscriberTest.php | 2 +- .../Actions/TimesheetTeamSubscriberTest.php | 2 +- .../Actions/TimesheetsSubscriberTest.php | 2 +- .../Actions/TimesheetsTeamSubscriberTest.php | 2 +- .../Actions/UserSubscriberTest.php | 2 +- .../Actions/UsersSubscriberTest.php | 2 +- .../AjaxAuthenticationSubscriberTest.php | 6 +- tests/EventSubscriber/EmailSubscriberTest.php | 4 +- .../LastLoginSubscriberTest.php | 8 +- tests/EventSubscriber/MenuSubscriberTest.php | 4 +- .../PagerfantaExceptionSubscriberTest.php | 4 +- .../EventSubscriber/ProfileSubscriberTest.php | 6 +- .../UserDetailsSubscriberTest.php | 4 +- .../UserPreferenceSubscriberTest.php | 6 +- .../EventSubscriber/WizardSubscriberTest.php | 4 +- ...rTest.php => AbstractRendererTestCase.php} | 2 +- tests/Export/Renderer/CsvRendererTest.php | 30 +- tests/Export/Renderer/HtmlRendererTest.php | 32 +- tests/Export/Renderer/PdfRendererTest.php | 22 +- tests/Export/Renderer/XlsxRendererTest.php | 16 +- ...Test.php => AbstractFormatterTestCase.php} | 2 +- .../CellFormatter/ArrayFormatterTest.php | 2 +- .../CellFormatter/BooleanFormatterTest.php | 2 +- .../CellFormatter/DateFormatterTest.php | 2 +- .../CellFormatter/DateTimeFormatterTest.php | 2 +- .../CellFormatter/DurationFormatterTest.php | 2 +- .../CellFormatter/StringFormatterTest.php | 5 +- .../CellFormatter/TimeFormatterTest.php | 2 +- ...rTest.php => AbstractRendererTestCase.php} | 2 +- tests/Export/Timesheet/CsvRendererTest.php | 30 +- tests/Export/Timesheet/HtmlRendererTest.php | 8 +- tests/Export/Timesheet/PdfRendererTest.php | 12 +- tests/Export/Timesheet/XlsxRendererTest.php | 16 +- ...DurationStringToSecondsTransformerTest.php | 14 +- .../TagArrayToStringTransformerTest.php | 20 +- tests/Form/Type/DurationTypeTest.php | 6 +- tests/Form/Type/MinuteIncrementTypeTest.php | 4 +- .../Form/Type/QuickEntryTimesheetTypeTest.php | 8 +- ...est.php => AbstractCalculatorTestCase.php} | 24 +- .../ActivityInvoiceCalculatorTest.php | 28 +- .../ActivityUserInvoiceCalculatorTest.php | 38 +- .../Calculator/DateInvoiceCalculatorTest.php | 26 +- .../DateUserInvoiceCalculatorTest.php | 22 +- .../Calculator/DefaultCalculatorTest.php | 14 +- .../Calculator/PriceInvoiceCalculatorTest.php | 30 +- .../ProjectInvoiceCalculatorTest.php | 26 +- .../ProjectUserInvoiceCalculatorTest.php | 26 +- .../Calculator/ShortInvoiceCalculatorTest.php | 84 +- .../Calculator/UserInvoiceCalculatorTest.php | 20 +- .../WeeklyInvoiceCalculatorTest.php | 18 +- .../InvoiceItemDefaultHydratorTest.php | 10 +- .../InvoiceModelActivityHydratorTest.php | 2 +- .../InvoiceModelCustomerHydratorTest.php | 2 +- .../InvoiceModelDefaultHydratorTest.php | 2 +- .../InvoiceModelProjectHydratorTest.php | 2 +- .../Hydrator/InvoiceModelUserHydratorTest.php | 2 +- .../ConfigurableNumberGeneratorTest.php | 10 +- .../DateNumberGeneratorTest.php | 12 +- tests/Invoice/Renderer/DebugRendererTest.php | 25 +- tests/Invoice/Renderer/DocxRendererTest.php | 22 +- tests/Invoice/Renderer/OdsRendererTest.php | 47 +- tests/Invoice/Renderer/PdfRendererTest.php | 28 +- tests/Invoice/Renderer/TwigRendererTest.php | 24 +- tests/Invoice/Renderer/XlsxRendererTest.php | 47 +- tests/Invoice/ServiceInvoiceTest.php | 36 +- tests/Ldap/LdapManagerTest.php | 2 +- ...ractTimesheetCountedStatisticTestCase.php} | 6 +- tests/Model/ActivityStatisticTest.php | 4 +- tests/Model/CustomerStatisticTest.php | 2 +- tests/Model/ProjectStatisticTest.php | 2 +- ...Test.php => AbstractTimesheetTestCase.php} | 2 +- tests/Model/Statistic/BudgetStatisticTest.php | 4 +- tests/Model/Statistic/DayTest.php | 2 +- tests/Model/Statistic/MonthTest.php | 6 +- tests/Model/Statistic/StatisticDateTest.php | 2 +- tests/Model/Statistic/TimesheetTest.php | 2 +- tests/Model/TimesheetCountedStatisticTest.php | 2 +- tests/Model/TimesheetStatisticTest.php | 20 +- tests/Model/UserStatisticTest.php | 2 +- tests/Pdf/MPdfConverterTest.php | 4 +- tests/Plugin/PluginManagerTest.php | 36 +- tests/Plugin/PluginTest.php | 4 +- ...est.php => AbstractDateByUserTestCase.php} | 2 +- ...tTest.php => AbstractUserListTestCase.php} | 2 +- .../Reporting/MonthByUser/MonthByUserTest.php | 4 +- .../MonthlyUserList/MonthlyUserListTest.php | 4 +- tests/Reporting/ReportingServiceTest.php | 2 +- tests/Reporting/WeekByUser/WeekByUserTest.php | 4 +- .../WeeklyUserList/WeeklyUserListTest.php | 4 +- tests/Reporting/YearByUser/YearByUserTest.php | 4 +- .../YearlyUserList/YearlyUserListTest.php | 4 +- ...est.php => AbstractRepositoryTestCase.php} | 2 +- .../InvoiceDocumentRepositoryTest.php | 8 +- ...derTest.php => AbstractLoaderTestCase.php} | 4 +- .../Repository/Loader/ActivityLoaderTest.php | 2 +- .../Repository/Loader/CustomerLoaderTest.php | 2 +- tests/Repository/Loader/ProjectLoaderTest.php | 2 +- tests/Repository/Loader/TeamLoaderTest.php | 2 +- ... => AbstractBaseFormTypeQueryTestCase.php} | 46 +- .../Query/ActivityFormTypeQueryTest.php | 2 +- tests/Repository/Query/BaseQueryTest.php | 62 +- .../Query/CustomerFormTypeQueryTest.php | 2 +- tests/Repository/Query/ExportQueryTest.php | 8 +- .../Query/InvoiceArchiveQueryTest.php | 4 +- .../Query/ProjectFormTypeQueryTest.php | 2 +- .../Repository/Query/TagFormTypeQueryTest.php | 2 +- tests/Repository/Query/TeamQueryTest.php | 4 +- tests/Repository/Query/TimesheetQueryTest.php | 2 +- .../Query/UserFormTypeQueryTest.php | 2 +- tests/Repository/Query/UserQueryTest.php | 12 +- tests/Repository/TagRepositoryTest.php | 26 +- tests/Repository/TimesheetRepositoryTest.php | 24 +- tests/Saml/Provider/SamlProviderTest.php | 0 .../SamlAuthenticationSuccessHandlerTest.php | 16 +- .../Calculator/BillableCalculatorTest.php | 2 +- .../Calculator/DurationCalculatorTest.php | 10 +- .../Calculator/RateCalculatorTest.php | 20 +- tests/Timesheet/DateTimeFactoryTest.php | 126 +-- tests/Timesheet/LockdownServiceTest.php | 4 +- tests/Timesheet/RateServiceTest.php | 34 +- tests/Timesheet/Rounding/CeilRoundingTest.php | 10 +- .../Rounding/ClosestRoundingTest.php | 10 +- .../Rounding/DefaultRoundingTest.php | 10 +- .../Timesheet/Rounding/FloorRoundingTest.php | 10 +- tests/Timesheet/RoundingServiceTest.php | 14 +- ...t.php => AbstractTrackingModeTestCase.php} | 4 +- .../TrackingMode/DefaultModeTest.php | 4 +- tests/Timesheet/UtilTest.php | 4 +- tests/TranslationsTest.php | 8 +- tests/Twig/DatatableExtensionsTest.php | 6 +- tests/Twig/ExtensionsTest.php | 34 +- tests/Twig/LocaleFormatExtensionsTest.php | 130 +-- tests/Twig/PaginationExtensionTest.php | 4 +- tests/Twig/Runtime/MarkdownExtensionTest.php | 72 +- .../Twig/Runtime/ThemeEventExtensionTest.php | 18 +- tests/Twig/Runtime/WidgetExtensionTest.php | 4 +- tests/Twig/RuntimeExtensionsTest.php | 12 +- tests/Utils/ColorTest.php | 30 +- tests/Utils/DurationTest.php | 12 +- tests/Utils/FileHelperTest.php | 2 +- tests/Utils/FormFormatConverterTest.php | 16 +- tests/Utils/JavascriptFormatConverterTest.php | 14 +- tests/Utils/MarkdownTest.php | 10 +- tests/Utils/NumberGeneratorTest.php | 2 +- tests/Utils/PaginationTest.php | 18 +- tests/Utils/ProfileManagerTest.php | 10 +- tests/Utils/StringHelperTest.php | 4 +- .../Constraints/ColorChoicesValidatorTest.php | 7 +- .../DateTimeFormatValidatorTest.php | 10 +- .../Constraints/DurationValidatorTest.php | 4 +- .../Constraints/HexColorValidatorTest.php | 16 +- .../Constraints/RoleNameValidatorTest.php | 5 +- .../Constraints/RoleValidatorTest.php | 10 +- .../Constraints/TimeFormatValidatorTest.php | 4 +- .../TimesheetBasicValidatorTest.php | 2 +- .../TimesheetBudgetUsedValidatorTest.php | 2 +- .../TimesheetLockdownValidatorTest.php | 4 +- .../TimesheetRestartValidatorTest.php | 2 +- ...oterTest.php => AbstractVoterTestCase.php} | 4 +- tests/Voter/ActivityVoterTest.php | 16 +- tests/Voter/CustomerVoterTest.php | 16 +- tests/Voter/EntityMultiRoleVoterTest.php | 16 +- tests/Voter/ProjectVoterTest.php | 16 +- tests/Voter/RolePermissionVoterTest.php | 16 +- tests/Voter/TeamVoterTest.php | 16 +- tests/Voter/TimesheetVoterTest.php | 15 +- tests/Voter/UserVoterTest.php | 22 +- ...getTest.php => AbstractWidgetTestCase.php} | 2 +- ...est.php => AbstractWidgetTypeTestCase.php} | 2 +- tests/Widget/Type/ActiveUsersYearTest.php | 2 +- tests/Widget/Type/AmountMonthTest.php | 2 +- tests/Widget/Type/AmountTodayTest.php | 2 +- tests/Widget/Type/AmountTotalTest.php | 2 +- tests/Widget/Type/AmountWeekTest.php | 2 +- tests/Widget/Type/AmountYearTest.php | 2 +- tests/Widget/Type/DurationYearTest.php | 2 +- tests/Widget/Type/MoreTest.php | 2 +- tests/Widget/Type/TotalsActivityTest.php | 2 +- tests/Widget/Type/TotalsCustomerTest.php | 2 +- tests/Widget/Type/TotalsProjectTest.php | 2 +- tests/Widget/Type/TotalsUserTest.php | 2 +- tests/Widget/Type/UserAmountMonthTest.php | 2 +- tests/Widget/Type/UserAmountTodayTest.php | 2 +- tests/Widget/Type/UserAmountTotalTest.php | 2 +- tests/Widget/Type/UserAmountWeekTest.php | 2 +- tests/Widget/Type/UserAmountYearTest.php | 2 +- tests/Widget/Type/UserDurationYearTest.php | 2 +- .../Mode/WorkingTimeModeDayTest.php | 10 +- .../Mode/WorkingTimeModeFactoryTest.php | 8 +- .../Mode/WorkingTimeModeNoneTest.php | 8 +- tests/phpstan.neon | 299 +++--- 377 files changed, 3308 insertions(+), 3409 deletions(-) rename tests/API/{APIControllerBaseTest.php => APIControllerBaseTestCase.php} (97%) rename tests/Controller/{ControllerBaseTest.php => AbstractControllerBaseTestCase.php} (99%) rename tests/Controller/Reporting/{AbstractUserPeriodControllerTest.php => AbstractUserPeriodControllerTestCase.php} (93%) rename tests/Controller/Reporting/{AbstractUsersPeriodControllerTest.php => AbstractUsersPeriodControllerTestCase.php} (91%) rename tests/Entity/{AbstractCommentEntityTest.php => AbstractCommentEntityTestCase.php} (95%) rename tests/Entity/{AbstractEntityTest.php => AbstractEntityTestCase.php} (66%) rename tests/Entity/{AbstractMetaEntityTest.php => AbstractMetaEntityTestCase.php} (98%) rename tests/Event/{AbstractActivityEventTest.php => AbstractActivityEventTestCase.php} (92%) rename tests/Event/{AbstractCustomerEventTest.php => AbstractCustomerEventTestCase.php} (92%) rename tests/Event/{AbstractProjectEventTest.php => AbstractProjectEventTestCase.php} (92%) rename tests/Event/{AbstractTimesheetEventTest.php => AbstractTimesheetEventTestCase.php} (92%) rename tests/Event/{AbstractTimesheetMultipleEventTest.php => AbstractTimesheetMultipleEventTestCase.php} (91%) rename tests/EventSubscriber/Actions/{AbstractActionsSubscriberTest.php => AbstractActionsSubscriberTestCase.php} (79%) rename tests/Export/Renderer/{AbstractRendererTest.php => AbstractRendererTestCase.php} (99%) rename tests/Export/Spreadsheet/CellFormatter/{AbstractFormatterTest.php => AbstractFormatterTestCase.php} (96%) rename tests/Export/Timesheet/{AbstractRendererTest.php => AbstractRendererTestCase.php} (99%) rename tests/Invoice/Calculator/{AbstractCalculatorTest.php => AbstractCalculatorTestCase.php} (83%) rename tests/Model/{AbstractTimesheetCountedStatisticTest.php => AbstractTimesheetCountedStatisticTestCase.php} (97%) rename tests/Model/Statistic/{AbstractTimesheetTest.php => AbstractTimesheetTestCase.php} (95%) rename tests/Reporting/{AbstractDateByUserTest.php => AbstractDateByUserTestCase.php} (96%) rename tests/Reporting/{AbstractUserListTest.php => AbstractUserListTestCase.php} (96%) rename tests/Repository/{AbstractRepositoryTest.php => AbstractRepositoryTestCase.php} (95%) rename tests/Repository/Loader/{AbstractLoaderTest.php => AbstractLoaderTestCase.php} (94%) rename tests/Repository/Query/{BaseFormTypeQueryTest.php => AbstractBaseFormTypeQueryTestCase.php} (67%) delete mode 100644 tests/Saml/Provider/SamlProviderTest.php rename tests/Timesheet/TrackingMode/{AbstractTrackingModeTest.php => AbstractTrackingModeTestCase.php} (97%) rename tests/Voter/{AbstractVoterTest.php => AbstractVoterTestCase.php} (97%) rename tests/Widget/Type/{AbstractWidgetTest.php => AbstractWidgetTestCase.php} (95%) rename tests/Widget/Type/{AbstractWidgetTypeTest.php => AbstractWidgetTypeTestCase.php} (95%) diff --git a/composer.json b/composer.json index f8808cbe..d38f7cac 100644 --- a/composer.json +++ b/composer.json @@ -90,7 +90,7 @@ "phpstan/phpstan-phpunit": "^2.0", "phpstan/phpstan-strict-rules": "^2.0", "phpstan/phpstan-symfony": "^2.0", - "phpunit/phpunit": "9.5.*", + "phpunit/phpunit": "^10.0", "symfony/browser-kit": "^6.0", "symfony/css-selector": "^6.0", "symfony/debug-bundle": "^6.0", diff --git a/composer.lock b/composer.lock index bd8e99a3..900bb6fc 100644 --- a/composer.lock +++ b/composer.lock @@ -4,7 +4,7 @@ "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies", "This file is @generated automatically" ], - "content-hash": "9fb3c44d9d057eaca308bc27cb107f13", + "content-hash": "455e6cae5b8c0ce7458599a0f317c2d3", "packages": [ { "name": "azuyalabs/yasumi", @@ -698,29 +698,27 @@ }, { "name": "doctrine/deprecations", - "version": "1.1.3", + "version": "1.1.4", "source": { "type": "git", "url": "https://github.com/doctrine/deprecations.git", - "reference": "dfbaa3c2d2e9a9df1118213f3b8b0c597bb99fab" + "reference": "31610dbb31faa98e6b5447b62340826f54fbc4e9" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/doctrine/deprecations/zipball/dfbaa3c2d2e9a9df1118213f3b8b0c597bb99fab", - "reference": "dfbaa3c2d2e9a9df1118213f3b8b0c597bb99fab", + "url": "https://api.github.com/repos/doctrine/deprecations/zipball/31610dbb31faa98e6b5447b62340826f54fbc4e9", + "reference": "31610dbb31faa98e6b5447b62340826f54fbc4e9", "shasum": "" }, "require": { "php": "^7.1 || ^8.0" }, "require-dev": { - "doctrine/coding-standard": "^9", - "phpstan/phpstan": "1.4.10 || 1.10.15", - "phpstan/phpstan-phpunit": "^1.0", + "doctrine/coding-standard": "^9 || ^12", + "phpstan/phpstan": "1.4.10 || 2.0.3", + "phpstan/phpstan-phpunit": "^1.0 || ^2", "phpunit/phpunit": "^7.5 || ^8.5 || ^9.5", - "psalm/plugin-phpunit": "0.18.4", - "psr/log": "^1 || ^2 || ^3", - "vimeo/psalm": "4.30.0 || 5.12.0" + "psr/log": "^1 || ^2 || ^3" }, "suggest": { "psr/log": "Allows logging deprecations via PSR-3 logger implementation" @@ -728,7 +726,7 @@ "type": "library", "autoload": { "psr-4": { - "Doctrine\\Deprecations\\": "lib/Doctrine/Deprecations" + "Doctrine\\Deprecations\\": "src" } }, "notification-url": "https://packagist.org/downloads/", @@ -739,9 +737,9 @@ "homepage": "https://www.doctrine-project.org/", "support": { "issues": "https://github.com/doctrine/deprecations/issues", - "source": "https://github.com/doctrine/deprecations/tree/1.1.3" + "source": "https://github.com/doctrine/deprecations/tree/1.1.4" }, - "time": "2024-01-30T19:34:25+00:00" + "time": "2024-12-07T21:18:45+00:00" }, { "name": "doctrine/doctrine-bundle", @@ -1389,16 +1387,16 @@ }, { "name": "doctrine/orm", - "version": "2.20.0", + "version": "2.20.1", "source": { "type": "git", "url": "https://github.com/doctrine/orm.git", - "reference": "8ed6c2234aba019f9737a6bcc9516438e62da27c" + "reference": "e3cabade99ebccc6ba078884c1c5f250866a494e" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/doctrine/orm/zipball/8ed6c2234aba019f9737a6bcc9516438e62da27c", - "reference": "8ed6c2234aba019f9737a6bcc9516438e62da27c", + "url": "https://api.github.com/repos/doctrine/orm/zipball/e3cabade99ebccc6ba078884c1c5f250866a494e", + "reference": "e3cabade99ebccc6ba078884c1c5f250866a494e", "shasum": "" }, "require": { @@ -1428,15 +1426,14 @@ "doctrine/coding-standard": "^9.0.2 || ^12.0", "phpbench/phpbench": "^0.16.10 || ^1.0", "phpstan/extension-installer": "~1.1.0 || ^1.4", - "phpstan/phpstan": "~1.4.10 || 1.12.6", - "phpstan/phpstan-deprecation-rules": "^1", + "phpstan/phpstan": "~1.4.10 || 2.0.3", + "phpstan/phpstan-deprecation-rules": "^1 || ^2", "phpunit/phpunit": "^7.5 || ^8.5 || ^9.6", "psr/log": "^1 || ^2 || ^3", "squizlabs/php_codesniffer": "3.7.2", "symfony/cache": "^4.4 || ^5.4 || ^6.4 || ^7.0", "symfony/var-exporter": "^4.4 || ^5.4 || ^6.2 || ^7.0", - "symfony/yaml": "^3.4 || ^4.0 || ^5.0 || ^6.0 || ^7.0", - "vimeo/psalm": "4.30.0 || 5.24.0" + "symfony/yaml": "^3.4 || ^4.0 || ^5.0 || ^6.0 || ^7.0" }, "suggest": { "ext-dom": "Provides support for XSD validation for XML mapping files", @@ -1486,9 +1483,9 @@ ], "support": { "issues": "https://github.com/doctrine/orm/issues", - "source": "https://github.com/doctrine/orm/tree/2.20.0" + "source": "https://github.com/doctrine/orm/tree/2.20.1" }, - "time": "2024-10-11T11:47:24+00:00" + "time": "2024-12-19T06:48:36+00:00" }, { "name": "doctrine/persistence", @@ -2136,16 +2133,16 @@ }, { "name": "jms/serializer", - "version": "3.31.1", + "version": "3.32.1", "source": { "type": "git", "url": "https://github.com/schmittjoh/serializer.git", - "reference": "362503da26673f210221c25b99c795da718ad9aa" + "reference": "b4285f4197a5b961d365e2c756b144d7af24a7fd" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/schmittjoh/serializer/zipball/362503da26673f210221c25b99c795da718ad9aa", - "reference": "362503da26673f210221c25b99c795da718ad9aa", + "url": "https://api.github.com/repos/schmittjoh/serializer/zipball/b4285f4197a5b961d365e2c756b144d7af24a7fd", + "reference": "b4285f4197a5b961d365e2c756b144d7af24a7fd", "shasum": "" }, "require": { @@ -2153,7 +2150,7 @@ "doctrine/lexer": "^2.0 || ^3.0", "jms/metadata": "^2.6", "php": "^7.4 || ^8.0", - "phpstan/phpdoc-parser": "^1.20" + "phpstan/phpdoc-parser": "^1.20 || ^2.0" }, "require-dev": { "doctrine/annotations": "^1.14 || ^2.0", @@ -2165,10 +2162,11 @@ "jackalope/jackalope-doctrine-dbal": "^1.3", "ocramius/proxy-manager": "^1.0 || ^2.0", "phpbench/phpbench": "^1.0", - "phpstan/phpstan": "^1.10.57", + "phpstan/phpstan": "^2.0", "phpunit/phpunit": "^9.0 || ^10.0 || ^11.0", "psr/container": "^1.0 || ^2.0", - "rector/rector": "^1.0.0", + "rector/rector": "^1.0.0 || ^2.0@dev", + "slevomat/coding-standard": "dev-master#f2cc4c553eae68772624ffd7dd99022343b69c31 as 8.11.9999", "symfony/dependency-injection": "^5.4 || ^6.0 || ^7.0", "symfony/expression-language": "^5.4 || ^6.0 || ^7.0", "symfony/filesystem": "^5.4 || ^6.0 || ^7.0", @@ -2221,7 +2219,7 @@ ], "support": { "issues": "https://github.com/schmittjoh/serializer/issues", - "source": "https://github.com/schmittjoh/serializer/tree/3.31.1" + "source": "https://github.com/schmittjoh/serializer/tree/3.32.1" }, "funding": [ { @@ -2229,7 +2227,7 @@ "type": "github" } ], - "time": "2024-10-31T18:35:14+00:00" + "time": "2024-12-03T22:30:06+00:00" }, { "name": "jms/serializer-bundle", @@ -2322,16 +2320,16 @@ }, { "name": "kevinpapst/tabler-bundle", - "version": "1.6.0", + "version": "1.6.1", "source": { "type": "git", "url": "https://github.com/kevinpapst/TablerBundle.git", - "reference": "25b2e8f6f244bff5964057f2d7825f0c81ca0e2e" + "reference": "d6e4ce78e8228402a2e419835913c4b1b29d0838" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/kevinpapst/TablerBundle/zipball/25b2e8f6f244bff5964057f2d7825f0c81ca0e2e", - "reference": "25b2e8f6f244bff5964057f2d7825f0c81ca0e2e", + "url": "https://api.github.com/repos/kevinpapst/TablerBundle/zipball/d6e4ce78e8228402a2e419835913c4b1b29d0838", + "reference": "d6e4ce78e8228402a2e419835913c4b1b29d0838", "shasum": "" }, "require": { @@ -2381,7 +2379,7 @@ "description": "Admin/Backend theme bundle for Symfony based on Tabler.io", "support": { "issues": "https://github.com/kevinpapst/TablerBundle/issues", - "source": "https://github.com/kevinpapst/TablerBundle/tree/1.6.0" + "source": "https://github.com/kevinpapst/TablerBundle/tree/1.6.1" }, "funding": [ { @@ -2393,20 +2391,20 @@ "type": "github" } ], - "time": "2024-11-21T17:37:07+00:00" + "time": "2024-12-19T21:09:30+00:00" }, { "name": "league/csv", - "version": "9.18.0", + "version": "9.20.1", "source": { "type": "git", "url": "https://github.com/thephpleague/csv.git", - "reference": "b02d010e4055ae992247f6ffd1e7b103ef2a0790" + "reference": "491d1e79e973a7370c7571dc0fe4a7241f4936ee" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/thephpleague/csv/zipball/b02d010e4055ae992247f6ffd1e7b103ef2a0790", - "reference": "b02d010e4055ae992247f6ffd1e7b103ef2a0790", + "url": "https://api.github.com/repos/thephpleague/csv/zipball/491d1e79e973a7370c7571dc0fe4a7241f4936ee", + "reference": "491d1e79e973a7370c7571dc0fe4a7241f4936ee", "shasum": "" }, "require": { @@ -2418,12 +2416,12 @@ "ext-xdebug": "*", "friendsofphp/php-cs-fixer": "^3.64.0", "phpbench/phpbench": "^1.3.1", - "phpstan/phpstan": "^1.12.6", + "phpstan/phpstan": "^1.12.11", "phpstan/phpstan-deprecation-rules": "^1.2.1", - "phpstan/phpstan-phpunit": "^1.4.0", + "phpstan/phpstan-phpunit": "^1.4.1", "phpstan/phpstan-strict-rules": "^1.6.1", - "phpunit/phpunit": "^10.5.16 || ^11.4.1", - "symfony/var-dumper": "^6.4.8 || ^7.1.5" + "phpunit/phpunit": "^10.5.16 || ^11.4.3", + "symfony/var-dumper": "^6.4.8 || ^7.1.8" }, "suggest": { "ext-dom": "Required to use the XMLConverter and the HTMLConverter classes", @@ -2480,7 +2478,7 @@ "type": "github" } ], - "time": "2024-10-18T08:14:48+00:00" + "time": "2024-12-18T10:11:15+00:00" }, { "name": "lorenzo/pinky", @@ -2721,16 +2719,16 @@ }, { "name": "monolog/monolog", - "version": "3.8.0", + "version": "3.8.1", "source": { "type": "git", "url": "https://github.com/Seldaek/monolog.git", - "reference": "32e515fdc02cdafbe4593e30a9350d486b125b67" + "reference": "aef6ee73a77a66e404dd6540934a9ef1b3c855b4" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/Seldaek/monolog/zipball/32e515fdc02cdafbe4593e30a9350d486b125b67", - "reference": "32e515fdc02cdafbe4593e30a9350d486b125b67", + "url": "https://api.github.com/repos/Seldaek/monolog/zipball/aef6ee73a77a66e404dd6540934a9ef1b3c855b4", + "reference": "aef6ee73a77a66e404dd6540934a9ef1b3c855b4", "shasum": "" }, "require": { @@ -2808,7 +2806,7 @@ ], "support": { "issues": "https://github.com/Seldaek/monolog/issues", - "source": "https://github.com/Seldaek/monolog/tree/3.8.0" + "source": "https://github.com/Seldaek/monolog/tree/3.8.1" }, "funding": [ { @@ -2820,7 +2818,7 @@ "type": "tidelift" } ], - "time": "2024-11-12T13:57:08+00:00" + "time": "2024-12-05T17:15:07+00:00" }, { "name": "mpdf/mpdf", @@ -3578,16 +3576,16 @@ }, { "name": "phpdocumentor/reflection-docblock", - "version": "5.6.0", + "version": "5.6.1", "source": { "type": "git", "url": "https://github.com/phpDocumentor/ReflectionDocBlock.git", - "reference": "f3558a4c23426d12bffeaab463f8a8d8b681193c" + "reference": "e5e784149a09bd69d9a5e3b01c5cbd2e2bd653d8" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/phpDocumentor/ReflectionDocBlock/zipball/f3558a4c23426d12bffeaab463f8a8d8b681193c", - "reference": "f3558a4c23426d12bffeaab463f8a8d8b681193c", + "url": "https://api.github.com/repos/phpDocumentor/ReflectionDocBlock/zipball/e5e784149a09bd69d9a5e3b01c5cbd2e2bd653d8", + "reference": "e5e784149a09bd69d9a5e3b01c5cbd2e2bd653d8", "shasum": "" }, "require": { @@ -3636,9 +3634,9 @@ "description": "With this component, a library can provide support for annotations via DocBlocks or otherwise retrieve information that is embedded in a DocBlock.", "support": { "issues": "https://github.com/phpDocumentor/ReflectionDocBlock/issues", - "source": "https://github.com/phpDocumentor/ReflectionDocBlock/tree/5.6.0" + "source": "https://github.com/phpDocumentor/ReflectionDocBlock/tree/5.6.1" }, - "time": "2024-11-12T11:25:25+00:00" + "time": "2024-12-07T09:39:29+00:00" }, { "name": "phpdocumentor/type-resolver", @@ -3752,16 +3750,16 @@ }, { "name": "phpoffice/phpspreadsheet", - "version": "2.3.3", + "version": "2.3.4", "source": { "type": "git", "url": "https://github.com/PHPOffice/PhpSpreadsheet.git", - "reference": "91a4b42e41976a0b2f839720c3e20a12a84f6852" + "reference": "01c4122a12327378ab5d97a56a4cbab07e7fa70b" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/PHPOffice/PhpSpreadsheet/zipball/91a4b42e41976a0b2f839720c3e20a12a84f6852", - "reference": "91a4b42e41976a0b2f839720c3e20a12a84f6852", + "url": "https://api.github.com/repos/PHPOffice/PhpSpreadsheet/zipball/01c4122a12327378ab5d97a56a4cbab07e7fa70b", + "reference": "01c4122a12327378ab5d97a56a4cbab07e7fa70b", "shasum": "" }, "require": { @@ -3850,9 +3848,9 @@ ], "support": { "issues": "https://github.com/PHPOffice/PhpSpreadsheet/issues", - "source": "https://github.com/PHPOffice/PhpSpreadsheet/tree/2.3.3" + "source": "https://github.com/PHPOffice/PhpSpreadsheet/tree/2.3.4" }, - "time": "2024-11-22T06:11:37+00:00" + "time": "2024-12-08T15:43:45+00:00" }, { "name": "phpoffice/phpword", @@ -3965,30 +3963,30 @@ }, { "name": "phpstan/phpdoc-parser", - "version": "1.33.0", + "version": "2.0.0", "source": { "type": "git", "url": "https://github.com/phpstan/phpdoc-parser.git", - "reference": "82a311fd3690fb2bf7b64d5c98f912b3dd746140" + "reference": "c00d78fb6b29658347f9d37ebe104bffadf36299" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/phpstan/phpdoc-parser/zipball/82a311fd3690fb2bf7b64d5c98f912b3dd746140", - "reference": "82a311fd3690fb2bf7b64d5c98f912b3dd746140", + "url": "https://api.github.com/repos/phpstan/phpdoc-parser/zipball/c00d78fb6b29658347f9d37ebe104bffadf36299", + "reference": "c00d78fb6b29658347f9d37ebe104bffadf36299", "shasum": "" }, "require": { - "php": "^7.2 || ^8.0" + "php": "^7.4 || ^8.0" }, "require-dev": { "doctrine/annotations": "^2.0", - "nikic/php-parser": "^4.15", + "nikic/php-parser": "^5.3.0", "php-parallel-lint/php-parallel-lint": "^1.2", "phpstan/extension-installer": "^1.0", - "phpstan/phpstan": "^1.5", - "phpstan/phpstan-phpunit": "^1.1", - "phpstan/phpstan-strict-rules": "^1.0", - "phpunit/phpunit": "^9.5", + "phpstan/phpstan": "^2.0", + "phpstan/phpstan-phpunit": "^2.0", + "phpstan/phpstan-strict-rules": "^2.0", + "phpunit/phpunit": "^9.6", "symfony/process": "^5.2" }, "type": "library", @@ -4006,9 +4004,9 @@ "description": "PHPDoc parser with support for nullable, intersection and generic types", "support": { "issues": "https://github.com/phpstan/phpdoc-parser/issues", - "source": "https://github.com/phpstan/phpdoc-parser/tree/1.33.0" + "source": "https://github.com/phpstan/phpdoc-parser/tree/2.0.0" }, - "time": "2024-10-13T11:25:22+00:00" + "time": "2024-10-13T11:29:49+00:00" }, { "name": "psr/cache", @@ -4683,16 +4681,16 @@ }, { "name": "setasign/fpdi", - "version": "v2.6.1", + "version": "v2.6.2", "source": { "type": "git", "url": "https://github.com/Setasign/FPDI.git", - "reference": "09a816004fcee9ed3405bd164147e3fdbb79a56f" + "reference": "9e013b376939c0d4029f54150d2a16f3c67a5797" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/Setasign/FPDI/zipball/09a816004fcee9ed3405bd164147e3fdbb79a56f", - "reference": "09a816004fcee9ed3405bd164147e3fdbb79a56f", + "url": "https://api.github.com/repos/Setasign/FPDI/zipball/9e013b376939c0d4029f54150d2a16f3c67a5797", + "reference": "9e013b376939c0d4029f54150d2a16f3c67a5797", "shasum": "" }, "require": { @@ -4743,7 +4741,7 @@ ], "support": { "issues": "https://github.com/Setasign/FPDI/issues", - "source": "https://github.com/Setasign/FPDI/tree/v2.6.1" + "source": "https://github.com/Setasign/FPDI/tree/v2.6.2" }, "funding": [ { @@ -4751,7 +4749,7 @@ "type": "tidelift" } ], - "time": "2024-09-02T10:17:15+00:00" + "time": "2024-12-10T13:12:19+00:00" }, { "name": "spomky-labs/otphp", @@ -6548,16 +6546,16 @@ }, { "name": "symfony/http-client-contracts", - "version": "v3.5.1", + "version": "v3.5.2", "source": { "type": "git", "url": "https://github.com/symfony/http-client-contracts.git", - "reference": "c2f3ad828596624ca39ea40f83617ef51ca8bbf9" + "reference": "ee8d807ab20fcb51267fdace50fbe3494c31e645" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/http-client-contracts/zipball/c2f3ad828596624ca39ea40f83617ef51ca8bbf9", - "reference": "c2f3ad828596624ca39ea40f83617ef51ca8bbf9", + "url": "https://api.github.com/repos/symfony/http-client-contracts/zipball/ee8d807ab20fcb51267fdace50fbe3494c31e645", + "reference": "ee8d807ab20fcb51267fdace50fbe3494c31e645", "shasum": "" }, "require": { @@ -6565,12 +6563,12 @@ }, "type": "library", "extra": { + "thanks": { + "url": "https://github.com/symfony/contracts", + "name": "symfony/contracts" + }, "branch-alias": { "dev-main": "3.5-dev" - }, - "thanks": { - "name": "symfony/contracts", - "url": "https://github.com/symfony/contracts" } }, "autoload": { @@ -6606,7 +6604,7 @@ "standards" ], "support": { - "source": "https://github.com/symfony/http-client-contracts/tree/v3.5.1" + "source": "https://github.com/symfony/http-client-contracts/tree/v3.5.2" }, "funding": [ { @@ -6622,7 +6620,7 @@ "type": "tidelift" } ], - "time": "2024-11-25T12:02:18+00:00" + "time": "2024-12-07T08:49:48+00:00" }, { "name": "symfony/http-foundation", @@ -7382,8 +7380,8 @@ "type": "library", "extra": { "thanks": { - "name": "symfony/polyfill", - "url": "https://github.com/symfony/polyfill" + "url": "https://github.com/symfony/polyfill", + "name": "symfony/polyfill" } }, "autoload": { @@ -9347,31 +9345,33 @@ }, { "name": "tijsverkoyen/css-to-inline-styles", - "version": "v2.2.7", + "version": "v2.3.0", "source": { "type": "git", "url": "https://github.com/tijsverkoyen/CssToInlineStyles.git", - "reference": "83ee6f38df0a63106a9e4536e3060458b74ccedb" + "reference": "0d72ac1c00084279c1816675284073c5a337c20d" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/tijsverkoyen/CssToInlineStyles/zipball/83ee6f38df0a63106a9e4536e3060458b74ccedb", - "reference": "83ee6f38df0a63106a9e4536e3060458b74ccedb", + "url": "https://api.github.com/repos/tijsverkoyen/CssToInlineStyles/zipball/0d72ac1c00084279c1816675284073c5a337c20d", + "reference": "0d72ac1c00084279c1816675284073c5a337c20d", "shasum": "" }, "require": { "ext-dom": "*", "ext-libxml": "*", - "php": "^5.5 || ^7.0 || ^8.0", - "symfony/css-selector": "^2.7 || ^3.0 || ^4.0 || ^5.0 || ^6.0 || ^7.0" + "php": "^7.4 || ^8.0", + "symfony/css-selector": "^5.4 || ^6.0 || ^7.0" }, "require-dev": { - "phpunit/phpunit": "^4.8.35 || ^5.7 || ^6.0 || ^7.5 || ^8.5.21 || ^9.5.10" + "phpstan/phpstan": "^2.0", + "phpstan/phpstan-phpunit": "^2.0", + "phpunit/phpunit": "^8.5.21 || ^9.5.10" }, "type": "library", "extra": { "branch-alias": { - "dev-master": "2.2.x-dev" + "dev-master": "2.x-dev" } }, "autoload": { @@ -9394,13 +9394,13 @@ "homepage": "https://github.com/tijsverkoyen/CssToInlineStyles", "support": { "issues": "https://github.com/tijsverkoyen/CssToInlineStyles/issues", - "source": "https://github.com/tijsverkoyen/CssToInlineStyles/tree/v2.2.7" + "source": "https://github.com/tijsverkoyen/CssToInlineStyles/tree/v2.3.0" }, - "time": "2023-12-08T13:03:43+00:00" + "time": "2024-12-21T16:25:41+00:00" }, { "name": "twig/cssinliner-extra", - "version": "v3.16.0", + "version": "v3.17.0", "source": { "type": "git", "url": "https://github.com/twigphp/cssinliner-extra.git", @@ -9453,7 +9453,7 @@ "twig" ], "support": { - "source": "https://github.com/twigphp/cssinliner-extra/tree/v3.16.0" + "source": "https://github.com/twigphp/cssinliner-extra/tree/v3.17.0" }, "funding": [ { @@ -9469,7 +9469,7 @@ }, { "name": "twig/extra-bundle", - "version": "v3.16.0", + "version": "v3.17.0", "source": { "type": "git", "url": "https://github.com/twigphp/twig-extra-bundle.git", @@ -9527,7 +9527,7 @@ "twig" ], "support": { - "source": "https://github.com/twigphp/twig-extra-bundle/tree/v3.16.0" + "source": "https://github.com/twigphp/twig-extra-bundle/tree/v3.17.0" }, "funding": [ { @@ -9543,7 +9543,7 @@ }, { "name": "twig/inky-extra", - "version": "v3.16.0", + "version": "v3.17.0", "source": { "type": "git", "url": "https://github.com/twigphp/inky-extra.git", @@ -9597,7 +9597,7 @@ "twig" ], "support": { - "source": "https://github.com/twigphp/inky-extra/tree/v3.16.0" + "source": "https://github.com/twigphp/inky-extra/tree/v3.17.0" }, "funding": [ { @@ -9613,7 +9613,7 @@ }, { "name": "twig/intl-extra", - "version": "v3.16.0", + "version": "v3.17.0", "source": { "type": "git", "url": "https://github.com/twigphp/intl-extra.git", @@ -9661,7 +9661,7 @@ "twig" ], "support": { - "source": "https://github.com/twigphp/intl-extra/tree/v3.16.0" + "source": "https://github.com/twigphp/intl-extra/tree/v3.17.0" }, "funding": [ { @@ -9677,16 +9677,16 @@ }, { "name": "twig/string-extra", - "version": "v3.16.0", + "version": "v3.17.0", "source": { "type": "git", "url": "https://github.com/twigphp/string-extra.git", - "reference": "3f90208078a7d55ad4a561301ee3929d3e3840e0" + "reference": "cb4eec11de02f63ad8ea9d065a1f27752d0bf752" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/twigphp/string-extra/zipball/3f90208078a7d55ad4a561301ee3929d3e3840e0", - "reference": "3f90208078a7d55ad4a561301ee3929d3e3840e0", + "url": "https://api.github.com/repos/twigphp/string-extra/zipball/cb4eec11de02f63ad8ea9d065a1f27752d0bf752", + "reference": "cb4eec11de02f63ad8ea9d065a1f27752d0bf752", "shasum": "" }, "require": { @@ -9728,7 +9728,7 @@ "unicode" ], "support": { - "source": "https://github.com/twigphp/string-extra/tree/v3.16.0" + "source": "https://github.com/twigphp/string-extra/tree/v3.17.0" }, "funding": [ { @@ -9740,20 +9740,20 @@ "type": "tidelift" } ], - "time": "2024-11-20T13:10:15+00:00" + "time": "2024-11-30T08:42:13+00:00" }, { "name": "twig/twig", - "version": "v3.16.0", + "version": "v3.17.1", "source": { "type": "git", "url": "https://github.com/twigphp/Twig.git", - "reference": "475ad2dc97d65d8631393e721e7e44fb544f0561" + "reference": "677ef8da6497a03048192aeeb5aa3018e379ac71" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/twigphp/Twig/zipball/475ad2dc97d65d8631393e721e7e44fb544f0561", - "reference": "475ad2dc97d65d8631393e721e7e44fb544f0561", + "url": "https://api.github.com/repos/twigphp/Twig/zipball/677ef8da6497a03048192aeeb5aa3018e379ac71", + "reference": "677ef8da6497a03048192aeeb5aa3018e379ac71", "shasum": "" }, "require": { @@ -9808,7 +9808,7 @@ ], "support": { "issues": "https://github.com/twigphp/Twig/issues", - "source": "https://github.com/twigphp/Twig/tree/v3.16.0" + "source": "https://github.com/twigphp/Twig/tree/v3.17.1" }, "funding": [ { @@ -9820,7 +9820,7 @@ "type": "tidelift" } ], - "time": "2024-11-29T08:27:05+00:00" + "time": "2024-12-12T09:58:10+00:00" }, { "name": "webmozart/assert", @@ -10153,13 +10153,13 @@ }, "type": "library", "extra": { - "branch-alias": { - "dev-main": "3.x-dev" - }, "phpstan": { "includes": [ "extension.neon" ] + }, + "branch-alias": { + "dev-main": "3.x-dev" } }, "autoload": { @@ -10340,16 +10340,16 @@ }, { "name": "doctrine/data-fixtures", - "version": "2.0.0", + "version": "2.0.1", "source": { "type": "git", "url": "https://github.com/doctrine/data-fixtures.git", - "reference": "eddc4c37beff550a9172a449ab285f4511573dc8" + "reference": "2ae45139f148c9272c49a521d82cc50491355a99" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/doctrine/data-fixtures/zipball/eddc4c37beff550a9172a449ab285f4511573dc8", - "reference": "eddc4c37beff550a9172a449ab285f4511573dc8", + "url": "https://api.github.com/repos/doctrine/data-fixtures/zipball/2ae45139f148c9272c49a521d82cc50491355a99", + "reference": "2ae45139f148c9272c49a521d82cc50491355a99", "shasum": "" }, "require": { @@ -10403,7 +10403,7 @@ ], "support": { "issues": "https://github.com/doctrine/data-fixtures/issues", - "source": "https://github.com/doctrine/data-fixtures/tree/2.0.0" + "source": "https://github.com/doctrine/data-fixtures/tree/2.0.1" }, "funding": [ { @@ -10419,44 +10419,44 @@ "type": "tidelift" } ], - "time": "2024-11-06T07:58:24+00:00" + "time": "2024-12-10T07:03:23+00:00" }, { "name": "doctrine/doctrine-fixtures-bundle", - "version": "3.7.0", + "version": "3.7.1", "source": { "type": "git", "url": "https://github.com/doctrine/DoctrineFixturesBundle.git", - "reference": "3004c9b3ac3d2a8f484597416ae1882040b3ef3b" + "reference": "bd59519a7532b9e1a41cef4049d5326dfac7def9" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/doctrine/DoctrineFixturesBundle/zipball/3004c9b3ac3d2a8f484597416ae1882040b3ef3b", - "reference": "3004c9b3ac3d2a8f484597416ae1882040b3ef3b", + "url": "https://api.github.com/repos/doctrine/DoctrineFixturesBundle/zipball/bd59519a7532b9e1a41cef4049d5326dfac7def9", + "reference": "bd59519a7532b9e1a41cef4049d5326dfac7def9", "shasum": "" }, "require": { - "doctrine/data-fixtures": "^1.5|^2.0", + "doctrine/data-fixtures": "^1.5 || ^2.0", "doctrine/doctrine-bundle": "^2.2", "doctrine/orm": "^2.14.0 || ^3.0", - "doctrine/persistence": "^2.4|^3.0", + "doctrine/persistence": "^2.4 || ^3.0", "php": "^7.4 || ^8.0", - "symfony/config": "^5.4|^6.0|^7.0", - "symfony/console": "^5.4|^6.0|^7.0", - "symfony/dependency-injection": "^5.4|^6.0|^7.0", - "symfony/deprecation-contracts": "^2.1|^3", - "symfony/doctrine-bridge": "^5.4.48|^6.4.16|^7.1.9", - "symfony/http-kernel": "^5.4|^6.0|^7.0" + "psr/log": "^1 || ^2 || ^3", + "symfony/config": "^5.4 || ^6.0 || ^7.0", + "symfony/console": "^5.4 || ^6.0 || ^7.0", + "symfony/dependency-injection": "^5.4 || ^6.0 || ^7.0", + "symfony/deprecation-contracts": "^2.1 || ^3", + "symfony/doctrine-bridge": "^5.4.48 || ^6.4.16 || ^7.1.9", + "symfony/http-kernel": "^5.4 || ^6.0 || ^7.0" }, "conflict": { "doctrine/dbal": "< 3" }, "require-dev": { "doctrine/coding-standard": "^12", - "phpstan/phpstan": "^1.10.39", + "phpstan/phpstan": "^2", "phpunit/phpunit": "^9.6.13", - "symfony/phpunit-bridge": "^6.3.6", - "vimeo/psalm": "^5.15" + "symfony/phpunit-bridge": "^6.3.6" }, "type": "symfony-bundle", "autoload": { @@ -10490,7 +10490,7 @@ ], "support": { "issues": "https://github.com/doctrine/DoctrineFixturesBundle/issues", - "source": "https://github.com/doctrine/DoctrineFixturesBundle/tree/3.7.0" + "source": "https://github.com/doctrine/DoctrineFixturesBundle/tree/3.7.1" }, "funding": [ { @@ -10506,7 +10506,7 @@ "type": "tidelift" } ], - "time": "2024-11-28T07:19:21+00:00" + "time": "2024-12-03T17:07:51+00:00" }, { "name": "evenement/evenement", @@ -11027,16 +11027,16 @@ }, { "name": "phpstan/phpstan", - "version": "2.0.3", + "version": "2.0.4", "source": { "type": "git", "url": "https://github.com/phpstan/phpstan.git", - "reference": "46b4d3529b12178112d9008337beda0cc2a1a6b4" + "reference": "50d276fc3bf1430ec315f2f109bbde2769821524" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/phpstan/phpstan/zipball/46b4d3529b12178112d9008337beda0cc2a1a6b4", - "reference": "46b4d3529b12178112d9008337beda0cc2a1a6b4", + "url": "https://api.github.com/repos/phpstan/phpstan/zipball/50d276fc3bf1430ec315f2f109bbde2769821524", + "reference": "50d276fc3bf1430ec315f2f109bbde2769821524", "shasum": "" }, "require": { @@ -11081,7 +11081,7 @@ "type": "github" } ], - "time": "2024-11-28T22:19:37+00:00" + "time": "2024-12-17T17:14:01+00:00" }, { "name": "phpstan/phpstan-deprecation-rules", @@ -11203,21 +11203,21 @@ }, { "name": "phpstan/phpstan-phpunit", - "version": "2.0.1", + "version": "2.0.3", "source": { "type": "git", "url": "https://github.com/phpstan/phpstan-phpunit.git", - "reference": "4b6ad7fab8683ff4efd7887ba26ef8ee171c7475" + "reference": "e32ac656788a5bf3dedda89e6a2cad5643bf1a18" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/phpstan/phpstan-phpunit/zipball/4b6ad7fab8683ff4efd7887ba26ef8ee171c7475", - "reference": "4b6ad7fab8683ff4efd7887ba26ef8ee171c7475", + "url": "https://api.github.com/repos/phpstan/phpstan-phpunit/zipball/e32ac656788a5bf3dedda89e6a2cad5643bf1a18", + "reference": "e32ac656788a5bf3dedda89e6a2cad5643bf1a18", "shasum": "" }, "require": { "php": "^7.4 || ^8.0", - "phpstan/phpstan": "^2.0" + "phpstan/phpstan": "^2.0.4" }, "conflict": { "phpunit/phpunit": "<7.0" @@ -11248,27 +11248,27 @@ "description": "PHPUnit extensions and rules for PHPStan", "support": { "issues": "https://github.com/phpstan/phpstan-phpunit/issues", - "source": "https://github.com/phpstan/phpstan-phpunit/tree/2.0.1" + "source": "https://github.com/phpstan/phpstan-phpunit/tree/2.0.3" }, - "time": "2024-11-12T12:48:00+00:00" + "time": "2024-12-19T09:14:43+00:00" }, { "name": "phpstan/phpstan-strict-rules", - "version": "2.0.0", + "version": "2.0.1", "source": { "type": "git", "url": "https://github.com/phpstan/phpstan-strict-rules.git", - "reference": "a4a6a08bd4a461e516b9c3b8fdbf0f1883b34158" + "reference": "ed6fea0ad4ad9c7e25f3ad2e7c4d420cf1e67fe3" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/phpstan/phpstan-strict-rules/zipball/a4a6a08bd4a461e516b9c3b8fdbf0f1883b34158", - "reference": "a4a6a08bd4a461e516b9c3b8fdbf0f1883b34158", + "url": "https://api.github.com/repos/phpstan/phpstan-strict-rules/zipball/ed6fea0ad4ad9c7e25f3ad2e7c4d420cf1e67fe3", + "reference": "ed6fea0ad4ad9c7e25f3ad2e7c4d420cf1e67fe3", "shasum": "" }, "require": { "php": "^7.4 || ^8.0", - "phpstan/phpstan": "^2.0" + "phpstan/phpstan": "^2.0.4" }, "require-dev": { "php-parallel-lint/php-parallel-lint": "^1.2", @@ -11296,9 +11296,9 @@ "description": "Extra strict and opinionated rules for PHPStan", "support": { "issues": "https://github.com/phpstan/phpstan-strict-rules/issues", - "source": "https://github.com/phpstan/phpstan-strict-rules/tree/2.0.0" + "source": "https://github.com/phpstan/phpstan-strict-rules/tree/2.0.1" }, - "time": "2024-10-26T16:04:33+00:00" + "time": "2024-12-12T20:21:10+00:00" }, { "name": "phpstan/phpstan-symfony", @@ -11373,16 +11373,16 @@ }, { "name": "phpunit/php-code-coverage", - "version": "9.2.32", + "version": "10.1.16", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/php-code-coverage.git", - "reference": "85402a822d1ecf1db1096959413d35e1c37cf1a5" + "reference": "7e308268858ed6baedc8704a304727d20bc07c77" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/php-code-coverage/zipball/85402a822d1ecf1db1096959413d35e1c37cf1a5", - "reference": "85402a822d1ecf1db1096959413d35e1c37cf1a5", + "url": "https://api.github.com/repos/sebastianbergmann/php-code-coverage/zipball/7e308268858ed6baedc8704a304727d20bc07c77", + "reference": "7e308268858ed6baedc8704a304727d20bc07c77", "shasum": "" }, "require": { @@ -11390,18 +11390,18 @@ "ext-libxml": "*", "ext-xmlwriter": "*", "nikic/php-parser": "^4.19.1 || ^5.1.0", - "php": ">=7.3", - "phpunit/php-file-iterator": "^3.0.6", - "phpunit/php-text-template": "^2.0.4", - "sebastian/code-unit-reverse-lookup": "^2.0.3", - "sebastian/complexity": "^2.0.3", - "sebastian/environment": "^5.1.5", - "sebastian/lines-of-code": "^1.0.4", - "sebastian/version": "^3.0.2", + "php": ">=8.1", + "phpunit/php-file-iterator": "^4.1.0", + "phpunit/php-text-template": "^3.0.1", + "sebastian/code-unit-reverse-lookup": "^3.0.0", + "sebastian/complexity": "^3.2.0", + "sebastian/environment": "^6.1.0", + "sebastian/lines-of-code": "^2.0.2", + "sebastian/version": "^4.0.1", "theseer/tokenizer": "^1.2.3" }, "require-dev": { - "phpunit/phpunit": "^9.6" + "phpunit/phpunit": "^10.1" }, "suggest": { "ext-pcov": "PHP extension that provides line coverage", @@ -11410,7 +11410,7 @@ "type": "library", "extra": { "branch-alias": { - "dev-main": "9.2.x-dev" + "dev-main": "10.1.x-dev" } }, "autoload": { @@ -11439,7 +11439,7 @@ "support": { "issues": "https://github.com/sebastianbergmann/php-code-coverage/issues", "security": "https://github.com/sebastianbergmann/php-code-coverage/security/policy", - "source": "https://github.com/sebastianbergmann/php-code-coverage/tree/9.2.32" + "source": "https://github.com/sebastianbergmann/php-code-coverage/tree/10.1.16" }, "funding": [ { @@ -11447,32 +11447,32 @@ "type": "github" } ], - "time": "2024-08-22T04:23:01+00:00" + "time": "2024-08-22T04:31:57+00:00" }, { "name": "phpunit/php-file-iterator", - "version": "3.0.6", + "version": "4.1.0", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/php-file-iterator.git", - "reference": "cf1c2e7c203ac650e352f4cc675a7021e7d1b3cf" + "reference": "a95037b6d9e608ba092da1b23931e537cadc3c3c" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/php-file-iterator/zipball/cf1c2e7c203ac650e352f4cc675a7021e7d1b3cf", - "reference": "cf1c2e7c203ac650e352f4cc675a7021e7d1b3cf", + "url": "https://api.github.com/repos/sebastianbergmann/php-file-iterator/zipball/a95037b6d9e608ba092da1b23931e537cadc3c3c", + "reference": "a95037b6d9e608ba092da1b23931e537cadc3c3c", "shasum": "" }, "require": { - "php": ">=7.3" + "php": ">=8.1" }, "require-dev": { - "phpunit/phpunit": "^9.3" + "phpunit/phpunit": "^10.0" }, "type": "library", "extra": { "branch-alias": { - "dev-master": "3.0-dev" + "dev-main": "4.0-dev" } }, "autoload": { @@ -11499,7 +11499,8 @@ ], "support": { "issues": "https://github.com/sebastianbergmann/php-file-iterator/issues", - "source": "https://github.com/sebastianbergmann/php-file-iterator/tree/3.0.6" + "security": "https://github.com/sebastianbergmann/php-file-iterator/security/policy", + "source": "https://github.com/sebastianbergmann/php-file-iterator/tree/4.1.0" }, "funding": [ { @@ -11507,28 +11508,28 @@ "type": "github" } ], - "time": "2021-12-02T12:48:52+00:00" + "time": "2023-08-31T06:24:48+00:00" }, { "name": "phpunit/php-invoker", - "version": "3.1.1", + "version": "4.0.0", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/php-invoker.git", - "reference": "5a10147d0aaf65b58940a0b72f71c9ac0423cc67" + "reference": "f5e568ba02fa5ba0ddd0f618391d5a9ea50b06d7" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/php-invoker/zipball/5a10147d0aaf65b58940a0b72f71c9ac0423cc67", - "reference": "5a10147d0aaf65b58940a0b72f71c9ac0423cc67", + "url": "https://api.github.com/repos/sebastianbergmann/php-invoker/zipball/f5e568ba02fa5ba0ddd0f618391d5a9ea50b06d7", + "reference": "f5e568ba02fa5ba0ddd0f618391d5a9ea50b06d7", "shasum": "" }, "require": { - "php": ">=7.3" + "php": ">=8.1" }, "require-dev": { "ext-pcntl": "*", - "phpunit/phpunit": "^9.3" + "phpunit/phpunit": "^10.0" }, "suggest": { "ext-pcntl": "*" @@ -11536,7 +11537,7 @@ "type": "library", "extra": { "branch-alias": { - "dev-master": "3.1-dev" + "dev-main": "4.0-dev" } }, "autoload": { @@ -11562,7 +11563,7 @@ ], "support": { "issues": "https://github.com/sebastianbergmann/php-invoker/issues", - "source": "https://github.com/sebastianbergmann/php-invoker/tree/3.1.1" + "source": "https://github.com/sebastianbergmann/php-invoker/tree/4.0.0" }, "funding": [ { @@ -11570,32 +11571,32 @@ "type": "github" } ], - "time": "2020-09-28T05:58:55+00:00" + "time": "2023-02-03T06:56:09+00:00" }, { "name": "phpunit/php-text-template", - "version": "2.0.4", + "version": "3.0.1", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/php-text-template.git", - "reference": "5da5f67fc95621df9ff4c4e5a84d6a8a2acf7c28" + "reference": "0c7b06ff49e3d5072f057eb1fa59258bf287a748" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/php-text-template/zipball/5da5f67fc95621df9ff4c4e5a84d6a8a2acf7c28", - "reference": "5da5f67fc95621df9ff4c4e5a84d6a8a2acf7c28", + "url": "https://api.github.com/repos/sebastianbergmann/php-text-template/zipball/0c7b06ff49e3d5072f057eb1fa59258bf287a748", + "reference": "0c7b06ff49e3d5072f057eb1fa59258bf287a748", "shasum": "" }, "require": { - "php": ">=7.3" + "php": ">=8.1" }, "require-dev": { - "phpunit/phpunit": "^9.3" + "phpunit/phpunit": "^10.0" }, "type": "library", "extra": { "branch-alias": { - "dev-master": "2.0-dev" + "dev-main": "3.0-dev" } }, "autoload": { @@ -11621,7 +11622,8 @@ ], "support": { "issues": "https://github.com/sebastianbergmann/php-text-template/issues", - "source": "https://github.com/sebastianbergmann/php-text-template/tree/2.0.4" + "security": "https://github.com/sebastianbergmann/php-text-template/security/policy", + "source": "https://github.com/sebastianbergmann/php-text-template/tree/3.0.1" }, "funding": [ { @@ -11629,32 +11631,32 @@ "type": "github" } ], - "time": "2020-10-26T05:33:50+00:00" + "time": "2023-08-31T14:07:24+00:00" }, { "name": "phpunit/php-timer", - "version": "5.0.3", + "version": "6.0.0", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/php-timer.git", - "reference": "5a63ce20ed1b5bf577850e2c4e87f4aa902afbd2" + "reference": "e2a2d67966e740530f4a3343fe2e030ffdc1161d" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/php-timer/zipball/5a63ce20ed1b5bf577850e2c4e87f4aa902afbd2", - "reference": "5a63ce20ed1b5bf577850e2c4e87f4aa902afbd2", + "url": "https://api.github.com/repos/sebastianbergmann/php-timer/zipball/e2a2d67966e740530f4a3343fe2e030ffdc1161d", + "reference": "e2a2d67966e740530f4a3343fe2e030ffdc1161d", "shasum": "" }, "require": { - "php": ">=7.3" + "php": ">=8.1" }, "require-dev": { - "phpunit/phpunit": "^9.3" + "phpunit/phpunit": "^10.0" }, "type": "library", "extra": { "branch-alias": { - "dev-master": "5.0-dev" + "dev-main": "6.0-dev" } }, "autoload": { @@ -11680,7 +11682,7 @@ ], "support": { "issues": "https://github.com/sebastianbergmann/php-timer/issues", - "source": "https://github.com/sebastianbergmann/php-timer/tree/5.0.3" + "source": "https://github.com/sebastianbergmann/php-timer/tree/6.0.0" }, "funding": [ { @@ -11688,54 +11690,52 @@ "type": "github" } ], - "time": "2020-10-26T13:16:10+00:00" + "time": "2023-02-03T06:57:52+00:00" }, { "name": "phpunit/phpunit", - "version": "9.5.28", + "version": "10.5.40", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/phpunit.git", - "reference": "954ca3113a03bf780d22f07bf055d883ee04b65e" + "reference": "e6ddda95af52f69c1e0c7b4f977cccb58048798c" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/phpunit/zipball/954ca3113a03bf780d22f07bf055d883ee04b65e", - "reference": "954ca3113a03bf780d22f07bf055d883ee04b65e", + "url": "https://api.github.com/repos/sebastianbergmann/phpunit/zipball/e6ddda95af52f69c1e0c7b4f977cccb58048798c", + "reference": "e6ddda95af52f69c1e0c7b4f977cccb58048798c", "shasum": "" }, "require": { - "doctrine/instantiator": "^1.3.1 || ^2", "ext-dom": "*", "ext-json": "*", "ext-libxml": "*", "ext-mbstring": "*", "ext-xml": "*", "ext-xmlwriter": "*", - "myclabs/deep-copy": "^1.10.1", - "phar-io/manifest": "^2.0.3", - "phar-io/version": "^3.0.2", - "php": ">=7.3", - "phpunit/php-code-coverage": "^9.2.13", - "phpunit/php-file-iterator": "^3.0.5", - "phpunit/php-invoker": "^3.1.1", - "phpunit/php-text-template": "^2.0.3", - "phpunit/php-timer": "^5.0.2", - "sebastian/cli-parser": "^1.0.1", - "sebastian/code-unit": "^1.0.6", - "sebastian/comparator": "^4.0.8", - "sebastian/diff": "^4.0.3", - "sebastian/environment": "^5.1.3", - "sebastian/exporter": "^4.0.5", - "sebastian/global-state": "^5.0.1", - "sebastian/object-enumerator": "^4.0.3", - "sebastian/resource-operations": "^3.0.3", - "sebastian/type": "^3.2", - "sebastian/version": "^3.0.2" + "myclabs/deep-copy": "^1.12.1", + "phar-io/manifest": "^2.0.4", + "phar-io/version": "^3.2.1", + "php": ">=8.1", + "phpunit/php-code-coverage": "^10.1.16", + "phpunit/php-file-iterator": "^4.1.0", + "phpunit/php-invoker": "^4.0.0", + "phpunit/php-text-template": "^3.0.1", + "phpunit/php-timer": "^6.0.0", + "sebastian/cli-parser": "^2.0.1", + "sebastian/code-unit": "^2.0.0", + "sebastian/comparator": "^5.0.3", + "sebastian/diff": "^5.1.1", + "sebastian/environment": "^6.1.0", + "sebastian/exporter": "^5.1.2", + "sebastian/global-state": "^6.0.2", + "sebastian/object-enumerator": "^5.0.0", + "sebastian/recursion-context": "^5.0.0", + "sebastian/type": "^4.0.0", + "sebastian/version": "^4.0.1" }, "suggest": { - "ext-soap": "*", - "ext-xdebug": "*" + "ext-soap": "To be able to generate mocks based on WSDL files" }, "bin": [ "phpunit" @@ -11743,7 +11743,7 @@ "type": "library", "extra": { "branch-alias": { - "dev-master": "9.5-dev" + "dev-main": "10.5-dev" } }, "autoload": { @@ -11774,7 +11774,8 @@ ], "support": { "issues": "https://github.com/sebastianbergmann/phpunit/issues", - "source": "https://github.com/sebastianbergmann/phpunit/tree/9.5.28" + "security": "https://github.com/sebastianbergmann/phpunit/security/policy", + "source": "https://github.com/sebastianbergmann/phpunit/tree/10.5.40" }, "funding": [ { @@ -11790,7 +11791,7 @@ "type": "tidelift" } ], - "time": "2023-01-14T12:32:24+00:00" + "time": "2024-12-21T05:49:06+00:00" }, { "name": "react/cache", @@ -12324,28 +12325,28 @@ }, { "name": "sebastian/cli-parser", - "version": "1.0.2", + "version": "2.0.1", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/cli-parser.git", - "reference": "2b56bea83a09de3ac06bb18b92f068e60cc6f50b" + "reference": "c34583b87e7b7a8055bf6c450c2c77ce32a24084" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/cli-parser/zipball/2b56bea83a09de3ac06bb18b92f068e60cc6f50b", - "reference": "2b56bea83a09de3ac06bb18b92f068e60cc6f50b", + "url": "https://api.github.com/repos/sebastianbergmann/cli-parser/zipball/c34583b87e7b7a8055bf6c450c2c77ce32a24084", + "reference": "c34583b87e7b7a8055bf6c450c2c77ce32a24084", "shasum": "" }, "require": { - "php": ">=7.3" + "php": ">=8.1" }, "require-dev": { - "phpunit/phpunit": "^9.3" + "phpunit/phpunit": "^10.0" }, "type": "library", "extra": { "branch-alias": { - "dev-master": "1.0-dev" + "dev-main": "2.0-dev" } }, "autoload": { @@ -12368,7 +12369,8 @@ "homepage": "https://github.com/sebastianbergmann/cli-parser", "support": { "issues": "https://github.com/sebastianbergmann/cli-parser/issues", - "source": "https://github.com/sebastianbergmann/cli-parser/tree/1.0.2" + "security": "https://github.com/sebastianbergmann/cli-parser/security/policy", + "source": "https://github.com/sebastianbergmann/cli-parser/tree/2.0.1" }, "funding": [ { @@ -12376,32 +12378,32 @@ "type": "github" } ], - "time": "2024-03-02T06:27:43+00:00" + "time": "2024-03-02T07:12:49+00:00" }, { "name": "sebastian/code-unit", - "version": "1.0.8", + "version": "2.0.0", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/code-unit.git", - "reference": "1fc9f64c0927627ef78ba436c9b17d967e68e120" + "reference": "a81fee9eef0b7a76af11d121767abc44c104e503" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/code-unit/zipball/1fc9f64c0927627ef78ba436c9b17d967e68e120", - "reference": "1fc9f64c0927627ef78ba436c9b17d967e68e120", + "url": "https://api.github.com/repos/sebastianbergmann/code-unit/zipball/a81fee9eef0b7a76af11d121767abc44c104e503", + "reference": "a81fee9eef0b7a76af11d121767abc44c104e503", "shasum": "" }, "require": { - "php": ">=7.3" + "php": ">=8.1" }, "require-dev": { - "phpunit/phpunit": "^9.3" + "phpunit/phpunit": "^10.0" }, "type": "library", "extra": { "branch-alias": { - "dev-master": "1.0-dev" + "dev-main": "2.0-dev" } }, "autoload": { @@ -12424,7 +12426,7 @@ "homepage": "https://github.com/sebastianbergmann/code-unit", "support": { "issues": "https://github.com/sebastianbergmann/code-unit/issues", - "source": "https://github.com/sebastianbergmann/code-unit/tree/1.0.8" + "source": "https://github.com/sebastianbergmann/code-unit/tree/2.0.0" }, "funding": [ { @@ -12432,32 +12434,32 @@ "type": "github" } ], - "time": "2020-10-26T13:08:54+00:00" + "time": "2023-02-03T06:58:43+00:00" }, { "name": "sebastian/code-unit-reverse-lookup", - "version": "2.0.3", + "version": "3.0.0", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/code-unit-reverse-lookup.git", - "reference": "ac91f01ccec49fb77bdc6fd1e548bc70f7faa3e5" + "reference": "5e3a687f7d8ae33fb362c5c0743794bbb2420a1d" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/code-unit-reverse-lookup/zipball/ac91f01ccec49fb77bdc6fd1e548bc70f7faa3e5", - "reference": "ac91f01ccec49fb77bdc6fd1e548bc70f7faa3e5", + "url": "https://api.github.com/repos/sebastianbergmann/code-unit-reverse-lookup/zipball/5e3a687f7d8ae33fb362c5c0743794bbb2420a1d", + "reference": "5e3a687f7d8ae33fb362c5c0743794bbb2420a1d", "shasum": "" }, "require": { - "php": ">=7.3" + "php": ">=8.1" }, "require-dev": { - "phpunit/phpunit": "^9.3" + "phpunit/phpunit": "^10.0" }, "type": "library", "extra": { "branch-alias": { - "dev-master": "2.0-dev" + "dev-main": "3.0-dev" } }, "autoload": { @@ -12479,7 +12481,7 @@ "homepage": "https://github.com/sebastianbergmann/code-unit-reverse-lookup/", "support": { "issues": "https://github.com/sebastianbergmann/code-unit-reverse-lookup/issues", - "source": "https://github.com/sebastianbergmann/code-unit-reverse-lookup/tree/2.0.3" + "source": "https://github.com/sebastianbergmann/code-unit-reverse-lookup/tree/3.0.0" }, "funding": [ { @@ -12487,34 +12489,36 @@ "type": "github" } ], - "time": "2020-09-28T05:30:19+00:00" + "time": "2023-02-03T06:59:15+00:00" }, { "name": "sebastian/comparator", - "version": "4.0.8", + "version": "5.0.3", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/comparator.git", - "reference": "fa0f136dd2334583309d32b62544682ee972b51a" + "reference": "a18251eb0b7a2dcd2f7aa3d6078b18545ef0558e" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/comparator/zipball/fa0f136dd2334583309d32b62544682ee972b51a", - "reference": "fa0f136dd2334583309d32b62544682ee972b51a", + "url": "https://api.github.com/repos/sebastianbergmann/comparator/zipball/a18251eb0b7a2dcd2f7aa3d6078b18545ef0558e", + "reference": "a18251eb0b7a2dcd2f7aa3d6078b18545ef0558e", "shasum": "" }, "require": { - "php": ">=7.3", - "sebastian/diff": "^4.0", - "sebastian/exporter": "^4.0" + "ext-dom": "*", + "ext-mbstring": "*", + "php": ">=8.1", + "sebastian/diff": "^5.0", + "sebastian/exporter": "^5.0" }, "require-dev": { - "phpunit/phpunit": "^9.3" + "phpunit/phpunit": "^10.5" }, "type": "library", "extra": { "branch-alias": { - "dev-master": "4.0-dev" + "dev-main": "5.0-dev" } }, "autoload": { @@ -12553,7 +12557,8 @@ ], "support": { "issues": "https://github.com/sebastianbergmann/comparator/issues", - "source": "https://github.com/sebastianbergmann/comparator/tree/4.0.8" + "security": "https://github.com/sebastianbergmann/comparator/security/policy", + "source": "https://github.com/sebastianbergmann/comparator/tree/5.0.3" }, "funding": [ { @@ -12561,33 +12566,33 @@ "type": "github" } ], - "time": "2022-09-14T12:41:17+00:00" + "time": "2024-10-18T14:56:07+00:00" }, { "name": "sebastian/complexity", - "version": "2.0.3", + "version": "3.2.0", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/complexity.git", - "reference": "25f207c40d62b8b7aa32f5ab026c53561964053a" + "reference": "68ff824baeae169ec9f2137158ee529584553799" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/complexity/zipball/25f207c40d62b8b7aa32f5ab026c53561964053a", - "reference": "25f207c40d62b8b7aa32f5ab026c53561964053a", + "url": "https://api.github.com/repos/sebastianbergmann/complexity/zipball/68ff824baeae169ec9f2137158ee529584553799", + "reference": "68ff824baeae169ec9f2137158ee529584553799", "shasum": "" }, "require": { "nikic/php-parser": "^4.18 || ^5.0", - "php": ">=7.3" + "php": ">=8.1" }, "require-dev": { - "phpunit/phpunit": "^9.3" + "phpunit/phpunit": "^10.0" }, "type": "library", "extra": { "branch-alias": { - "dev-master": "2.0-dev" + "dev-main": "3.2-dev" } }, "autoload": { @@ -12610,7 +12615,8 @@ "homepage": "https://github.com/sebastianbergmann/complexity", "support": { "issues": "https://github.com/sebastianbergmann/complexity/issues", - "source": "https://github.com/sebastianbergmann/complexity/tree/2.0.3" + "security": "https://github.com/sebastianbergmann/complexity/security/policy", + "source": "https://github.com/sebastianbergmann/complexity/tree/3.2.0" }, "funding": [ { @@ -12618,33 +12624,33 @@ "type": "github" } ], - "time": "2023-12-22T06:19:30+00:00" + "time": "2023-12-21T08:37:17+00:00" }, { "name": "sebastian/diff", - "version": "4.0.6", + "version": "5.1.1", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/diff.git", - "reference": "ba01945089c3a293b01ba9badc29ad55b106b0bc" + "reference": "c41e007b4b62af48218231d6c2275e4c9b975b2e" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/diff/zipball/ba01945089c3a293b01ba9badc29ad55b106b0bc", - "reference": "ba01945089c3a293b01ba9badc29ad55b106b0bc", + "url": "https://api.github.com/repos/sebastianbergmann/diff/zipball/c41e007b4b62af48218231d6c2275e4c9b975b2e", + "reference": "c41e007b4b62af48218231d6c2275e4c9b975b2e", "shasum": "" }, "require": { - "php": ">=7.3" + "php": ">=8.1" }, "require-dev": { - "phpunit/phpunit": "^9.3", - "symfony/process": "^4.2 || ^5" + "phpunit/phpunit": "^10.0", + "symfony/process": "^6.4" }, "type": "library", "extra": { "branch-alias": { - "dev-master": "4.0-dev" + "dev-main": "5.1-dev" } }, "autoload": { @@ -12676,7 +12682,8 @@ ], "support": { "issues": "https://github.com/sebastianbergmann/diff/issues", - "source": "https://github.com/sebastianbergmann/diff/tree/4.0.6" + "security": "https://github.com/sebastianbergmann/diff/security/policy", + "source": "https://github.com/sebastianbergmann/diff/tree/5.1.1" }, "funding": [ { @@ -12684,27 +12691,27 @@ "type": "github" } ], - "time": "2024-03-02T06:30:58+00:00" + "time": "2024-03-02T07:15:17+00:00" }, { "name": "sebastian/environment", - "version": "5.1.5", + "version": "6.1.0", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/environment.git", - "reference": "830c43a844f1f8d5b7a1f6d6076b784454d8b7ed" + "reference": "8074dbcd93529b357029f5cc5058fd3e43666984" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/environment/zipball/830c43a844f1f8d5b7a1f6d6076b784454d8b7ed", - "reference": "830c43a844f1f8d5b7a1f6d6076b784454d8b7ed", + "url": "https://api.github.com/repos/sebastianbergmann/environment/zipball/8074dbcd93529b357029f5cc5058fd3e43666984", + "reference": "8074dbcd93529b357029f5cc5058fd3e43666984", "shasum": "" }, "require": { - "php": ">=7.3" + "php": ">=8.1" }, "require-dev": { - "phpunit/phpunit": "^9.3" + "phpunit/phpunit": "^10.0" }, "suggest": { "ext-posix": "*" @@ -12712,7 +12719,7 @@ "type": "library", "extra": { "branch-alias": { - "dev-master": "5.1-dev" + "dev-main": "6.1-dev" } }, "autoload": { @@ -12731,7 +12738,7 @@ } ], "description": "Provides functionality to handle HHVM/PHP environments", - "homepage": "http://www.github.com/sebastianbergmann/environment", + "homepage": "https://github.com/sebastianbergmann/environment", "keywords": [ "Xdebug", "environment", @@ -12739,7 +12746,8 @@ ], "support": { "issues": "https://github.com/sebastianbergmann/environment/issues", - "source": "https://github.com/sebastianbergmann/environment/tree/5.1.5" + "security": "https://github.com/sebastianbergmann/environment/security/policy", + "source": "https://github.com/sebastianbergmann/environment/tree/6.1.0" }, "funding": [ { @@ -12747,34 +12755,34 @@ "type": "github" } ], - "time": "2023-02-03T06:03:51+00:00" + "time": "2024-03-23T08:47:14+00:00" }, { "name": "sebastian/exporter", - "version": "4.0.6", + "version": "5.1.2", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/exporter.git", - "reference": "78c00df8f170e02473b682df15bfcdacc3d32d72" + "reference": "955288482d97c19a372d3f31006ab3f37da47adf" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/exporter/zipball/78c00df8f170e02473b682df15bfcdacc3d32d72", - "reference": "78c00df8f170e02473b682df15bfcdacc3d32d72", + "url": "https://api.github.com/repos/sebastianbergmann/exporter/zipball/955288482d97c19a372d3f31006ab3f37da47adf", + "reference": "955288482d97c19a372d3f31006ab3f37da47adf", "shasum": "" }, "require": { - "php": ">=7.3", - "sebastian/recursion-context": "^4.0" + "ext-mbstring": "*", + "php": ">=8.1", + "sebastian/recursion-context": "^5.0" }, "require-dev": { - "ext-mbstring": "*", - "phpunit/phpunit": "^9.3" + "phpunit/phpunit": "^10.0" }, "type": "library", "extra": { "branch-alias": { - "dev-master": "4.0-dev" + "dev-main": "5.1-dev" } }, "autoload": { @@ -12816,7 +12824,8 @@ ], "support": { "issues": "https://github.com/sebastianbergmann/exporter/issues", - "source": "https://github.com/sebastianbergmann/exporter/tree/4.0.6" + "security": "https://github.com/sebastianbergmann/exporter/security/policy", + "source": "https://github.com/sebastianbergmann/exporter/tree/5.1.2" }, "funding": [ { @@ -12824,38 +12833,35 @@ "type": "github" } ], - "time": "2024-03-02T06:33:00+00:00" + "time": "2024-03-02T07:17:12+00:00" }, { "name": "sebastian/global-state", - "version": "5.0.7", + "version": "6.0.2", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/global-state.git", - "reference": "bca7df1f32ee6fe93b4d4a9abbf69e13a4ada2c9" + "reference": "987bafff24ecc4c9ac418cab1145b96dd6e9cbd9" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/global-state/zipball/bca7df1f32ee6fe93b4d4a9abbf69e13a4ada2c9", - "reference": "bca7df1f32ee6fe93b4d4a9abbf69e13a4ada2c9", + "url": "https://api.github.com/repos/sebastianbergmann/global-state/zipball/987bafff24ecc4c9ac418cab1145b96dd6e9cbd9", + "reference": "987bafff24ecc4c9ac418cab1145b96dd6e9cbd9", "shasum": "" }, "require": { - "php": ">=7.3", - "sebastian/object-reflector": "^2.0", - "sebastian/recursion-context": "^4.0" + "php": ">=8.1", + "sebastian/object-reflector": "^3.0", + "sebastian/recursion-context": "^5.0" }, "require-dev": { "ext-dom": "*", - "phpunit/phpunit": "^9.3" - }, - "suggest": { - "ext-uopz": "*" + "phpunit/phpunit": "^10.0" }, "type": "library", "extra": { "branch-alias": { - "dev-master": "5.0-dev" + "dev-main": "6.0-dev" } }, "autoload": { @@ -12874,13 +12880,14 @@ } ], "description": "Snapshotting of global state", - "homepage": "http://www.github.com/sebastianbergmann/global-state", + "homepage": "https://www.github.com/sebastianbergmann/global-state", "keywords": [ "global state" ], "support": { "issues": "https://github.com/sebastianbergmann/global-state/issues", - "source": "https://github.com/sebastianbergmann/global-state/tree/5.0.7" + "security": "https://github.com/sebastianbergmann/global-state/security/policy", + "source": "https://github.com/sebastianbergmann/global-state/tree/6.0.2" }, "funding": [ { @@ -12888,33 +12895,33 @@ "type": "github" } ], - "time": "2024-03-02T06:35:11+00:00" + "time": "2024-03-02T07:19:19+00:00" }, { "name": "sebastian/lines-of-code", - "version": "1.0.4", + "version": "2.0.2", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/lines-of-code.git", - "reference": "e1e4a170560925c26d424b6a03aed157e7dcc5c5" + "reference": "856e7f6a75a84e339195d48c556f23be2ebf75d0" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/lines-of-code/zipball/e1e4a170560925c26d424b6a03aed157e7dcc5c5", - "reference": "e1e4a170560925c26d424b6a03aed157e7dcc5c5", + "url": "https://api.github.com/repos/sebastianbergmann/lines-of-code/zipball/856e7f6a75a84e339195d48c556f23be2ebf75d0", + "reference": "856e7f6a75a84e339195d48c556f23be2ebf75d0", "shasum": "" }, "require": { "nikic/php-parser": "^4.18 || ^5.0", - "php": ">=7.3" + "php": ">=8.1" }, "require-dev": { - "phpunit/phpunit": "^9.3" + "phpunit/phpunit": "^10.0" }, "type": "library", "extra": { "branch-alias": { - "dev-master": "1.0-dev" + "dev-main": "2.0-dev" } }, "autoload": { @@ -12937,7 +12944,8 @@ "homepage": "https://github.com/sebastianbergmann/lines-of-code", "support": { "issues": "https://github.com/sebastianbergmann/lines-of-code/issues", - "source": "https://github.com/sebastianbergmann/lines-of-code/tree/1.0.4" + "security": "https://github.com/sebastianbergmann/lines-of-code/security/policy", + "source": "https://github.com/sebastianbergmann/lines-of-code/tree/2.0.2" }, "funding": [ { @@ -12945,34 +12953,34 @@ "type": "github" } ], - "time": "2023-12-22T06:20:34+00:00" + "time": "2023-12-21T08:38:20+00:00" }, { "name": "sebastian/object-enumerator", - "version": "4.0.4", + "version": "5.0.0", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/object-enumerator.git", - "reference": "5c9eeac41b290a3712d88851518825ad78f45c71" + "reference": "202d0e344a580d7f7d04b3fafce6933e59dae906" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/object-enumerator/zipball/5c9eeac41b290a3712d88851518825ad78f45c71", - "reference": "5c9eeac41b290a3712d88851518825ad78f45c71", + "url": "https://api.github.com/repos/sebastianbergmann/object-enumerator/zipball/202d0e344a580d7f7d04b3fafce6933e59dae906", + "reference": "202d0e344a580d7f7d04b3fafce6933e59dae906", "shasum": "" }, "require": { - "php": ">=7.3", - "sebastian/object-reflector": "^2.0", - "sebastian/recursion-context": "^4.0" + "php": ">=8.1", + "sebastian/object-reflector": "^3.0", + "sebastian/recursion-context": "^5.0" }, "require-dev": { - "phpunit/phpunit": "^9.3" + "phpunit/phpunit": "^10.0" }, "type": "library", "extra": { "branch-alias": { - "dev-master": "4.0-dev" + "dev-main": "5.0-dev" } }, "autoload": { @@ -12994,7 +13002,7 @@ "homepage": "https://github.com/sebastianbergmann/object-enumerator/", "support": { "issues": "https://github.com/sebastianbergmann/object-enumerator/issues", - "source": "https://github.com/sebastianbergmann/object-enumerator/tree/4.0.4" + "source": "https://github.com/sebastianbergmann/object-enumerator/tree/5.0.0" }, "funding": [ { @@ -13002,32 +13010,32 @@ "type": "github" } ], - "time": "2020-10-26T13:12:34+00:00" + "time": "2023-02-03T07:08:32+00:00" }, { "name": "sebastian/object-reflector", - "version": "2.0.4", + "version": "3.0.0", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/object-reflector.git", - "reference": "b4f479ebdbf63ac605d183ece17d8d7fe49c15c7" + "reference": "24ed13d98130f0e7122df55d06c5c4942a577957" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/object-reflector/zipball/b4f479ebdbf63ac605d183ece17d8d7fe49c15c7", - "reference": "b4f479ebdbf63ac605d183ece17d8d7fe49c15c7", + "url": "https://api.github.com/repos/sebastianbergmann/object-reflector/zipball/24ed13d98130f0e7122df55d06c5c4942a577957", + "reference": "24ed13d98130f0e7122df55d06c5c4942a577957", "shasum": "" }, "require": { - "php": ">=7.3" + "php": ">=8.1" }, "require-dev": { - "phpunit/phpunit": "^9.3" + "phpunit/phpunit": "^10.0" }, "type": "library", "extra": { "branch-alias": { - "dev-master": "2.0-dev" + "dev-main": "3.0-dev" } }, "autoload": { @@ -13049,7 +13057,7 @@ "homepage": "https://github.com/sebastianbergmann/object-reflector/", "support": { "issues": "https://github.com/sebastianbergmann/object-reflector/issues", - "source": "https://github.com/sebastianbergmann/object-reflector/tree/2.0.4" + "source": "https://github.com/sebastianbergmann/object-reflector/tree/3.0.0" }, "funding": [ { @@ -13057,32 +13065,32 @@ "type": "github" } ], - "time": "2020-10-26T13:14:26+00:00" + "time": "2023-02-03T07:06:18+00:00" }, { "name": "sebastian/recursion-context", - "version": "4.0.5", + "version": "5.0.0", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/recursion-context.git", - "reference": "e75bd0f07204fec2a0af9b0f3cfe97d05f92efc1" + "reference": "05909fb5bc7df4c52992396d0116aed689f93712" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/recursion-context/zipball/e75bd0f07204fec2a0af9b0f3cfe97d05f92efc1", - "reference": "e75bd0f07204fec2a0af9b0f3cfe97d05f92efc1", + "url": "https://api.github.com/repos/sebastianbergmann/recursion-context/zipball/05909fb5bc7df4c52992396d0116aed689f93712", + "reference": "05909fb5bc7df4c52992396d0116aed689f93712", "shasum": "" }, "require": { - "php": ">=7.3" + "php": ">=8.1" }, "require-dev": { - "phpunit/phpunit": "^9.3" + "phpunit/phpunit": "^10.0" }, "type": "library", "extra": { "branch-alias": { - "dev-master": "4.0-dev" + "dev-main": "5.0-dev" } }, "autoload": { @@ -13112,7 +13120,7 @@ "homepage": "https://github.com/sebastianbergmann/recursion-context", "support": { "issues": "https://github.com/sebastianbergmann/recursion-context/issues", - "source": "https://github.com/sebastianbergmann/recursion-context/tree/4.0.5" + "source": "https://github.com/sebastianbergmann/recursion-context/tree/5.0.0" }, "funding": [ { @@ -13120,86 +13128,32 @@ "type": "github" } ], - "time": "2023-02-03T06:07:39+00:00" - }, - { - "name": "sebastian/resource-operations", - "version": "3.0.4", - "source": { - "type": "git", - "url": "https://github.com/sebastianbergmann/resource-operations.git", - "reference": "05d5692a7993ecccd56a03e40cd7e5b09b1d404e" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/resource-operations/zipball/05d5692a7993ecccd56a03e40cd7e5b09b1d404e", - "reference": "05d5692a7993ecccd56a03e40cd7e5b09b1d404e", - "shasum": "" - }, - "require": { - "php": ">=7.3" - }, - "require-dev": { - "phpunit/phpunit": "^9.0" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-main": "3.0-dev" - } - }, - "autoload": { - "classmap": [ - "src/" - ] - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "BSD-3-Clause" - ], - "authors": [ - { - "name": "Sebastian Bergmann", - "email": "sebastian@phpunit.de" - } - ], - "description": "Provides a list of PHP built-in functions that operate on resources", - "homepage": "https://www.github.com/sebastianbergmann/resource-operations", - "support": { - "source": "https://github.com/sebastianbergmann/resource-operations/tree/3.0.4" - }, - "funding": [ - { - "url": "https://github.com/sebastianbergmann", - "type": "github" - } - ], - "time": "2024-03-14T16:00:52+00:00" + "time": "2023-02-03T07:05:40+00:00" }, { "name": "sebastian/type", - "version": "3.2.1", + "version": "4.0.0", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/type.git", - "reference": "75e2c2a32f5e0b3aef905b9ed0b179b953b3d7c7" + "reference": "462699a16464c3944eefc02ebdd77882bd3925bf" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/type/zipball/75e2c2a32f5e0b3aef905b9ed0b179b953b3d7c7", - "reference": "75e2c2a32f5e0b3aef905b9ed0b179b953b3d7c7", + "url": "https://api.github.com/repos/sebastianbergmann/type/zipball/462699a16464c3944eefc02ebdd77882bd3925bf", + "reference": "462699a16464c3944eefc02ebdd77882bd3925bf", "shasum": "" }, "require": { - "php": ">=7.3" + "php": ">=8.1" }, "require-dev": { - "phpunit/phpunit": "^9.5" + "phpunit/phpunit": "^10.0" }, "type": "library", "extra": { "branch-alias": { - "dev-master": "3.2-dev" + "dev-main": "4.0-dev" } }, "autoload": { @@ -13222,7 +13176,7 @@ "homepage": "https://github.com/sebastianbergmann/type", "support": { "issues": "https://github.com/sebastianbergmann/type/issues", - "source": "https://github.com/sebastianbergmann/type/tree/3.2.1" + "source": "https://github.com/sebastianbergmann/type/tree/4.0.0" }, "funding": [ { @@ -13230,29 +13184,29 @@ "type": "github" } ], - "time": "2023-02-03T06:13:03+00:00" + "time": "2023-02-03T07:10:45+00:00" }, { "name": "sebastian/version", - "version": "3.0.2", + "version": "4.0.1", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/version.git", - "reference": "c6c1022351a901512170118436c764e473f6de8c" + "reference": "c51fa83a5d8f43f1402e3f32a005e6262244ef17" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/version/zipball/c6c1022351a901512170118436c764e473f6de8c", - "reference": "c6c1022351a901512170118436c764e473f6de8c", + "url": "https://api.github.com/repos/sebastianbergmann/version/zipball/c51fa83a5d8f43f1402e3f32a005e6262244ef17", + "reference": "c51fa83a5d8f43f1402e3f32a005e6262244ef17", "shasum": "" }, "require": { - "php": ">=7.3" + "php": ">=8.1" }, "type": "library", "extra": { "branch-alias": { - "dev-master": "3.0-dev" + "dev-main": "4.0-dev" } }, "autoload": { @@ -13275,7 +13229,7 @@ "homepage": "https://github.com/sebastianbergmann/version", "support": { "issues": "https://github.com/sebastianbergmann/version/issues", - "source": "https://github.com/sebastianbergmann/version/tree/3.0.2" + "source": "https://github.com/sebastianbergmann/version/tree/4.0.1" }, "funding": [ { @@ -13283,7 +13237,7 @@ "type": "github" } ], - "time": "2020-09-28T06:39:44+00:00" + "time": "2023-02-07T11:34:05+00:00" }, { "name": "symfony/browser-kit", diff --git a/phpstan.neon b/phpstan.neon index de92cf96..c494538a 100644 --- a/phpstan.neon +++ b/phpstan.neon @@ -3657,11 +3657,6 @@ parameters: count: 2 path: src/Project/ProjectStatisticService.php - - - message: "#^Parameter \\#1 \\$year of method App\\\\Reporting\\\\ProjectDetails\\\\ProjectDetailsModel\\:\\:addYearActivity\\(\\) expects string, int\\|string given\\.$#" - count: 1 - path: src/Project/ProjectStatisticService.php - - message: "#^Parameter \\#2 \\$statistic of class App\\\\Event\\\\ProjectStatisticEvent constructor expects App\\\\Model\\\\ProjectStatistic, App\\\\Model\\\\ProjectStatistic\\|null given\\.$#" count: 1 diff --git a/phpunit.xml.dist b/phpunit.xml.dist index 1bcec170..49cbd673 100644 --- a/phpunit.xml.dist +++ b/phpunit.xml.dist @@ -1,73 +1,67 @@ - - - - - - - - - - - - - - - - - - - - - - tests/ - - - - - - src/ - templates/ - - - migrations/ - assets/ - bin/ - config/ - node_modules/ - public/ - tests/ - translations/ - var/ - vendor/ - - - + bootstrap="tests/bootstrap.php" + cacheDirectory="var/cache/phpunit/"> + + + + + + + + + + + + + + + - - - + REINSTALL THE TEST DATABASE, eg. AFTER CHANGING STRUCTURE! + + - change to "true" + - composer tests + - change back to "false" + + CREATE DATABASE IF NOT EXISTS `kimai2_test`; + CREATE USER IF NOT EXISTS `kimai2_test`@127.0.0.1; + ALTER USER `kimai2_test`@127.0.0.1 IDENTIFIED BY "kimai2_test"; + GRANT execute,select,insert,update,delete,create,alter,drop,index,references ON `kimai2_test`.* TO kimai2_test@127.0.0.1; + --> + + + + + + tests/ + + + + + + src/ + templates/ + + + migrations/ + assets/ + bin/ + config/ + node_modules/ + public/ + tests/ + translations/ + var/ + vendor/ + + + + + + - - - diff --git a/src/WorkingTime/WorkingTimeService.php b/src/WorkingTime/WorkingTimeService.php index 11c3044a..e6600271 100644 --- a/src/WorkingTime/WorkingTimeService.php +++ b/src/WorkingTime/WorkingTimeService.php @@ -242,6 +242,6 @@ final class WorkingTimeService $durations[$row['day']] = (int) $row['duration']; } - return $durations; // @phpstan-ignore-line + return $durations; } } diff --git a/symfony.lock b/symfony.lock index a29bd6b1..5645c1ab 100644 --- a/symfony.lock +++ b/symfony.lock @@ -334,9 +334,6 @@ "sebastian/recursion-context": { "version": "3.0.0" }, - "sebastian/resource-operations": { - "version": "1.0.0" - }, "sebastian/type": { "version": "1.1.3" }, diff --git a/tests/API/APIControllerBaseTest.php b/tests/API/APIControllerBaseTestCase.php similarity index 97% rename from tests/API/APIControllerBaseTest.php rename to tests/API/APIControllerBaseTestCase.php index d29b83f6..8312f53e 100644 --- a/tests/API/APIControllerBaseTest.php +++ b/tests/API/APIControllerBaseTestCase.php @@ -11,7 +11,7 @@ namespace App\Tests\API; use App\DataFixtures\UserFixtures; use App\Entity\User; -use App\Tests\Controller\ControllerBaseTest; +use App\Tests\Controller\AbstractControllerBaseTestCase; use PHPUnit\Framework\Constraint\IsType; use Symfony\Component\DomCrawler\Crawler; use Symfony\Component\HttpFoundation\Response; @@ -20,7 +20,7 @@ use Symfony\Component\HttpKernel\HttpKernelBrowser; /** * Adds some useful functions for writing API integration tests. */ -abstract class APIControllerBaseTest extends ControllerBaseTest +abstract class APIControllerBaseTestCase extends AbstractControllerBaseTestCase { /** * @return array @@ -50,15 +50,15 @@ abstract class APIControllerBaseTest extends ControllerBaseTest protected function assertPagination(Response $response, int $page, int $pageSize, int $totalPages, int $totalResults): void { - $this->assertTrue($response->headers->has('X-Page'), 'Missing "X-Page" header'); - $this->assertTrue($response->headers->has('X-Total-Count'), 'Missing "X-Total-Count" header'); - $this->assertTrue($response->headers->has('X-Total-Pages'), 'Missing "X-Total-Pages" header'); - $this->assertTrue($response->headers->has('X-Per-Page'), 'Missing "X-Per-Page" header'); + self::assertTrue($response->headers->has('X-Page'), 'Missing "X-Page" header'); + self::assertTrue($response->headers->has('X-Total-Count'), 'Missing "X-Total-Count" header'); + self::assertTrue($response->headers->has('X-Total-Pages'), 'Missing "X-Total-Pages" header'); + self::assertTrue($response->headers->has('X-Per-Page'), 'Missing "X-Per-Page" header'); - $this->assertEquals($page, $response->headers->get('X-Page')); - $this->assertEquals($totalResults, $response->headers->get('X-Total-Count')); - $this->assertEquals($totalPages, $response->headers->get('X-Total-Pages')); - $this->assertEquals($pageSize, $response->headers->get('X-Per-Page')); + self::assertEquals($page, $response->headers->get('X-Page')); + self::assertEquals($totalResults, $response->headers->get('X-Total-Count')); + self::assertEquals($totalPages, $response->headers->get('X-Total-Pages')); + self::assertEquals($pageSize, $response->headers->get('X-Per-Page')); } protected function assertRequestIsSecured(HttpKernelBrowser $client, string $url, string $method = 'GET'): void @@ -242,7 +242,7 @@ abstract class APIControllerBaseTest extends ControllerBaseTest if (\count($expectedFields) > 0) { foreach ($expectedFields as $expectedField) { - $this->assertArrayHasKey($expectedField, $data, 'Expected field is missing: ' . $expectedField); + self::assertArrayHasKey($expectedField, $data, 'Expected field is missing: ' . $expectedField); } } diff --git a/tests/API/ActionsControllerTest.php b/tests/API/ActionsControllerTest.php index ac01542d..805d4ec9 100644 --- a/tests/API/ActionsControllerTest.php +++ b/tests/API/ActionsControllerTest.php @@ -18,7 +18,7 @@ use App\Tests\DataFixtures\TimesheetFixtures; /** * @group integration */ -class ActionsControllerTest extends APIControllerBaseTest +class ActionsControllerTest extends APIControllerBaseTestCase { public function testIsSecure(): void { @@ -58,7 +58,7 @@ class ActionsControllerTest extends APIControllerBaseTest $this->assertAccessIsGranted($client, \sprintf('/api/actions/timesheet/%s/%s/en', $items[0]->getId(), $view)); $result = json_decode($client->getResponse()->getContent(), true); - $this->assertIsArray($result); + self::assertIsArray($result); foreach ($result as $item) { self::assertIsArray($item); self::assertApiResponseTypeStructure('PageActionItem', $item); @@ -110,7 +110,7 @@ class ActionsControllerTest extends APIControllerBaseTest $this->assertAccessIsGranted($client, \sprintf('/api/actions/activity/%s/%s/en', $activities[0]->getId(), $view)); $result = json_decode($client->getResponse()->getContent(), true); - $this->assertIsArray($result); + self::assertIsArray($result); foreach ($result as $item) { self::assertIsArray($item); self::assertApiResponseTypeStructure('PageActionItem', $item); @@ -161,7 +161,7 @@ class ActionsControllerTest extends APIControllerBaseTest $this->assertAccessIsGranted($client, \sprintf('/api/actions/project/%s/%s/en', $projects[0]->getId(), $view)); $result = json_decode($client->getResponse()->getContent(), true); - $this->assertIsArray($result); + self::assertIsArray($result); foreach ($result as $item) { self::assertIsArray($item); self::assertApiResponseTypeStructure('PageActionItem', $item); @@ -208,7 +208,7 @@ class ActionsControllerTest extends APIControllerBaseTest $this->assertAccessIsGranted($client, \sprintf('/api/actions/customer/%s/%s/en', $customers[0]->getId(), $view)); $result = json_decode($client->getResponse()->getContent(), true); - $this->assertIsArray($result); + self::assertIsArray($result); foreach ($result as $item) { self::assertIsArray($item); self::assertApiResponseTypeStructure('PageActionItem', $item); diff --git a/tests/API/ActivityControllerTest.php b/tests/API/ActivityControllerTest.php index d8e8b330..e1b210b3 100644 --- a/tests/API/ActivityControllerTest.php +++ b/tests/API/ActivityControllerTest.php @@ -28,7 +28,7 @@ use Symfony\Component\HttpFoundation\Response; /** * @group integration */ -class ActivityControllerTest extends APIControllerBaseTest +class ActivityControllerTest extends APIControllerBaseTestCase { use RateControllerTestTrait; @@ -173,19 +173,19 @@ class ActivityControllerTest extends APIControllerBaseTest $this->assertAccessIsGranted($client, $url, 'GET', $parameters); $content = $client->getResponse()->getContent(); - $this->assertIsString($content); + self::assertIsString($content); $result = json_decode($content, true); - $this->assertIsArray($result); - $this->assertNotEmpty($result); - $this->assertEquals(\count($expected), \count($result)); + self::assertIsArray($result); + self::assertNotEmpty($result); + self::assertEquals(\count($expected), \count($result)); for ($i = 0; $i < \count($result); $i++) { $activity = $result[$i]; $hasProject = $expected[$i][0]; self::assertIsArray($activity); self::assertApiResponseTypeStructure('ActivityCollection', $activity); if ($hasProject && $projectId !== null) { - $this->assertEquals($projectId, $activity['project']); + self::assertEquals($projectId, $activity['project']); } } } @@ -193,7 +193,7 @@ class ActivityControllerTest extends APIControllerBaseTest /** * @return \Generator> */ - public function getCollectionTestData(): iterable + public static function getCollectionTestData(): iterable { yield ['/api/activities', null, [], [[false], [true, 2], [true, 2], [null], [true, 1]]]; //yield ['/api/activities', [], [[false], [false], [true, 2], [true, 1], [true, 2]]]; @@ -217,17 +217,17 @@ class ActivityControllerTest extends APIControllerBaseTest $this->assertAccessIsGranted($client, '/api/activities', 'GET', $query); $content = $client->getResponse()->getContent(); - $this->assertIsString($content); + self::assertIsString($content); $result = json_decode($content, true); - $this->assertIsArray($result); - $this->assertNotEmpty($result); - $this->assertEquals(5, \count($result)); + self::assertIsArray($result); + self::assertNotEmpty($result); + self::assertEquals(5, \count($result)); self::assertIsArray($result[0]); self::assertApiResponseTypeStructure('ActivityCollection', $result[0]); - $this->assertEquals($imports[0]->getId(), $result[4]['project']); - $this->assertEquals($imports[1]->getId(), $result[3]['project']); - $this->assertEquals($imports[1]->getId(), $result[2]['project']); + self::assertEquals($imports[0]->getId(), $result[4]['project']); + self::assertEquals($imports[1]->getId(), $result[3]['project']); + self::assertEquals($imports[1]->getId(), $result[2]['project']); } public function testGetEntityIsSecure(): void @@ -241,10 +241,10 @@ class ActivityControllerTest extends APIControllerBaseTest $this->assertAccessIsGranted($client, '/api/activities/1'); $content = $client->getResponse()->getContent(); - $this->assertIsString($content); + self::assertIsString($content); $result = json_decode($content, true); - $this->assertIsArray($result); + self::assertIsArray($result); self::assertApiResponseTypeStructure('ActivityEntity', $result); } @@ -264,15 +264,15 @@ class ActivityControllerTest extends APIControllerBaseTest 'timeBudget' => '7200', ]; $this->request($client, '/api/activities', 'POST', [], json_encode($data)); - $this->assertTrue($client->getResponse()->isSuccessful()); + self::assertTrue($client->getResponse()->isSuccessful()); $content = $client->getResponse()->getContent(); - $this->assertIsString($content); + self::assertIsString($content); $result = json_decode($content, true); - $this->assertIsArray($result); + self::assertIsArray($result); self::assertApiResponseTypeStructure('ActivityEntity', $result); - $this->assertNotEmpty($result['id']); + self::assertNotEmpty($result['id']); } public function testPostActionWithLeastFields(): void @@ -282,15 +282,15 @@ class ActivityControllerTest extends APIControllerBaseTest 'name' => 'foo', ]; $this->request($client, '/api/activities', 'POST', [], json_encode($data)); - $this->assertTrue($client->getResponse()->isSuccessful()); + self::assertTrue($client->getResponse()->isSuccessful()); $content = $client->getResponse()->getContent(); - $this->assertIsString($content); + self::assertIsString($content); $result = json_decode($content, true); - $this->assertIsArray($result); + self::assertIsArray($result); self::assertApiResponseTypeStructure('ActivityEntity', $result); - $this->assertNotEmpty($result['id']); + self::assertNotEmpty($result['id']); } public function testPostActionWithInvalidUser(): void @@ -331,15 +331,15 @@ class ActivityControllerTest extends APIControllerBaseTest 'timeBudget' => '7200', ]; $this->request($client, '/api/activities/1', 'PATCH', [], json_encode($data)); - $this->assertTrue($client->getResponse()->isSuccessful()); + self::assertTrue($client->getResponse()->isSuccessful()); $content = $client->getResponse()->getContent(); - $this->assertIsString($content); + self::assertIsString($content); $result = json_decode($content, true); - $this->assertIsArray($result); + self::assertIsArray($result); self::assertApiResponseTypeStructure('ActivityEntity', $result); - $this->assertNotEmpty($result['id']); + self::assertNotEmpty($result['id']); } public function testPatchActionWithNonGlobalActivity(): void @@ -356,16 +356,16 @@ class ActivityControllerTest extends APIControllerBaseTest 'timeBudget' => '7200', ]; $this->request($client, '/api/activities/' . $imports[2]->getId(), 'PATCH', [], json_encode($data)); - $this->assertTrue($client->getResponse()->isSuccessful()); + self::assertTrue($client->getResponse()->isSuccessful()); $content = $client->getResponse()->getContent(); - $this->assertIsString($content); + self::assertIsString($content); $result = json_decode($content, true); - $this->assertIsArray($result); + self::assertIsArray($result); self::assertApiResponseTypeStructure('ActivityEntity', $result); - $this->assertNotEmpty($result['id']); - $this->assertEquals($imports[1]->getId(), $result['project']); + self::assertNotEmpty($result['id']); + self::assertEquals($imports[1]->getId(), $result['project']); } public function testPatchActionWithInvalidUser(): void @@ -398,7 +398,7 @@ class ActivityControllerTest extends APIControllerBaseTest $this->request($client, '/api/activities/1', 'PATCH', [], json_encode($data)); $response = $client->getResponse(); - $this->assertEquals(400, $response->getStatusCode()); + self::assertEquals(400, $response->getStatusCode()); $this->assertApiCallValidationError($response, ['name']); } @@ -444,12 +444,12 @@ class ActivityControllerTest extends APIControllerBaseTest ]; $this->request($client, '/api/activities/1/meta', 'PATCH', [], json_encode($data)); - $this->assertTrue($client->getResponse()->isSuccessful()); + self::assertTrue($client->getResponse()->isSuccessful()); $em = $this->getEntityManager(); /** @var Activity $activity */ $activity = $em->getRepository(Activity::class)->find(1); - $this->assertEquals('another,testing,bar', $activity->getMetaField('metatestmock')->getValue()); + self::assertEquals('another,testing,bar', $activity->getMetaField('metatestmock')->getValue()); } // ------------------------------- [DELETE] ------------------------------- @@ -499,9 +499,9 @@ class ActivityControllerTest extends APIControllerBaseTest $id = $result['id']; $this->request($client, '/api/activities/' . $id, Request::METHOD_DELETE); - $this->assertTrue($client->getResponse()->isSuccessful()); + self::assertTrue($client->getResponse()->isSuccessful()); self::assertEquals(Response::HTTP_NO_CONTENT, $client->getResponse()->getStatusCode()); - $this->assertEmpty($client->getResponse()->getContent()); + self::assertEmpty($client->getResponse()->getContent()); $this->request($client, $getUrl); $this->assertApiException($client->getResponse(), [ diff --git a/tests/API/ApiDocControllerTest.php b/tests/API/ApiDocControllerTest.php index c236e3c0..3afd7821 100644 --- a/tests/API/ApiDocControllerTest.php +++ b/tests/API/ApiDocControllerTest.php @@ -10,12 +10,12 @@ namespace App\Tests\API; use App\Entity\User; -use App\Tests\Controller\ControllerBaseTest; +use App\Tests\Controller\AbstractControllerBaseTestCase; /** * @group integration */ -class ApiDocControllerTest extends ControllerBaseTest +class ApiDocControllerTest extends AbstractControllerBaseTestCase { public function testIsSecure(): void { @@ -26,7 +26,7 @@ class ApiDocControllerTest extends ControllerBaseTest { $client = $this->getClientForAuthenticatedUser(User::ROLE_USER); $this->assertAccessIsGranted($client, '/api/doc'); - $this->assertStringContainsString('Kimai', $client->getResponse()->getContent()); + self::assertStringContainsString('<title>Kimai', $client->getResponse()->getContent()); $result = $client->getCrawler()->filter('script#swagger-data'); $swaggerJson = json_decode($result->text(), true); $tags = []; @@ -104,25 +104,25 @@ class ApiDocControllerTest extends ControllerBaseTest '/api/users/api-token/{id}', ]; - $this->assertArrayHasKey('openapi', $json); - $this->assertEquals('3.0.0', $json['openapi']); - $this->assertArrayHasKey('info', $json); - $this->assertStringStartsWith('Kimai', $json['info']['title']); - $this->assertEquals('1.0', $json['info']['version']); + self::assertArrayHasKey('openapi', $json); + self::assertEquals('3.0.0', $json['openapi']); + self::assertArrayHasKey('info', $json); + self::assertStringStartsWith('Kimai', $json['info']['title']); + self::assertEquals('1.0', $json['info']['version']); - $this->assertArrayHasKey('paths', $json); - $this->assertEquals($paths, array_keys($json['paths'])); + self::assertArrayHasKey('paths', $json); + self::assertEquals($paths, array_keys($json['paths'])); - $this->assertArrayHasKey('security', $json); - $this->assertEquals(['bearer' => []], $json['security'][0]); + self::assertArrayHasKey('security', $json); + self::assertEquals(['bearer' => []], $json['security'][0]); - $this->assertArrayHasKey('components', $json); - $this->assertArrayHasKey('schemas', $json['components']); - $this->assertArrayHasKey('securitySchemes', $json['components']); + self::assertArrayHasKey('components', $json); + self::assertArrayHasKey('schemas', $json['components']); + self::assertArrayHasKey('securitySchemes', $json['components']); $result = json_decode($client->getResponse()->getContent(), true); - $this->assertIsArray($result); - $this->assertNotEmpty($result); + self::assertIsArray($result); + self::assertNotEmpty($result); } protected function createUrl(string $url): string diff --git a/tests/API/Authentication/AccessTokenHandlerTest.php b/tests/API/Authentication/AccessTokenHandlerTest.php index 7711d422..c065bbf5 100644 --- a/tests/API/Authentication/AccessTokenHandlerTest.php +++ b/tests/API/Authentication/AccessTokenHandlerTest.php @@ -55,11 +55,11 @@ class AccessTokenHandlerTest extends TestCase $user = new User(); $user->setUserIdentifier('foo-bar'); $accessToken = new AccessToken($user, 'Test'); - $this->assertNull($accessToken->getLastUsage()); + self::assertNull($accessToken->getLastUsage()); $sut = $this->getSut($accessToken); $badge = $sut->getUserBadgeFrom('foo'); - $this->assertNotNull($accessToken->getLastUsage()); - $this->assertSame('foo-bar', $badge->getUserIdentifier()); + self::assertNotNull($accessToken->getLastUsage()); + self::assertSame('foo-bar', $badge->getUserIdentifier()); } } diff --git a/tests/API/AuthenticationTest.php b/tests/API/AuthenticationTest.php index 381added..8cb2150f 100644 --- a/tests/API/AuthenticationTest.php +++ b/tests/API/AuthenticationTest.php @@ -19,7 +19,7 @@ use Symfony\Component\HttpFoundation\Response; * @group legacy * @group integration */ -class AuthenticationTest extends APIControllerBaseTest +class AuthenticationTest extends APIControllerBaseTestCase { public function testPinIsSecure(): void { @@ -31,11 +31,11 @@ class AuthenticationTest extends APIControllerBaseTest $client = $this->getClientForAuthenticatedUser(User::ROLE_USER); $this->assertAccessIsGranted($client, '/api/ping'); $response = $client->getResponse()->getContent(); - $this->assertIsString($response); + self::assertIsString($response); $result = json_decode($response, true); - $this->assertIsArray($result); - $this->assertEquals(['message' => 'pong'], $result); + self::assertIsArray($result); + self::assertEquals(['message' => 'pong'], $result); } public function testPingWithAuthTokenAndUsername(): void @@ -44,11 +44,11 @@ class AuthenticationTest extends APIControllerBaseTest $this->assertAccessIsGranted($client, '/api/ping'); $response = $client->getResponse()->getContent(); - $this->assertIsString($response); + self::assertIsString($response); $result = json_decode($response, true); - $this->assertIsArray($result); - $this->assertEquals(['message' => 'pong'], $result); + self::assertIsArray($result); + self::assertEquals(['message' => 'pong'], $result); } public function testPingWithInvalidAuthTokenAndUsername(): void @@ -64,15 +64,15 @@ class AuthenticationTest extends APIControllerBaseTest 'message' => 'Invalid credentials', ]; - $this->assertIsString($response->getContent()); + self::assertIsString($response->getContent()); - $this->assertEquals( + self::assertEquals( $data, json_decode($response->getContent(), true), \sprintf('The secure URL %s is not protected.', $url) ); - $this->assertEquals( + self::assertEquals( Response::HTTP_FORBIDDEN, $response->getStatusCode(), \sprintf('The secure URL %s has the wrong status code %s.', $url, $response->getStatusCode()) diff --git a/tests/API/ConfigurationControllerTest.php b/tests/API/ConfigurationControllerTest.php index f852a654..7ecb9d45 100644 --- a/tests/API/ConfigurationControllerTest.php +++ b/tests/API/ConfigurationControllerTest.php @@ -14,7 +14,7 @@ use App\Entity\User; /** * @group integration */ -class ConfigurationControllerTest extends APIControllerBaseTest +class ConfigurationControllerTest extends APIControllerBaseTestCase { public function testIsTimesheetSecure(): void { @@ -26,18 +26,18 @@ class ConfigurationControllerTest extends APIControllerBaseTest $client = $this->getClientForAuthenticatedUser(User::ROLE_USER); $this->assertAccessIsGranted($client, '/api/config/timesheet', 'GET'); $content = $client->getResponse()->getContent(); - $this->assertIsString($content); + self::assertIsString($content); $result = json_decode($content, true); - $this->assertIsArray($result); - $this->assertNotEmpty($result); + self::assertIsArray($result); + self::assertNotEmpty($result); $expectedKeys = ['activeEntriesHardLimit', 'defaultBeginTime', 'isAllowFutureTimes', 'isAllowOverlapping', 'trackingMode']; - $this->assertCount(\count($expectedKeys), $result); + self::assertCount(\count($expectedKeys), $result); $actual = array_keys($result); sort($actual); sort($expectedKeys); - $this->assertEquals($expectedKeys, $actual, 'Config structure does not match'); + self::assertEquals($expectedKeys, $actual, 'Config structure does not match'); } public function testIsColorsSecure(): void @@ -50,11 +50,11 @@ class ConfigurationControllerTest extends APIControllerBaseTest $client = $this->getClientForAuthenticatedUser(User::ROLE_USER); $this->assertAccessIsGranted($client, '/api/config/colors', 'GET'); $content = $client->getResponse()->getContent(); - $this->assertIsString($content); + self::assertIsString($content); $actual = json_decode($content, true); - $this->assertIsArray($actual); - $this->assertNotEmpty($actual); + self::assertIsArray($actual); + self::assertNotEmpty($actual); $expected = [ 'Silver' => '#c0c0c0', 'Gray' => '#808080', @@ -84,8 +84,8 @@ class ConfigurationControllerTest extends APIControllerBaseTest 'Rose' => '#ffe4e1', 'Lavender' => '#E6E6FA', ]; - $this->assertCount(\count($expected), $actual); + self::assertCount(\count($expected), $actual); - $this->assertEquals($expected, $actual, 'Color structure does not match'); + self::assertEquals($expected, $actual, 'Color structure does not match'); } } diff --git a/tests/API/CustomerControllerTest.php b/tests/API/CustomerControllerTest.php index 01a56978..2702934e 100644 --- a/tests/API/CustomerControllerTest.php +++ b/tests/API/CustomerControllerTest.php @@ -28,7 +28,7 @@ use Symfony\Component\HttpFoundation\Response; /** * @group integration */ -class CustomerControllerTest extends APIControllerBaseTest +class CustomerControllerTest extends APIControllerBaseTestCase { use RateControllerTestTrait; @@ -140,12 +140,12 @@ class CustomerControllerTest extends APIControllerBaseTest $this->assertAccessIsGranted($client, '/api/customers'); $content = $client->getResponse()->getContent(); - $this->assertIsString($content); + self::assertIsString($content); $result = json_decode($content, true); - $this->assertIsArray($result); - $this->assertNotEmpty($result); - $this->assertEquals(1, \count($result)); + self::assertIsArray($result); + self::assertNotEmpty($result); + self::assertEquals(1, \count($result)); self::assertIsArray($result[0]); self::assertApiResponseTypeStructure('CustomerCollection', $result[0]); } @@ -157,12 +157,12 @@ class CustomerControllerTest extends APIControllerBaseTest $this->assertAccessIsGranted($client, '/api/customers', 'GET', $query); $content = $client->getResponse()->getContent(); - $this->assertIsString($content); + self::assertIsString($content); $result = json_decode($content, true); - $this->assertIsArray($result); - $this->assertNotEmpty($result); - $this->assertEquals(1, \count($result)); + self::assertIsArray($result); + self::assertNotEmpty($result); + self::assertEquals(1, \count($result)); self::assertIsArray($result[0]); self::assertApiResponseTypeStructure('CustomerCollection', $result[0]); } @@ -178,10 +178,10 @@ class CustomerControllerTest extends APIControllerBaseTest $this->assertAccessIsGranted($client, '/api/customers/1'); $content = $client->getResponse()->getContent(); - $this->assertIsString($content); + self::assertIsString($content); $result = json_decode($content, true); - $this->assertIsArray($result); + self::assertIsArray($result); self::assertApiResponseTypeStructure('CustomerEntity', $result); } @@ -225,10 +225,10 @@ class CustomerControllerTest extends APIControllerBaseTest $this->assertAccessIsGranted($client, '/api/customers/1'); $content = $client->getResponse()->getContent(); - $this->assertIsString($content); + self::assertIsString($content); $result = json_decode($content, true); - $this->assertIsArray($result); + self::assertIsArray($result); self::assertApiResponseTypeStructure('CustomerEntity', $result); } @@ -250,15 +250,15 @@ class CustomerControllerTest extends APIControllerBaseTest 'timeBudget' => '7200', ]; $this->request($client, '/api/customers', 'POST', [], json_encode($data)); - $this->assertTrue($client->getResponse()->isSuccessful()); + self::assertTrue($client->getResponse()->isSuccessful()); $content = $client->getResponse()->getContent(); - $this->assertIsString($content); + self::assertIsString($content); $result = json_decode($content, true); - $this->assertIsArray($result); + self::assertIsArray($result); self::assertApiResponseTypeStructure('CustomerEntity', $result); - $this->assertNotEmpty($result['id']); + self::assertNotEmpty($result['id']); } public function testPostActionWithLeastFields(): void @@ -271,15 +271,15 @@ class CustomerControllerTest extends APIControllerBaseTest 'timezone' => 'Europe/Berlin', ]; $this->request($client, '/api/customers', 'POST', [], json_encode($data)); - $this->assertTrue($client->getResponse()->isSuccessful()); + self::assertTrue($client->getResponse()->isSuccessful()); $content = $client->getResponse()->getContent(); - $this->assertIsString($content); + self::assertIsString($content); $result = json_decode($content, true); - $this->assertIsArray($result); + self::assertIsArray($result); self::assertApiResponseTypeStructure('CustomerEntity', $result); - $this->assertNotEmpty($result['id']); + self::assertNotEmpty($result['id']); } public function testPostActionWithInvalidUser(): void @@ -327,15 +327,15 @@ class CustomerControllerTest extends APIControllerBaseTest 'timeBudget' => '7200', ]; $this->request($client, '/api/customers/1', 'PATCH', [], json_encode($data)); - $this->assertTrue($client->getResponse()->isSuccessful()); + self::assertTrue($client->getResponse()->isSuccessful()); $content = $client->getResponse()->getContent(); - $this->assertIsString($content); + self::assertIsString($content); $result = json_decode($content, true); - $this->assertIsArray($result); + self::assertIsArray($result); self::assertApiResponseTypeStructure('CustomerEntity', $result); - $this->assertNotEmpty($result['id']); + self::assertNotEmpty($result['id']); } public function testPatchActionWithInvalidUser(): void @@ -373,7 +373,7 @@ class CustomerControllerTest extends APIControllerBaseTest $this->request($client, '/api/customers/1', 'PATCH', [], json_encode($data)); $response = $client->getResponse(); - $this->assertEquals(400, $response->getStatusCode()); + self::assertEquals(400, $response->getStatusCode()); $this->assertApiCallValidationError($response, ['currency']); } @@ -426,12 +426,12 @@ class CustomerControllerTest extends APIControllerBaseTest ]; $this->request($client, '/api/customers/1/meta', 'PATCH', [], json_encode($data)); - $this->assertTrue($client->getResponse()->isSuccessful()); + self::assertTrue($client->getResponse()->isSuccessful()); $em = $this->getEntityManager(); /** @var Customer $customer */ $customer = $em->getRepository(Customer::class)->find(1); - $this->assertEquals('another,testing,bar', $customer->getMetaField('metatestmock')->getValue()); + self::assertEquals('another,testing,bar', $customer->getMetaField('metatestmock')->getValue()); } // ------------------------------- [DELETE] ------------------------------- @@ -481,9 +481,9 @@ class CustomerControllerTest extends APIControllerBaseTest $id = $result['id']; $this->request($client, '/api/customers/' . $id, Request::METHOD_DELETE); - $this->assertTrue($client->getResponse()->isSuccessful()); + self::assertTrue($client->getResponse()->isSuccessful()); self::assertEquals(Response::HTTP_NO_CONTENT, $client->getResponse()->getStatusCode()); - $this->assertEmpty($client->getResponse()->getContent()); + self::assertEmpty($client->getResponse()->getContent()); $this->request($client, $getUrl); $this->assertApiException($client->getResponse(), [ diff --git a/tests/API/InvoiceControllerTest.php b/tests/API/InvoiceControllerTest.php index a31ed8bd..d563af0d 100644 --- a/tests/API/InvoiceControllerTest.php +++ b/tests/API/InvoiceControllerTest.php @@ -16,7 +16,7 @@ use App\Tests\DataFixtures\InvoiceFixtures; /** * @group integration */ -class InvoiceControllerTest extends APIControllerBaseTest +class InvoiceControllerTest extends APIControllerBaseTestCase { /** * @return Invoice[] @@ -45,12 +45,12 @@ class InvoiceControllerTest extends APIControllerBaseTest $this->assertAccessIsGranted($client, '/api/invoices'); $content = $client->getResponse()->getContent(); - $this->assertIsString($content); + self::assertIsString($content); $result = json_decode($content, true); - $this->assertIsArray($result); - $this->assertNotEmpty($result); - $this->assertEquals(10, \count($result)); + self::assertIsArray($result); + self::assertNotEmpty($result); + self::assertEquals(10, \count($result)); self::assertIsArray($result[0]); self::assertApiResponseTypeStructure('InvoiceCollection', $result[0]); } @@ -67,12 +67,12 @@ class InvoiceControllerTest extends APIControllerBaseTest $this->assertAccessIsGranted($client, '/api/invoices', 'GET', $query); $content = $client->getResponse()->getContent(); - $this->assertIsString($content); + self::assertIsString($content); $result = json_decode($content, true); - $this->assertIsArray($result); - $this->assertNotEmpty($result); - $this->assertEquals(7, \count($result)); + self::assertIsArray($result); + self::assertNotEmpty($result); + self::assertEquals(7, \count($result)); self::assertIsArray($result[0]); self::assertApiResponseTypeStructure('InvoiceCollection', $result[0]); } @@ -86,12 +86,12 @@ class InvoiceControllerTest extends APIControllerBaseTest $this->assertAccessIsGranted($client, '/api/invoices', 'GET', $query); $content = $client->getResponse()->getContent(); - $this->assertIsString($content); + self::assertIsString($content); $result = json_decode($content, true); - $this->assertIsArray($result); - $this->assertNotEmpty($result); - $this->assertEquals(4, \count($result)); + self::assertIsArray($result); + self::assertNotEmpty($result); + self::assertEquals(4, \count($result)); $this->assertPagination($client->getResponse(), 2, 4, 5, 20); self::assertIsArray($result[0]); self::assertApiResponseTypeStructure('InvoiceCollection', $result[0]); @@ -113,10 +113,10 @@ class InvoiceControllerTest extends APIControllerBaseTest $this->assertAccessIsGranted($client, '/api/invoices/' . $invoices[0]->getId()); $content = $client->getResponse()->getContent(); - $this->assertIsString($content); + self::assertIsString($content); $result = json_decode($content, true); - $this->assertIsArray($result); + self::assertIsArray($result); self::assertApiResponseTypeStructure('Invoice', $result); } diff --git a/tests/API/ProjectControllerTest.php b/tests/API/ProjectControllerTest.php index b51814dd..94ae2223 100644 --- a/tests/API/ProjectControllerTest.php +++ b/tests/API/ProjectControllerTest.php @@ -28,7 +28,7 @@ use Symfony\Component\HttpFoundation\Response; /** * @group integration */ -class ProjectControllerTest extends APIControllerBaseTest +class ProjectControllerTest extends APIControllerBaseTestCase { use RateControllerTestTrait; @@ -101,12 +101,12 @@ class ProjectControllerTest extends APIControllerBaseTest $this->assertAccessIsGranted($client, '/api/projects'); $content = $client->getResponse()->getContent(); - $this->assertIsString($content); + self::assertIsString($content); $result = json_decode($content, true); - $this->assertIsArray($result); - $this->assertNotEmpty($result); - $this->assertEquals(1, \count($result)); + self::assertIsArray($result); + self::assertNotEmpty($result); + self::assertEquals(1, \count($result)); self::assertIsArray($result[0]); self::assertApiResponseTypeStructure('ProjectCollection', $result[0]); } @@ -224,18 +224,18 @@ class ProjectControllerTest extends APIControllerBaseTest $this->assertAccessIsGranted($client, $url, 'GET', $parameters); $content = $client->getResponse()->getContent(); - $this->assertIsString($content); + self::assertIsString($content); $result = json_decode($content, true); - $this->assertIsArray($result); - $this->assertEquals(\count($expected), \count($result), 'Found wrong amount of projects'); + self::assertIsArray($result); + self::assertEquals(\count($expected), \count($result), 'Found wrong amount of projects'); for ($i = 0; $i < \count($expected); $i++) { $project = $result[$i]; self::assertIsArray($project); self::assertApiResponseTypeStructure('ProjectCollection', $project); if ($customerId !== null) { - $this->assertEquals($customerId, $project['customer']); + self::assertEquals($customerId, $project['customer']); } } } @@ -243,7 +243,7 @@ class ProjectControllerTest extends APIControllerBaseTest /** * @return \Generator<array<mixed>> */ - public function getCollectionTestData(): iterable + public static function getCollectionTestData(): iterable { // if you wonder why: case-sensitive ordering feels strange ... "Title" > "fifth” yield ['/api/projects', null, [], [[true, 1], [false, 1], [false, 3]]]; @@ -273,10 +273,10 @@ class ProjectControllerTest extends APIControllerBaseTest $this->assertAccessIsGranted($client, '/api/projects/1'); $content = $client->getResponse()->getContent(); - $this->assertIsString($content); + self::assertIsString($content); $result = json_decode($content, true); - $this->assertIsArray($result); + self::assertIsArray($result); self::assertApiResponseTypeStructure('ProjectEntity', $result); } @@ -308,10 +308,10 @@ class ProjectControllerTest extends APIControllerBaseTest $this->assertAccessIsGranted($client, '/api/projects/' . $project->getId()); $content = $client->getResponse()->getContent(); - $this->assertIsString($content); + self::assertIsString($content); $result = json_decode($content, true); - $this->assertIsArray($result); + self::assertIsArray($result); self::assertApiResponseTypeStructure('ProjectEntity', $result); $expected = [ @@ -357,15 +357,15 @@ class ProjectControllerTest extends APIControllerBaseTest 'orderNumber' => '1234567890/WXYZ/SUBPROJECT/1234/CONTRACT/EMPLOYEE1', ]; $this->request($client, '/api/projects', 'POST', [], json_encode($data)); - $this->assertTrue($client->getResponse()->isSuccessful()); + self::assertTrue($client->getResponse()->isSuccessful()); $content = $client->getResponse()->getContent(); - $this->assertIsString($content); + self::assertIsString($content); $result = json_decode($content, true); - $this->assertIsArray($result); + self::assertIsArray($result); self::assertApiResponseTypeStructure('ProjectEntity', $result); - $this->assertNotEmpty($result['id']); + self::assertNotEmpty($result['id']); self::assertEquals('2018-04-17', $result['orderDate']); self::assertEquals('2019-02-01', $result['start']); self::assertEquals('2020-02-08', $result['end']); @@ -386,15 +386,15 @@ class ProjectControllerTest extends APIControllerBaseTest 'visible' => '', ]; $this->request($client, '/api/projects', 'POST', [], json_encode($data)); - $this->assertTrue($client->getResponse()->isSuccessful()); + self::assertTrue($client->getResponse()->isSuccessful()); $content = $client->getResponse()->getContent(); - $this->assertIsString($content); + self::assertIsString($content); $result = json_decode($content, true); - $this->assertIsArray($result); + self::assertIsArray($result); self::assertApiResponseTypeStructure('ProjectEntity', $result); - $this->assertNotEmpty($result['id']); + self::assertNotEmpty($result['id']); self::assertEquals('foo', $result['name']); self::assertTrue($result['globalActivities']); self::assertTrue($result['billable']); @@ -412,15 +412,15 @@ class ProjectControllerTest extends APIControllerBaseTest 'visible' => false, ]; $this->request($client, '/api/projects', 'POST', [], json_encode($data)); - $this->assertTrue($client->getResponse()->isSuccessful()); + self::assertTrue($client->getResponse()->isSuccessful()); $content = $client->getResponse()->getContent(); - $this->assertIsString($content); + self::assertIsString($content); $result = json_decode($content, true); - $this->assertIsArray($result); + self::assertIsArray($result); self::assertApiResponseTypeStructure('ProjectEntity', $result); - $this->assertNotEmpty($result['id']); + self::assertNotEmpty($result['id']); self::assertEquals('foo', $result['name']); self::assertFalse($result['globalActivities']); self::assertFalse($result['billable']); @@ -438,15 +438,15 @@ class ProjectControllerTest extends APIControllerBaseTest 'visible' => true, ]; $this->request($client, '/api/projects', 'POST', [], json_encode($data)); - $this->assertTrue($client->getResponse()->isSuccessful()); + self::assertTrue($client->getResponse()->isSuccessful()); $content = $client->getResponse()->getContent(); - $this->assertIsString($content); + self::assertIsString($content); $result = json_decode($content, true); - $this->assertIsArray($result); + self::assertIsArray($result); self::assertApiResponseTypeStructure('ProjectEntity', $result); - $this->assertNotEmpty($result['id']); + self::assertNotEmpty($result['id']); self::assertEquals('foo', $result['name']); self::assertTrue($result['globalActivities']); self::assertTrue($result['billable']); @@ -461,15 +461,15 @@ class ProjectControllerTest extends APIControllerBaseTest 'customer' => 1 ]; $this->request($client, '/api/projects', 'POST', [], json_encode($data)); - $this->assertTrue($client->getResponse()->isSuccessful()); + self::assertTrue($client->getResponse()->isSuccessful()); $content = $client->getResponse()->getContent(); - $this->assertIsString($content); + self::assertIsString($content); $result = json_decode($content, true); - $this->assertIsArray($result); + self::assertIsArray($result); self::assertApiResponseTypeStructure('ProjectEntity', $result); - $this->assertNotEmpty($result['id']); + self::assertNotEmpty($result['id']); self::assertEquals('foo', $result['name']); self::assertFalse($result['globalActivities']); self::assertFalse($result['billable']); @@ -515,15 +515,15 @@ class ProjectControllerTest extends APIControllerBaseTest 'timeBudget' => '7200', ]; $this->request($client, '/api/projects/1', 'PATCH', [], json_encode($data)); - $this->assertTrue($client->getResponse()->isSuccessful()); + self::assertTrue($client->getResponse()->isSuccessful()); $content = $client->getResponse()->getContent(); - $this->assertIsString($content); + self::assertIsString($content); $result = json_decode($content, true); - $this->assertIsArray($result); + self::assertIsArray($result); self::assertApiResponseTypeStructure('ProjectEntity', $result); - $this->assertNotEmpty($result['id']); + self::assertNotEmpty($result['id']); } public function testPatchActionWithInvalidUser(): void @@ -557,7 +557,7 @@ class ProjectControllerTest extends APIControllerBaseTest $this->request($client, '/api/projects/1', 'PATCH', [], json_encode($data)); $response = $client->getResponse(); - $this->assertEquals(400, $response->getStatusCode()); + self::assertEquals(400, $response->getStatusCode()); $this->assertApiCallValidationError($response, ['customer']); } @@ -603,12 +603,12 @@ class ProjectControllerTest extends APIControllerBaseTest ]; $this->request($client, '/api/projects/1/meta', 'PATCH', [], json_encode($data)); - $this->assertTrue($client->getResponse()->isSuccessful()); + self::assertTrue($client->getResponse()->isSuccessful()); $em = $this->getEntityManager(); /** @var Project $project */ $project = $em->getRepository(Project::class)->find(1); - $this->assertEquals('another,testing,bar', $project->getMetaField('metatestmock')->getValue()); + self::assertEquals('another,testing,bar', $project->getMetaField('metatestmock')->getValue()); } // ------------------------------- [DELETE] ------------------------------- @@ -658,9 +658,9 @@ class ProjectControllerTest extends APIControllerBaseTest $id = $result['id']; $this->request($client, '/api/projects/' . $id, Request::METHOD_DELETE); - $this->assertTrue($client->getResponse()->isSuccessful()); + self::assertTrue($client->getResponse()->isSuccessful()); self::assertEquals(Response::HTTP_NO_CONTENT, $client->getResponse()->getStatusCode()); - $this->assertEmpty($client->getResponse()->getContent()); + self::assertEmpty($client->getResponse()->getContent()); $this->request($client, $getUrl); $this->assertApiException($client->getResponse(), [ diff --git a/tests/API/RateControllerTestTrait.php b/tests/API/RateControllerTestTrait.php index 90144342..7c340942 100644 --- a/tests/API/RateControllerTestTrait.php +++ b/tests/API/RateControllerTestTrait.php @@ -53,7 +53,7 @@ trait RateControllerTestTrait $this->request($client, $this->getRateUrl(), 'POST', [], json_encode($data)); $response = $client->getResponse(); - $this->assertEquals(400, $response->getStatusCode()); + self::assertEquals(400, $response->getStatusCode()); $this->assertApiCallValidationError($response, ['user']); } @@ -81,18 +81,18 @@ trait RateControllerTestTrait 'is_fixed' => false ]; $this->request($client, $this->getRateUrl(), 'POST', [], json_encode($data)); - $this->assertTrue($client->getResponse()->isSuccessful()); + self::assertTrue($client->getResponse()->isSuccessful()); $content = $client->getResponse()->getContent(); - $this->assertIsString($content); + self::assertIsString($content); $result = json_decode($content, true); - $this->assertIsArray($result); + self::assertIsArray($result); $this->assertRateStructure($result, null); - $this->assertNotEmpty($result['id']); - $this->assertEquals(12.34, $result['rate']); - $this->assertEquals(6.66, $result['internalRate']); - $this->assertFalse($result['isFixed']); + self::assertNotEmpty($result['id']); + self::assertEquals(12.34, $result['rate']); + self::assertEquals(6.66, $result['internalRate']); + self::assertFalse($result['isFixed']); } public function testAddFixedRateAction(): void @@ -105,32 +105,32 @@ trait RateControllerTestTrait 'is_fixed' => true ]; $this->request($client, $this->getRateUrl(), 'POST', [], json_encode($data)); - $this->assertTrue($client->getResponse()->isSuccessful()); + self::assertTrue($client->getResponse()->isSuccessful()); $content = $client->getResponse()->getContent(); - $this->assertIsString($content); + self::assertIsString($content); $result = json_decode($content, true); - $this->assertIsArray($result); + self::assertIsArray($result); $this->assertRateStructure($result, 1); - $this->assertNotEmpty($result['id']); - $this->assertEquals(12.34, $result['rate']); - $this->assertEquals(6.66, $result['internalRate']); - $this->assertTrue($result['isFixed']); + self::assertNotEmpty($result['id']); + self::assertEquals(12.34, $result['rate']); + self::assertEquals(6.66, $result['internalRate']); + self::assertTrue($result['isFixed']); } public function testGetRatesEmptyResult(): void { $client = $this->getClientForAuthenticatedUser(User::ROLE_ADMIN); $this->request($client, $this->getRateUrl(1)); - $this->assertTrue($client->getResponse()->isSuccessful()); + self::assertTrue($client->getResponse()->isSuccessful()); $content = $client->getResponse()->getContent(); - $this->assertIsString($content); + self::assertIsString($content); $result = json_decode($content, true); - $this->assertIsArray($result); - $this->assertEmpty($result); + self::assertIsArray($result); + self::assertEmpty($result); } public function testGetRates(): void @@ -139,22 +139,22 @@ trait RateControllerTestTrait $expectedRates = $this->importTestRates(1); $this->request($client, $this->getRateUrl(1)); - $this->assertTrue($client->getResponse()->isSuccessful()); + self::assertTrue($client->getResponse()->isSuccessful()); $content = $client->getResponse()->getContent(); - $this->assertIsString($content); + self::assertIsString($content); $result = json_decode($content, true); - $this->assertIsArray($result); - $this->assertNotEmpty($result); - $this->assertEquals(\count($expectedRates), \count($result)); + self::assertIsArray($result); + self::assertNotEmpty($result); + self::assertEquals(\count($expectedRates), \count($result)); foreach ($result as $rate) { - $this->assertIsArray($rate); + self::assertIsArray($rate); if ($rate['user'] === null) { $this->assertRateStructure($rate); } else { - $this->assertIsArray($rate['user']); + self::assertIsArray($rate['user']); $this->assertRateStructure($rate, $rate['user']['id']); } } @@ -176,19 +176,19 @@ trait RateControllerTestTrait $expectedRates = $this->importTestRates(1); $this->request($client, $this->getRateUrlByRate($expectedRates[0], false), 'DELETE'); - $this->assertTrue($client->getResponse()->isSuccessful()); - $this->assertEmpty($client->getResponse()->getContent()); + self::assertTrue($client->getResponse()->isSuccessful()); + self::assertEmpty($client->getResponse()->getContent()); // fetch rates to validate that one was removed $this->request($client, $this->getRateUrlByRate($expectedRates[0], true)); - $this->assertTrue($client->getResponse()->isSuccessful()); + self::assertTrue($client->getResponse()->isSuccessful()); $content = $client->getResponse()->getContent(); - $this->assertIsString($content); + self::assertIsString($content); $result = json_decode($content, true); - $this->assertIsArray($result); - $this->assertEquals(\count($expectedRates) - 1, \count($result)); + self::assertIsArray($result); + self::assertEquals(\count($expectedRates) - 1, \count($result)); } public function testDeleteRateEntityNotFound(): void @@ -234,7 +234,7 @@ trait RateControllerTestTrait sort($actual); sort($expectedKeys); - $this->assertEquals($expectedKeys, $actual, 'Rate structure does not match'); + self::assertEquals($expectedKeys, $actual, 'Rate structure does not match'); if (null !== $user) { self::assertIsArray($result['user'], 'Rate user is not an array'); diff --git a/tests/API/StatusControllerTest.php b/tests/API/StatusControllerTest.php index 7c398168..92c87b72 100644 --- a/tests/API/StatusControllerTest.php +++ b/tests/API/StatusControllerTest.php @@ -15,7 +15,7 @@ use App\Entity\User; /** * @group integration */ -class StatusControllerTest extends APIControllerBaseTest +class StatusControllerTest extends APIControllerBaseTestCase { public function testIsSecurePing(): void { @@ -38,8 +38,8 @@ class StatusControllerTest extends APIControllerBaseTest $this->assertAccessIsGranted($client, '/api/ping'); $result = json_decode($client->getResponse()->getContent(), true); - $this->assertIsArray($result); - $this->assertEquals(['message' => 'pong'], $result); + self::assertIsArray($result); + self::assertEquals(['message' => 'pong'], $result); } public function testVersion(): void @@ -48,15 +48,15 @@ class StatusControllerTest extends APIControllerBaseTest $this->assertAccessIsGranted($client, '/api/version'); $result = json_decode($client->getResponse()->getContent(), true); - $this->assertIsArray($result); + self::assertIsArray($result); - $this->assertArrayHasKey('version', $result); - $this->assertArrayHasKey('versionId', $result); - $this->assertArrayHasKey('copyright', $result); + self::assertArrayHasKey('version', $result); + self::assertArrayHasKey('versionId', $result); + self::assertArrayHasKey('copyright', $result); - $this->assertSame(Constants::VERSION, $result['version']); - $this->assertSame(Constants::VERSION_ID, $result['versionId']); - $this->assertEquals( + self::assertSame(Constants::VERSION, $result['version']); + self::assertSame(Constants::VERSION_ID, $result['versionId']); + self::assertEquals( 'Kimai ' . Constants::VERSION . ' by Kevin Papst.', $result['copyright'] ); @@ -68,7 +68,7 @@ class StatusControllerTest extends APIControllerBaseTest $this->assertAccessIsGranted($client, '/api/plugins'); $result = json_decode($client->getResponse()->getContent(), true); - $this->assertIsArray($result); + self::assertIsArray($result); // no asserts, as plugins are disabled in tests } } diff --git a/tests/API/TagControllerTest.php b/tests/API/TagControllerTest.php index 3a8e01f3..2d604203 100644 --- a/tests/API/TagControllerTest.php +++ b/tests/API/TagControllerTest.php @@ -17,7 +17,7 @@ use Symfony\Component\HttpFoundation\Response; /** * @group integration */ -class TagControllerTest extends APIControllerBaseTest +class TagControllerTest extends APIControllerBaseTestCase { /** * @return Tag[] @@ -45,13 +45,13 @@ class TagControllerTest extends APIControllerBaseTest $this->assertAccessIsGranted($client, '/api/tags'); $content = $client->getResponse()->getContent(); - $this->assertNotFalse($content); + self::assertNotFalse($content); $result = json_decode($content, true); - $this->assertIsArray($result); - $this->assertNotEmpty($result); - $this->assertEquals(10, \count($result)); - $this->assertEquals('Test', $result[9]); + self::assertIsArray($result); + self::assertNotEmpty($result); + self::assertEquals(10, \count($result)); + self::assertEquals('Test', $result[9]); } public function testFindCollection(): void @@ -60,12 +60,12 @@ class TagControllerTest extends APIControllerBaseTest $this->importTagFixtures(); $this->assertAccessIsGranted($client, '/api/tags/find', 'GET', ['name' => '2018']); $content = $client->getResponse()->getContent(); - $this->assertNotFalse($content); + self::assertNotFalse($content); $result = json_decode($content, true); - $this->assertIsArray($result); - $this->assertNotEmpty($result); - $this->assertEquals(3, \count($result)); + self::assertIsArray($result); + self::assertNotEmpty($result); + self::assertEquals(3, \count($result)); self::assertIsArray($result[0]); self::assertApiResponseTypeStructure('TagEntity', $result[0]); } @@ -78,12 +78,12 @@ class TagControllerTest extends APIControllerBaseTest $this->assertAccessIsGranted($client, '/api/tags', 'GET', $query); $content = $client->getResponse()->getContent(); - $this->assertNotFalse($content); + self::assertNotFalse($content); $result = json_decode($content, true); - $this->assertIsArray($result); - $this->assertEmpty($result); - $this->assertEquals(0, \count($result)); + self::assertIsArray($result); + self::assertEmpty($result); + self::assertEquals(0, \count($result)); } public function testPostAction(): void @@ -95,15 +95,15 @@ class TagControllerTest extends APIControllerBaseTest 'color' => '#00ff00' ]; $this->request($client, '/api/tags', 'POST', [], json_encode($data)); - $this->assertTrue($client->getResponse()->isSuccessful()); + self::assertTrue($client->getResponse()->isSuccessful()); $content = $client->getResponse()->getContent(); - $this->assertNotFalse($content); + self::assertNotFalse($content); $result = json_decode($content, true); - $this->assertIsArray($result); + self::assertIsArray($result); self::assertApiResponseTypeStructure('TagEntity', $result); - $this->assertNotEmpty($result['id']); + self::assertNotEmpty($result['id']); self::assertEquals('#00ff00', $result['color']); } @@ -117,7 +117,7 @@ class TagControllerTest extends APIControllerBaseTest ]; $this->request($client, '/api/tags', 'POST', [], json_encode($data)); $response = $client->getResponse(); - $this->assertEquals(400, $response->getStatusCode()); + self::assertEquals(400, $response->getStatusCode()); $this->assertApiCallValidationError($response, ['name', 'color']); } @@ -129,15 +129,15 @@ class TagControllerTest extends APIControllerBaseTest 'name' => 'foo', ]; $this->request($client, '/api/tags', 'POST', [], json_encode($data)); - $this->assertTrue($client->getResponse()->isSuccessful()); + self::assertTrue($client->getResponse()->isSuccessful()); $content = $client->getResponse()->getContent(); - $this->assertNotFalse($content); + self::assertNotFalse($content); $result = json_decode($content, true); - $this->assertIsArray($result); + self::assertIsArray($result); self::assertApiResponseTypeStructure('TagEntity', $result); - $this->assertNotEmpty($result['id']); + self::assertNotEmpty($result['id']); self::assertEquals('foo', $result['name']); } @@ -149,16 +149,16 @@ class TagControllerTest extends APIControllerBaseTest $this->assertAccessIsGranted($client, '/api/tags', 'GET', $query); $content = $client->getResponse()->getContent(); - $this->assertNotFalse($content); + self::assertNotFalse($content); $result = json_decode($content, true); - $this->assertIsArray($result); - $this->assertNotEmpty($result); - $this->assertEquals(3, \count($result)); + self::assertIsArray($result); + self::assertNotEmpty($result); + self::assertEquals(3, \count($result)); - $this->assertEquals('Administration', $result[0]); - $this->assertEquals('Bug Fixing', $result[1]); - $this->assertEquals('Marketing', $result[2]); + self::assertEquals('Administration', $result[0]); + self::assertEquals('Bug Fixing', $result[1]); + self::assertEquals('Marketing', $result[2]); } public function testDeleteAction(): void @@ -168,17 +168,17 @@ class TagControllerTest extends APIControllerBaseTest $id = $tags[0]->getId(); $this->request($client, '/api/tags/' . $id, 'DELETE'); - $this->assertTrue($client->getResponse()->isSuccessful()); - $this->assertEquals(Response::HTTP_NO_CONTENT, $client->getResponse()->getStatusCode()); - $this->assertEmpty($client->getResponse()->getContent()); + self::assertTrue($client->getResponse()->isSuccessful()); + self::assertEquals(Response::HTTP_NO_CONTENT, $client->getResponse()->getStatusCode()); + self::assertEmpty($client->getResponse()->getContent()); $this->assertAccessIsGranted($client, '/api/tags'); $content = $client->getResponse()->getContent(); - $this->assertNotFalse($content); + self::assertNotFalse($content); $result = json_decode($content, true); - $this->assertEquals(9, \count($result)); + self::assertEquals(9, \count($result)); } public function testDeleteActionWithUnknownTimesheet(): void diff --git a/tests/API/TeamControllerTest.php b/tests/API/TeamControllerTest.php index df4e1b2f..9e1d6ec8 100644 --- a/tests/API/TeamControllerTest.php +++ b/tests/API/TeamControllerTest.php @@ -18,7 +18,7 @@ use Symfony\Component\HttpFoundation\Response; /** * @group integration */ -class TeamControllerTest extends APIControllerBaseTest +class TeamControllerTest extends APIControllerBaseTestCase { /** * @return Team[] @@ -39,7 +39,7 @@ class TeamControllerTest extends APIControllerBaseTest /** * @return array<int, array<int, string>> */ - public function getRoleTestData(): array + public static function getRoleTestData(): array { return [ [User::ROLE_USER], @@ -62,8 +62,8 @@ class TeamControllerTest extends APIControllerBaseTest $this->assertAccessIsGranted($client, '/api/teams'); $result = json_decode($client->getResponse()->getContent(), true); - $this->assertIsArray($result); - $this->assertNotEmpty($result); + self::assertIsArray($result); + self::assertNotEmpty($result); self::assertEquals(2, \count($result)); self::assertIsArray($result[0]); self::assertApiResponseTypeStructure('TeamCollection', $result[0]); @@ -78,7 +78,7 @@ class TeamControllerTest extends APIControllerBaseTest $this->assertAccessIsGranted($client, '/api/teams/' . $id); $result = json_decode($client->getResponse()->getContent(), true); - $this->assertIsArray($result); + self::assertIsArray($result); self::assertApiResponseTypeStructure('TeamEntity', $result); } @@ -103,12 +103,12 @@ class TeamControllerTest extends APIControllerBaseTest ], ]; $this->request($client, '/api/teams', 'POST', [], json_encode($data)); - $this->assertTrue($client->getResponse()->isSuccessful()); + self::assertTrue($client->getResponse()->isSuccessful()); $result = json_decode($client->getResponse()->getContent(), true); - $this->assertIsArray($result); + self::assertIsArray($result); self::assertApiResponseTypeStructure('TeamEntity', $result); - $this->assertNotEmpty($result['id']); + self::assertNotEmpty($result['id']); } public function testPostActionWithInvalidUser(): void @@ -135,7 +135,7 @@ class TeamControllerTest extends APIControllerBaseTest $this->request($client, '/api/teams', 'POST', [], json_encode($data)); $response = $client->getResponse(); - $this->assertEquals(400, $response->getStatusCode()); + self::assertEquals(400, $response->getStatusCode()); $this->assertApiCallValidationError($response, ['name', 'members.0.user']); } @@ -151,11 +151,11 @@ class TeamControllerTest extends APIControllerBaseTest ] ]; $this->request($client, '/api/teams', 'POST', [], json_encode($data)); - $this->assertTrue($client->getResponse()->isSuccessful()); + self::assertTrue($client->getResponse()->isSuccessful()); $result = json_decode($client->getResponse()->getContent(), true); - $this->assertIsArray($result); + self::assertIsArray($result); $updateId = $result['id']; - $this->assertIsNumeric($updateId); + self::assertIsNumeric($updateId); $data = [ 'name' => 'foo', @@ -167,24 +167,24 @@ class TeamControllerTest extends APIControllerBaseTest ]; $this->request($client, '/api/teams/' . $updateId, 'PATCH', [], json_encode($data)); - $this->assertTrue($client->getResponse()->isSuccessful()); + self::assertTrue($client->getResponse()->isSuccessful()); $result = json_decode($client->getResponse()->getContent(), true); - $this->assertIsArray($result); + self::assertIsArray($result); self::assertApiResponseTypeStructure('TeamEntity', $result); - $this->assertNotEmpty($result['id']); + self::assertNotEmpty($result['id']); self::assertCount(3, $result['members']); - $this->assertIsNumeric($updateId); + self::assertIsNumeric($updateId); $this->request($client, '/api/teams/' . $updateId); $result = json_decode($client->getResponse()->getContent(), true); - $this->assertIsArray($result); + self::assertIsArray($result); self::assertApiResponseTypeStructure('TeamEntity', $result); - $this->assertIsArray($result['members']); + self::assertIsArray($result['members']); self::assertCount(3, $result['members']); - $this->assertIsArray($result['members'][1]); + self::assertIsArray($result['members'][1]); self::assertFalse($result['members'][1]['teamlead']); self::assertEquals(1, $result['members'][1]['user']['id']); self::assertEquals('clara_customer', $result['members'][1]['user']['username']); @@ -208,10 +208,10 @@ class TeamControllerTest extends APIControllerBaseTest ], ]; $this->request($client, '/api/teams', 'POST', [], json_encode($data)); - $this->assertTrue($client->getResponse()->isSuccessful()); + self::assertTrue($client->getResponse()->isSuccessful()); $result = json_decode($client->getResponse()->getContent(), true); - $this->assertIsArray($result); - $this->assertIsNumeric($result['id']); + self::assertIsArray($result); + self::assertIsNumeric($result['id']); $data = [ 'name' => '1', @@ -222,7 +222,7 @@ class TeamControllerTest extends APIControllerBaseTest $this->request($client, '/api/teams/' . $result['id'], 'PATCH', [], json_encode($data)); $response = $client->getResponse(); - $this->assertEquals(400, $response->getStatusCode()); + self::assertEquals(400, $response->getStatusCode()); $this->assertApiCallValidationError($response, ['name', 'members.0.user']); } @@ -234,16 +234,16 @@ class TeamControllerTest extends APIControllerBaseTest $this->assertAccessIsGranted($client, '/api/teams/' . $id); $result = json_decode($client->getResponse()->getContent(), true); - $this->assertIsArray($result); + self::assertIsArray($result); self::assertApiResponseTypeStructure('TeamEntity', $result); - $this->assertNotEmpty($result['id']); + self::assertNotEmpty($result['id']); $id = $result['id']; - $this->assertIsNumeric($id); + self::assertIsNumeric($id); $this->request($client, '/api/teams/' . $id, 'DELETE'); - $this->assertTrue($client->getResponse()->isSuccessful()); + self::assertTrue($client->getResponse()->isSuccessful()); self::assertEquals(Response::HTTP_NO_CONTENT, $client->getResponse()->getStatusCode()); - $this->assertEmpty($client->getResponse()->getContent()); + self::assertEmpty($client->getResponse()->getContent()); } public function testPostMemberAction(): void @@ -256,20 +256,20 @@ class TeamControllerTest extends APIControllerBaseTest ], ]; $this->request($client, '/api/teams', 'POST', [], json_encode($data)); - $this->assertTrue($client->getResponse()->isSuccessful()); + self::assertTrue($client->getResponse()->isSuccessful()); $result = json_decode($client->getResponse()->getContent(), true); - $this->assertIsArray($result); - $this->assertIsArray($result['members']); + self::assertIsArray($result); + self::assertIsArray($result['members']); self::assertCount(1, $result['members']); - $this->assertIsNumeric($result['id']); + self::assertIsNumeric($result['id']); $this->request($client, '/api/teams/' . $result['id'] . '/members/2', 'POST'); - $this->assertTrue($client->getResponse()->isSuccessful()); + self::assertTrue($client->getResponse()->isSuccessful()); $result = json_decode($client->getResponse()->getContent(), true); - $this->assertIsArray($result); + self::assertIsArray($result); self::assertApiResponseTypeStructure('TeamEntity', $result); - $this->assertIsArray($result['members']); + self::assertIsArray($result['members']); self::assertCount(2, $result['members']); } @@ -284,10 +284,10 @@ class TeamControllerTest extends APIControllerBaseTest ], ]; $this->request($client, '/api/teams', 'POST', [], json_encode($data)); - $this->assertTrue($client->getResponse()->isSuccessful()); + self::assertTrue($client->getResponse()->isSuccessful()); $result = json_decode($client->getResponse()->getContent(), true); - $this->assertIsArray($result); - $this->assertIsNumeric($result['id']); + self::assertIsArray($result); + self::assertIsNumeric($result['id']); // team not found $this->assertEntityNotFoundForPost($client, '/api/teams/999/members/999'); @@ -297,7 +297,7 @@ class TeamControllerTest extends APIControllerBaseTest // add user $this->request($client, '/api/teams/' . $result['id'] . '/members/5', 'POST'); - $this->assertTrue($client->getResponse()->isSuccessful()); + self::assertTrue($client->getResponse()->isSuccessful()); // cannot add existing member $this->assertBadRequest($client, '/api/teams/' . $result['id'] . '/members/5', 'POST'); @@ -316,20 +316,20 @@ class TeamControllerTest extends APIControllerBaseTest ], ]; $this->request($client, '/api/teams', 'POST', [], json_encode($data)); - $this->assertTrue($client->getResponse()->isSuccessful()); + self::assertTrue($client->getResponse()->isSuccessful()); $result = json_decode($client->getResponse()->getContent(), true); - $this->assertIsArray($result); - $this->assertIsNumeric($result['id']); - $this->assertIsArray($result['members']); + self::assertIsArray($result); + self::assertIsNumeric($result['id']); + self::assertIsArray($result['members']); self::assertCount(4, $result['members']); $this->request($client, '/api/teams/' . $result['id'] . '/members/2', 'DELETE'); - $this->assertTrue($client->getResponse()->isSuccessful()); + self::assertTrue($client->getResponse()->isSuccessful()); $result = json_decode($client->getResponse()->getContent(), true); - $this->assertIsArray($result); + self::assertIsArray($result); self::assertApiResponseTypeStructure('TeamEntity', $result); - $this->assertIsArray($result['members']); + self::assertIsArray($result['members']); self::assertCount(3, $result['members']); } @@ -346,10 +346,10 @@ class TeamControllerTest extends APIControllerBaseTest ], ]; $this->request($client, '/api/teams', 'POST', [], json_encode($data)); - $this->assertTrue($client->getResponse()->isSuccessful()); + self::assertTrue($client->getResponse()->isSuccessful()); $result = json_decode($client->getResponse()->getContent(), true); - $this->assertIsArray($result); - $this->assertIsNumeric($result['id']); + self::assertIsArray($result); + self::assertIsNumeric($result['id']); // team not found $this->assertNotFoundForDelete($client, '/api/teams/999/members/999'); @@ -359,7 +359,7 @@ class TeamControllerTest extends APIControllerBaseTest // remove user $this->request($client, '/api/teams/' . $result['id'] . '/members/2', 'DELETE'); - $this->assertTrue($client->getResponse()->isSuccessful()); + self::assertTrue($client->getResponse()->isSuccessful()); // cannot remove non-member $this->assertBadRequest($client, '/api/teams/' . $result['id'] . '/members/2', 'DELETE'); @@ -378,21 +378,21 @@ class TeamControllerTest extends APIControllerBaseTest ], ]; $this->request($client, '/api/teams', 'POST', [], json_encode($data)); - $this->assertTrue($client->getResponse()->isSuccessful()); + self::assertTrue($client->getResponse()->isSuccessful()); $result = json_decode($client->getResponse()->getContent(), true); - $this->assertIsArray($result); - $this->assertIsNumeric($result['id']); + self::assertIsArray($result); + self::assertIsNumeric($result['id']); self::assertCount(0, $result['customers']); $this->request($client, '/api/teams/' . $result['id'] . '/customers/1', 'POST'); - $this->assertTrue($client->getResponse()->isSuccessful()); + self::assertTrue($client->getResponse()->isSuccessful()); $result = json_decode($client->getResponse()->getContent(), true); - $this->assertIsArray($result); + self::assertIsArray($result); self::assertApiResponseTypeStructure('TeamEntity', $result); - $this->assertIsArray($result['customers']); + self::assertIsArray($result['customers']); self::assertCount(1, $result['customers']); - $this->assertIsArray($result['customers'][0]); + self::assertIsArray($result['customers'][0]); self::assertEquals(1, $result['customers'][0]['id']); } @@ -407,10 +407,10 @@ class TeamControllerTest extends APIControllerBaseTest ], ]; $this->request($client, '/api/teams', 'POST', [], json_encode($data)); - $this->assertTrue($client->getResponse()->isSuccessful()); + self::assertTrue($client->getResponse()->isSuccessful()); $result = json_decode($client->getResponse()->getContent(), true); - $this->assertIsArray($result); - $this->assertIsNumeric($result['id']); + self::assertIsArray($result); + self::assertIsNumeric($result['id']); // team not found $this->assertEntityNotFoundForPost($client, '/api/teams/999/customers/999'); @@ -420,10 +420,10 @@ class TeamControllerTest extends APIControllerBaseTest // add customer $this->request($client, '/api/teams/' . $result['id'] . '/customers/1', 'POST'); - $this->assertTrue($client->getResponse()->isSuccessful()); + self::assertTrue($client->getResponse()->isSuccessful()); $result = json_decode($client->getResponse()->getContent(), true); - $this->assertIsArray($result); - $this->assertIsNumeric($result['id']); + self::assertIsArray($result); + self::assertIsNumeric($result['id']); self::assertCount(1, $result['customers']); // cannot add existing customer @@ -443,29 +443,29 @@ class TeamControllerTest extends APIControllerBaseTest ], ]; $this->request($client, '/api/teams', 'POST', [], json_encode($data)); - $this->assertTrue($client->getResponse()->isSuccessful()); + self::assertTrue($client->getResponse()->isSuccessful()); $result = json_decode($client->getResponse()->getContent(), true); - $this->assertIsArray($result); - $this->assertIsNumeric($result['id']); + self::assertIsArray($result); + self::assertIsNumeric($result['id']); self::assertCount(0, $result['customers']); // add customer $this->request($client, '/api/teams/' . $result['id'] . '/customers/1', 'POST'); - $this->assertTrue($client->getResponse()->isSuccessful()); + self::assertTrue($client->getResponse()->isSuccessful()); $result = json_decode($client->getResponse()->getContent(), true); - $this->assertIsArray($result); - $this->assertIsNumeric($result['id']); + self::assertIsArray($result); + self::assertIsNumeric($result['id']); self::assertCount(1, $result['customers']); $this->request($client, '/api/teams/' . $result['id'] . '/customers/1', 'DELETE'); - $this->assertTrue($client->getResponse()->isSuccessful()); + self::assertTrue($client->getResponse()->isSuccessful()); $result = json_decode($client->getResponse()->getContent(), true); - $this->assertIsArray($result); - $this->assertIsNumeric($result['id']); - $this->assertIsArray($result); + self::assertIsArray($result); + self::assertIsNumeric($result['id']); + self::assertIsArray($result); self::assertApiResponseTypeStructure('TeamEntity', $result); - $this->assertIsArray($result['customers']); + self::assertIsArray($result['customers']); self::assertCount(0, $result['customers']); /** @var EntityManager $em */ @@ -488,10 +488,10 @@ class TeamControllerTest extends APIControllerBaseTest ], ]; $this->request($client, '/api/teams', 'POST', [], json_encode($data)); - $this->assertTrue($client->getResponse()->isSuccessful()); + self::assertTrue($client->getResponse()->isSuccessful()); $result = json_decode($client->getResponse()->getContent(), true); - $this->assertIsArray($result); - $this->assertIsNumeric($result['id']); + self::assertIsArray($result); + self::assertIsNumeric($result['id']); // team not found $this->assertNotFoundForDelete($client, '/api/teams/999/customers/999'); @@ -513,20 +513,20 @@ class TeamControllerTest extends APIControllerBaseTest ], ]; $this->request($client, '/api/teams', 'POST', [], json_encode($data)); - $this->assertTrue($client->getResponse()->isSuccessful()); + self::assertTrue($client->getResponse()->isSuccessful()); $result = json_decode($client->getResponse()->getContent(), true); - $this->assertIsArray($result); - $this->assertIsNumeric($result['id']); + self::assertIsArray($result); + self::assertIsNumeric($result['id']); self::assertCount(0, $result['projects']); $this->request($client, '/api/teams/' . $result['id'] . '/projects/1', 'POST'); - $this->assertTrue($client->getResponse()->isSuccessful()); + self::assertTrue($client->getResponse()->isSuccessful()); $result = json_decode($client->getResponse()->getContent(), true); - $this->assertIsArray($result); + self::assertIsArray($result); self::assertApiResponseTypeStructure('TeamEntity', $result); - $this->assertIsArray($result['projects']); + self::assertIsArray($result['projects']); self::assertCount(1, $result['projects']); - $this->assertIsArray($result['projects'][0]); + self::assertIsArray($result['projects'][0]); self::assertEquals(1, $result['projects'][0]['id']); } @@ -541,10 +541,10 @@ class TeamControllerTest extends APIControllerBaseTest ], ]; $this->request($client, '/api/teams', 'POST', [], json_encode($data)); - $this->assertTrue($client->getResponse()->isSuccessful()); + self::assertTrue($client->getResponse()->isSuccessful()); $result = json_decode($client->getResponse()->getContent(), true); - $this->assertIsArray($result); - $this->assertIsNumeric($result['id']); + self::assertIsArray($result); + self::assertIsNumeric($result['id']); // team not found $this->assertEntityNotFoundForPost($client, '/api/teams/999/projects/999'); @@ -556,10 +556,10 @@ class TeamControllerTest extends APIControllerBaseTest // add project $this->request($client, '/api/teams/' . $result['id'] . '/projects/1', 'POST'); - $this->assertTrue($client->getResponse()->isSuccessful()); + self::assertTrue($client->getResponse()->isSuccessful()); $result = json_decode($client->getResponse()->getContent(), true); - $this->assertIsArray($result); - $this->assertIsNumeric($result['id']); + self::assertIsArray($result); + self::assertIsNumeric($result['id']); self::assertCount(1, $result['projects']); // cannot add existing project @@ -579,27 +579,27 @@ class TeamControllerTest extends APIControllerBaseTest ], ]; $this->request($client, '/api/teams', 'POST', [], json_encode($data)); - $this->assertTrue($client->getResponse()->isSuccessful()); + self::assertTrue($client->getResponse()->isSuccessful()); $result = json_decode($client->getResponse()->getContent(), true); - $this->assertIsArray($result); - $this->assertIsNumeric($result['id']); + self::assertIsArray($result); + self::assertIsNumeric($result['id']); self::assertCount(0, $result['projects']); // add project $this->request($client, '/api/teams/' . $result['id'] . '/projects/1', 'POST'); - $this->assertTrue($client->getResponse()->isSuccessful()); + self::assertTrue($client->getResponse()->isSuccessful()); $result = json_decode($client->getResponse()->getContent(), true); - $this->assertIsArray($result); - $this->assertIsArray($result['projects']); + self::assertIsArray($result); + self::assertIsArray($result['projects']); self::assertCount(1, $result['projects']); $this->request($client, '/api/teams/' . $result['id'] . '/projects/1', 'DELETE'); - $this->assertTrue($client->getResponse()->isSuccessful()); + self::assertTrue($client->getResponse()->isSuccessful()); $result = json_decode($client->getResponse()->getContent(), true); - $this->assertIsArray($result); + self::assertIsArray($result); self::assertApiResponseTypeStructure('TeamEntity', $result); - $this->assertIsArray($result['projects']); + self::assertIsArray($result['projects']); self::assertCount(0, $result['projects']); /** @var EntityManager $em */ @@ -622,10 +622,10 @@ class TeamControllerTest extends APIControllerBaseTest ], ]; $this->request($client, '/api/teams', 'POST', [], json_encode($data)); - $this->assertTrue($client->getResponse()->isSuccessful()); + self::assertTrue($client->getResponse()->isSuccessful()); $result = json_decode($client->getResponse()->getContent(), true); - $this->assertIsArray($result); - $this->assertIsNumeric($result['id']); + self::assertIsArray($result); + self::assertIsNumeric($result['id']); // team not found $this->assertNotFoundForDelete($client, '/api/teams/999/projects/999'); @@ -647,20 +647,20 @@ class TeamControllerTest extends APIControllerBaseTest ], ]; $this->request($client, '/api/teams', 'POST', [], json_encode($data)); - $this->assertTrue($client->getResponse()->isSuccessful()); + self::assertTrue($client->getResponse()->isSuccessful()); $result = json_decode($client->getResponse()->getContent(), true); - $this->assertIsArray($result); - $this->assertIsNumeric($result['id']); + self::assertIsArray($result); + self::assertIsNumeric($result['id']); self::assertCount(0, $result['activities']); $this->request($client, '/api/teams/' . $result['id'] . '/activities/1', 'POST'); - $this->assertTrue($client->getResponse()->isSuccessful()); + self::assertTrue($client->getResponse()->isSuccessful()); $result = json_decode($client->getResponse()->getContent(), true); - $this->assertIsArray($result); + self::assertIsArray($result); self::assertApiResponseTypeStructure('TeamEntity', $result); - $this->assertIsArray($result['activities']); + self::assertIsArray($result['activities']); self::assertCount(1, $result['activities']); - $this->assertIsArray($result['activities'][0]); + self::assertIsArray($result['activities'][0]); self::assertEquals(1, $result['activities'][0]['id']); } @@ -675,10 +675,10 @@ class TeamControllerTest extends APIControllerBaseTest ], ]; $this->request($client, '/api/teams', 'POST', [], json_encode($data)); - $this->assertTrue($client->getResponse()->isSuccessful()); + self::assertTrue($client->getResponse()->isSuccessful()); $result = json_decode($client->getResponse()->getContent(), true); - $this->assertIsArray($result); - $this->assertIsNumeric($result['id']); + self::assertIsArray($result); + self::assertIsNumeric($result['id']); // team not found $this->assertEntityNotFoundForPost($client, '/api/teams/999/activities/999'); @@ -688,10 +688,10 @@ class TeamControllerTest extends APIControllerBaseTest // add activity $this->request($client, '/api/teams/' . $result['id'] . '/activities/1', 'POST'); - $this->assertTrue($client->getResponse()->isSuccessful()); + self::assertTrue($client->getResponse()->isSuccessful()); $result = json_decode($client->getResponse()->getContent(), true); - $this->assertIsArray($result); - $this->assertIsNumeric($result['id']); + self::assertIsArray($result); + self::assertIsNumeric($result['id']); self::assertCount(1, $result['activities']); // cannot add existing activity @@ -711,27 +711,27 @@ class TeamControllerTest extends APIControllerBaseTest ], ]; $this->request($client, '/api/teams', 'POST', [], json_encode($data)); - $this->assertTrue($client->getResponse()->isSuccessful()); + self::assertTrue($client->getResponse()->isSuccessful()); $result = json_decode($client->getResponse()->getContent(), true); - $this->assertIsArray($result); - $this->assertIsArray($result['activities']); + self::assertIsArray($result); + self::assertIsArray($result['activities']); self::assertCount(0, $result['activities']); // add activity $this->request($client, '/api/teams/' . $result['id'] . '/activities/1', 'POST'); - $this->assertTrue($client->getResponse()->isSuccessful()); + self::assertTrue($client->getResponse()->isSuccessful()); $result = json_decode($client->getResponse()->getContent(), true); - $this->assertIsArray($result); - $this->assertIsNumeric($result['id']); + self::assertIsArray($result); + self::assertIsNumeric($result['id']); self::assertCount(1, $result['activities']); $this->request($client, '/api/teams/' . $result['id'] . '/activities/1', 'DELETE'); - $this->assertTrue($client->getResponse()->isSuccessful()); + self::assertTrue($client->getResponse()->isSuccessful()); $result = json_decode($client->getResponse()->getContent(), true); - $this->assertIsArray($result); + self::assertIsArray($result); self::assertApiResponseTypeStructure('TeamEntity', $result); - $this->assertIsArray($result['activities']); + self::assertIsArray($result['activities']); self::assertCount(0, $result['activities']); } @@ -748,10 +748,10 @@ class TeamControllerTest extends APIControllerBaseTest ], ]; $this->request($client, '/api/teams', 'POST', [], json_encode($data)); - $this->assertTrue($client->getResponse()->isSuccessful()); + self::assertTrue($client->getResponse()->isSuccessful()); $result = json_decode($client->getResponse()->getContent(), true); - $this->assertIsArray($result); - $this->assertIsNumeric($result['id']); + self::assertIsArray($result); + self::assertIsNumeric($result['id']); // team not found $this->assertNotFoundForDelete($client, '/api/teams/999/activities/9999'); diff --git a/tests/API/TimesheetControllerTest.php b/tests/API/TimesheetControllerTest.php index 8d75f335..b0052658 100644 --- a/tests/API/TimesheetControllerTest.php +++ b/tests/API/TimesheetControllerTest.php @@ -26,7 +26,7 @@ use Symfony\Component\HttpFoundation\Response; /** * @group integration */ -class TimesheetControllerTest extends APIControllerBaseTest +class TimesheetControllerTest extends APIControllerBaseTestCase { public const DATE_FORMAT = 'Y-m-d H:i:s'; public const DATE_FORMAT_HTML5 = 'Y-m-d\TH:i:s'; @@ -64,7 +64,7 @@ class TimesheetControllerTest extends APIControllerBaseTest self::assertIsArray($result); self::assertNotEmpty($result); self::assertEquals(10, \count($result)); - $this->assertIsArray($result[0]); + self::assertIsArray($result[0]); self::assertApiResponseTypeStructure('TimesheetCollection', $result[0]); } @@ -81,7 +81,7 @@ class TimesheetControllerTest extends APIControllerBaseTest self::assertIsArray($result); self::assertNotEmpty($result); self::assertEquals(10, \count($result)); - $this->assertIsArray($result[0]); + self::assertIsArray($result[0]); self::assertApiResponseTypeStructure('TimesheetCollectionFull', $result[0]); } @@ -106,7 +106,7 @@ class TimesheetControllerTest extends APIControllerBaseTest self::assertIsArray($result); self::assertNotEmpty($result); self::assertEquals(10, \count($result)); - $this->assertIsArray($result[0]); + self::assertIsArray($result[0]); self::assertApiResponseTypeStructure('TimesheetCollection', $result[0]); $query = ['users' => [2]]; @@ -119,7 +119,7 @@ class TimesheetControllerTest extends APIControllerBaseTest self::assertIsArray($result); self::assertNotEmpty($result); self::assertEquals(10, \count($result)); - $this->assertIsArray($result[0]); + self::assertIsArray($result[0]); self::assertApiResponseTypeStructure('TimesheetCollection', $result[0]); } @@ -167,7 +167,7 @@ class TimesheetControllerTest extends APIControllerBaseTest self::assertIsArray($result); self::assertNotEmpty($result); self::assertEquals(10, \count($result)); - $this->assertIsArray($result[0]); + self::assertIsArray($result[0]); self::assertApiResponseTypeStructure('TimesheetCollection', $result[0]); } @@ -192,7 +192,7 @@ class TimesheetControllerTest extends APIControllerBaseTest self::assertIsArray($result); self::assertNotEmpty($result); self::assertEquals(17, \count($result)); - $this->assertIsArray($result[0]); + self::assertIsArray($result[0]); self::assertApiResponseTypeStructure('TimesheetCollection', $result[0]); } @@ -207,7 +207,7 @@ class TimesheetControllerTest extends APIControllerBaseTest $result = json_decode($content, true); self::assertIsArray($result); - $this->assertEmpty($result); + self::assertEmpty($result); } public function testGetCollectionWithQuery(): void @@ -244,7 +244,7 @@ class TimesheetControllerTest extends APIControllerBaseTest self::assertIsArray($result); self::assertNotEmpty($result); self::assertEquals(4, \count($result)); - $this->assertIsArray($result[0]); + self::assertIsArray($result[0]); self::assertApiResponseTypeStructure('TimesheetCollection', $result[0]); } @@ -297,7 +297,7 @@ class TimesheetControllerTest extends APIControllerBaseTest self::assertIsArray($result); self::assertNotEmpty($result); self::assertEquals(5, \count($result)); - $this->assertIsArray($result[0]); + self::assertIsArray($result[0]); self::assertApiResponseTypeStructure('TimesheetCollection', $result[0]); } @@ -333,7 +333,7 @@ class TimesheetControllerTest extends APIControllerBaseTest self::assertIsArray($result); self::assertNotEmpty($result); self::assertEquals(7, \count($result)); - $this->assertIsArray($result[0]); + self::assertIsArray($result[0]); self::assertApiResponseTypeStructure('TimesheetCollection', $result[0]); $query = [ @@ -352,7 +352,7 @@ class TimesheetControllerTest extends APIControllerBaseTest self::assertIsArray($result); self::assertNotEmpty($result); self::assertEquals(10, \count($result)); - $this->assertIsArray($result[0]); + self::assertIsArray($result[0]); self::assertApiResponseTypeStructure('TimesheetCollection', $result[0]); $query = [ @@ -369,7 +369,7 @@ class TimesheetControllerTest extends APIControllerBaseTest self::assertIsArray($result); self::assertNotEmpty($result); self::assertEquals(17, \count($result)); - $this->assertIsArray($result[0]); + self::assertIsArray($result[0]); self::assertApiResponseTypeStructure('TimesheetCollection', $result[0]); } @@ -440,7 +440,7 @@ class TimesheetControllerTest extends APIControllerBaseTest $client = $this->getClientForAuthenticatedUser(User::ROLE_USER); $this->importFixtureForUser(User::ROLE_USER); $timesheets = $this->importFixtureForUser(User::ROLE_ADMIN); - $this->assertCount(10, $timesheets); + self::assertCount(10, $timesheets); $this->assertApiAccessDenied($client, '/api/timesheets/' . $timesheets[0]->getId(), 'Access denied.'); } @@ -480,7 +480,7 @@ class TimesheetControllerTest extends APIControllerBaseTest $json = json_encode($data); self::assertIsString($json); $this->request($client, '/api/timesheets', 'POST', [], $json); - $this->assertTrue($client->getResponse()->isSuccessful()); + self::assertTrue($client->getResponse()->isSuccessful()); $content = $client->getResponse()->getContent(); self::assertIsString($content); @@ -489,9 +489,9 @@ class TimesheetControllerTest extends APIControllerBaseTest self::assertIsArray($result); self::assertApiResponseTypeStructure('TimesheetEntity', $result); self::assertNotEmpty($result['id']); - $this->assertTrue($result['duration'] == 28800 || $result['duration'] == 28860); // 1 minute rounding might be applied + self::assertTrue($result['duration'] == 28800 || $result['duration'] == 28860); // 1 minute rounding might be applied self::assertEquals(2016, $result['rate']); - $this->assertFalse($result['billable']); + self::assertFalse($result['billable']); } public function testPostActionWithFullExpandedResponse(): void @@ -511,7 +511,7 @@ class TimesheetControllerTest extends APIControllerBaseTest $json = json_encode($data); self::assertIsString($json); $this->request($client, '/api/timesheets?full=true', 'POST', [], $json); - $this->assertTrue($client->getResponse()->isSuccessful()); + self::assertTrue($client->getResponse()->isSuccessful()); $content = $client->getResponse()->getContent(); self::assertIsString($content); @@ -520,9 +520,9 @@ class TimesheetControllerTest extends APIControllerBaseTest self::assertIsArray($result); self::assertApiResponseTypeStructure('TimesheetExpanded', $result); self::assertNotEmpty($result['id']); - $this->assertTrue($result['duration'] == 28800 || $result['duration'] == 28860); // 1 minute rounding might be applied + self::assertTrue($result['duration'] == 28800 || $result['duration'] == 28860); // 1 minute rounding might be applied self::assertEquals(2016, $result['rate']); - $this->assertTrue($result['billable']); + self::assertTrue($result['billable']); } public function testPostActionForDifferentUser(): void @@ -545,7 +545,7 @@ class TimesheetControllerTest extends APIControllerBaseTest $json = json_encode($data); self::assertIsString($json); $this->request($client, '/api/timesheets', 'POST', [], $json); - $this->assertTrue($client->getResponse()->isSuccessful()); + self::assertTrue($client->getResponse()->isSuccessful()); $content = $client->getResponse()->getContent(); self::assertIsString($content); @@ -556,7 +556,7 @@ class TimesheetControllerTest extends APIControllerBaseTest self::assertNotEmpty($result['id']); self::assertEquals($user->getId(), $result['user']); $this->assertNotEquals($admin->getId(), $result['user']); - $this->assertTrue($result['billable']); + self::assertTrue($result['billable']); } // check for project, as this is a required field. It will not be included in the select, as it is @@ -711,7 +711,7 @@ class TimesheetControllerTest extends APIControllerBaseTest $json = json_encode($data); self::assertIsString($json); $this->request($client, '/api/timesheets', 'POST', [], $json); - $this->assertTrue($client->getResponse()->isSuccessful()); + self::assertTrue($client->getResponse()->isSuccessful()); $content = $client->getResponse()->getContent(); self::assertIsString($content); @@ -719,7 +719,7 @@ class TimesheetControllerTest extends APIControllerBaseTest self::assertIsArray($result); self::assertApiResponseTypeStructure('TimesheetEntity', $result); - $this->assertFalse($result['billable']); + self::assertFalse($result['billable']); } public function testPostActionWithNonBillableCustomerExplicit(): void @@ -752,7 +752,7 @@ class TimesheetControllerTest extends APIControllerBaseTest $json = json_encode($data); self::assertIsString($json); $this->request($client, '/api/timesheets', 'POST', [], $json); - $this->assertTrue($client->getResponse()->isSuccessful()); + self::assertTrue($client->getResponse()->isSuccessful()); $content = $client->getResponse()->getContent(); self::assertIsString($content); @@ -761,10 +761,10 @@ class TimesheetControllerTest extends APIControllerBaseTest self::assertIsArray($result); self::assertApiResponseTypeStructure('TimesheetEntity', $result); // explicit overwritten values win! - $this->assertTrue($result['billable']); + self::assertTrue($result['billable']); } - public function getTrackingModeTestData(): array + public static function getTrackingModeTestData(): array { return [ ['duration_fixed_begin', User::ROLE_USER, false], @@ -800,7 +800,7 @@ class TimesheetControllerTest extends APIControllerBaseTest $response = $client->getResponse(); if ($showTimes) { - $this->assertTrue($response->isSuccessful()); + self::assertTrue($response->isSuccessful()); } else { $this->assertApiCallValidationError($response, [], true, [], [], ['begin', 'end']); } @@ -822,7 +822,7 @@ class TimesheetControllerTest extends APIControllerBaseTest $json = json_encode($data); self::assertIsString($json); $this->request($client, '/api/timesheets/' . $timesheets[0]->getId(), 'PATCH', [], $json); - $this->assertTrue($client->getResponse()->isSuccessful()); + self::assertTrue($client->getResponse()->isSuccessful()); $content = $client->getResponse()->getContent(); self::assertIsString($content); @@ -833,7 +833,7 @@ class TimesheetControllerTest extends APIControllerBaseTest self::assertNotEmpty($result['id']); self::assertEquals(25200, $result['duration']); self::assertEquals('foo', $result['description']); - $this->assertFalse($result['billable']); + self::assertFalse($result['billable']); } public function testPatchActionWithInvalidUser(): void @@ -912,9 +912,9 @@ class TimesheetControllerTest extends APIControllerBaseTest $id = $result['id']; $this->request($client, '/api/timesheets/' . $id, 'DELETE'); - $this->assertTrue($client->getResponse()->isSuccessful()); + self::assertTrue($client->getResponse()->isSuccessful()); self::assertEquals(Response::HTTP_NO_CONTENT, $client->getResponse()->getStatusCode()); - $this->assertEmpty($client->getResponse()->getContent()); + self::assertEmpty($client->getResponse()->getContent()); } public function testDeleteActionWithUnknownTimesheet(): void @@ -929,9 +929,9 @@ class TimesheetControllerTest extends APIControllerBaseTest $timesheets = $this->importFixtureForUser(User::ROLE_USER); $this->request($client, '/api/timesheets/' . $timesheets[0]->getId(), 'DELETE'); - $this->assertTrue($client->getResponse()->isSuccessful()); + self::assertTrue($client->getResponse()->isSuccessful()); self::assertEquals(Response::HTTP_NO_CONTENT, $client->getResponse()->getStatusCode()); - $this->assertEmpty($client->getResponse()->getContent()); + self::assertEmpty($client->getResponse()->getContent()); } public function testDeleteActionWithoutAuthorization(): void @@ -979,7 +979,7 @@ class TimesheetControllerTest extends APIControllerBaseTest $em->flush(); $this->request($client, '/api/timesheets/' . $id, 'DELETE'); - $this->assertTrue($client->getResponse()->isSuccessful()); + self::assertTrue($client->getResponse()->isSuccessful()); } public function testGetRecentAction(): void @@ -1012,7 +1012,7 @@ class TimesheetControllerTest extends APIControllerBaseTest self::assertIsArray($result); self::assertNotEmpty($result); self::assertEquals(1, \count($result)); - $this->assertIsArray($result[0]); + self::assertIsArray($result[0]); self::assertApiResponseTypeStructure('TimesheetCollectionFull', $result[0]); } @@ -1030,7 +1030,7 @@ class TimesheetControllerTest extends APIControllerBaseTest $this->importFixture($fixture); $this->request($client, '/api/timesheets/active'); - $this->assertTrue($client->getResponse()->isSuccessful()); + self::assertTrue($client->getResponse()->isSuccessful()); $content = $client->getResponse()->getContent(); self::assertIsString($content); @@ -1038,7 +1038,7 @@ class TimesheetControllerTest extends APIControllerBaseTest self::assertEquals(3, \count($result)); foreach ($result as $timesheet) { - $this->assertIsArray($timesheet); + self::assertIsArray($timesheet); self::assertApiResponseTypeStructure('TimesheetCollectionFull', $timesheet); } } @@ -1063,7 +1063,7 @@ class TimesheetControllerTest extends APIControllerBaseTest $id = $timesheets[0]->getId(); $this->request($client, '/api/timesheets/' . $id . '/stop', 'PATCH'); - $this->assertTrue($client->getResponse()->isSuccessful()); + self::assertTrue($client->getResponse()->isSuccessful()); $content = $client->getResponse()->getContent(); self::assertIsString($content); @@ -1076,7 +1076,7 @@ class TimesheetControllerTest extends APIControllerBaseTest $em = $this->getEntityManager(); /** @var Timesheet $timesheet */ $timesheet = $em->getRepository(Timesheet::class)->find($id); - $this->assertInstanceOf(\DateTime::class, $timesheet->getEnd()); + self::assertInstanceOf(\DateTime::class, $timesheet->getEnd()); } public function testStopActionTriggersValidationOnLongRunning(): void @@ -1157,7 +1157,7 @@ class TimesheetControllerTest extends APIControllerBaseTest self::assertIsArray($result); self::assertNotEmpty($result); self::assertEquals(10, \count($result)); - $this->assertIsArray($result[0]); + self::assertIsArray($result[0]); self::assertApiResponseTypeStructure('TimesheetCollection', $result[0]); $query = ['tags' => ['Test', 'Admin']]; @@ -1170,7 +1170,7 @@ class TimesheetControllerTest extends APIControllerBaseTest self::assertIsArray($result); self::assertNotEmpty($result); self::assertEquals(10, \count($result)); - $this->assertIsArray($result[0]); + self::assertIsArray($result[0]); self::assertApiResponseTypeStructure('TimesheetCollection', $result[0]); $query = ['tags' => ['Nothing-2-see', 'not-existing-here']]; @@ -1193,26 +1193,26 @@ class TimesheetControllerTest extends APIControllerBaseTest $this->request($client, '/api/timesheets/' . $id, 'PATCH', [], $json); $this->request($client, '/api/timesheets/' . $id . '/restart', 'PATCH'); - $this->assertTrue($client->getResponse()->isSuccessful()); + self::assertTrue($client->getResponse()->isSuccessful()); $content = $client->getResponse()->getContent(); self::assertIsString($content); $result = json_decode($content, true); - $this->assertIsArray($result); + self::assertIsArray($result); self::assertApiResponseTypeStructure('TimesheetEntity', $result); - $this->assertEmpty($result['description']); - $this->assertEmpty($result['tags']); + self::assertEmpty($result['description']); + self::assertEmpty($result['tags']); $em = $this->getEntityManager(); /** @var Timesheet $timesheet */ $timesheet = $em->getRepository(Timesheet::class)->find($result['id']); - $this->assertInstanceOf(\DateTime::class, $timesheet->getBegin()); - $this->assertNull($timesheet->getEnd()); + self::assertInstanceOf(\DateTime::class, $timesheet->getBegin()); + self::assertNull($timesheet->getEnd()); self::assertEquals(1, $timesheet->getActivity()->getId()); self::assertEquals(1, $timesheet->getProject()->getId()); - $this->assertEmpty($timesheet->getDescription()); - $this->assertEmpty($timesheet->getTags()); + self::assertEmpty($timesheet->getDescription()); + self::assertEmpty($timesheet->getTags()); } public function testRestartActionWithBegin(): void @@ -1231,27 +1231,27 @@ class TimesheetControllerTest extends APIControllerBaseTest $begin = new \DateTime('2019-11-27 13:55:00'); $this->request($client, '/api/timesheets/' . $id . '/restart', 'PATCH', ['begin' => $begin->format(BaseApiController::DATE_FORMAT_PHP)]); - $this->assertTrue($client->getResponse()->isSuccessful()); + self::assertTrue($client->getResponse()->isSuccessful()); $content = $client->getResponse()->getContent(); self::assertIsString($content); $result = json_decode($content, true); - $this->assertIsArray($result); + self::assertIsArray($result); self::assertApiResponseTypeStructure('TimesheetEntity', $result); - $this->assertEmpty($result['description']); - $this->assertEmpty($result['tags']); + self::assertEmpty($result['description']); + self::assertEmpty($result['tags']); $em = $this->getEntityManager(); /** @var Timesheet $timesheet */ $timesheet = $em->getRepository(Timesheet::class)->find($result['id']); - $this->assertInstanceOf(\DateTime::class, $timesheet->getBegin()); + self::assertInstanceOf(\DateTime::class, $timesheet->getBegin()); self::assertEquals($begin->format(BaseApiController::DATE_FORMAT_PHP), $timesheet->getBegin()->format(BaseApiController::DATE_FORMAT_PHP)); - $this->assertNull($timesheet->getEnd()); + self::assertNull($timesheet->getEnd()); self::assertEquals(1, $timesheet->getActivity()->getId()); self::assertEquals(1, $timesheet->getProject()->getId()); - $this->assertEmpty($timesheet->getDescription()); - $this->assertEmpty($timesheet->getTags()); + self::assertEmpty($timesheet->getDescription()); + self::assertEmpty($timesheet->getTags()); } public function testRestartActionWithCopyData(): void @@ -1277,13 +1277,13 @@ class TimesheetControllerTest extends APIControllerBaseTest self::assertEquals('foo', $timesheet->getDescription()); $this->request($client, '/api/timesheets/' . $id . '/restart', 'PATCH', ['copy' => 'all']); - $this->assertTrue($client->getResponse()->isSuccessful()); + self::assertTrue($client->getResponse()->isSuccessful()); $content = $client->getResponse()->getContent(); self::assertIsString($content); $result = json_decode($content, true); - $this->assertIsArray($result); + self::assertIsArray($result); self::assertApiResponseTypeStructure('TimesheetEntity', $result); self::assertEquals('foo', $result['description']); self::assertEquals([['name' => 'sdfsdf', 'value' => 'nnnnn'], ['name' => '1234567890', 'value' => '1234567890']], $result['metaFields']); @@ -1292,8 +1292,8 @@ class TimesheetControllerTest extends APIControllerBaseTest $em = $this->getEntityManager(); /** @var Timesheet $timesheet */ $timesheet = $em->getRepository(Timesheet::class)->find($result['id']); - $this->assertInstanceOf(\DateTime::class, $timesheet->getBegin()); - $this->assertNull($timesheet->getEnd()); + self::assertInstanceOf(\DateTime::class, $timesheet->getBegin()); + self::assertNull($timesheet->getEnd()); self::assertEquals(1, $timesheet->getActivity()->getId()); self::assertEquals(1, $timesheet->getProject()->getId()); self::assertEquals('foo', $timesheet->getDescription()); @@ -1343,7 +1343,7 @@ class TimesheetControllerTest extends APIControllerBaseTest $json = json_encode($data); self::assertIsString($json); $this->request($client, '/api/timesheets', 'POST', [], $json); - $this->assertTrue($client->getResponse()->isSuccessful()); + self::assertTrue($client->getResponse()->isSuccessful()); $content = $client->getResponse()->getContent(); self::assertIsString($content); @@ -1352,12 +1352,12 @@ class TimesheetControllerTest extends APIControllerBaseTest self::assertIsArray($result); self::assertApiResponseTypeStructure('TimesheetEntity', $result); self::assertNotEmpty($result['id']); - $this->assertTrue($result['duration'] == 28800 || $result['duration'] == 28860); // 1 minute rounding might be applied + self::assertTrue($result['duration'] == 28800 || $result['duration'] == 28860); // 1 minute rounding might be applied self::assertEquals(2016, $result['rate']); $id = $result['id']; self::assertIsNumeric($id); $this->request($client, '/api/timesheets/' . $id . '/duplicate', 'PATCH'); - $this->assertTrue($client->getResponse()->isSuccessful()); + self::assertTrue($client->getResponse()->isSuccessful()); $content = $client->getResponse()->getContent(); self::assertIsString($content); @@ -1366,7 +1366,7 @@ class TimesheetControllerTest extends APIControllerBaseTest self::assertIsArray($result); self::assertApiResponseTypeStructure('TimesheetEntity', $result); self::assertNotEmpty($result['id']); - $this->assertTrue($result['duration'] == 28800 || $result['duration'] == 28860); // 1 minute rounding might be applied + self::assertTrue($result['duration'] == 28800 || $result['duration'] == 28860); // 1 minute rounding might be applied self::assertEquals(2016, $result['rate']); } @@ -1384,29 +1384,29 @@ class TimesheetControllerTest extends APIControllerBaseTest $em = $this->getEntityManager(); /** @var Timesheet $timesheet */ $timesheet = $em->getRepository(Timesheet::class)->find($id); - $this->assertFalse($timesheet->isExported()); + self::assertFalse($timesheet->isExported()); $this->request($client, '/api/timesheets/' . $id . '/export', 'PATCH'); - $this->assertTrue($client->getResponse()->isSuccessful()); + self::assertTrue($client->getResponse()->isSuccessful()); $content = $client->getResponse()->getContent(); self::assertIsString($content); $result = json_decode($content, true); - $this->assertIsArray($result); + self::assertIsArray($result); self::assertApiResponseTypeStructure('TimesheetEntity', $result); $em->clear(); /** @var Timesheet $timesheet */ $timesheet = $em->getRepository(Timesheet::class)->find($id); - $this->assertTrue($timesheet->isExported()); + self::assertTrue($timesheet->isExported()); $this->request($client, '/api/timesheets/' . $id . '/export', 'PATCH'); - $this->assertTrue($client->getResponse()->isSuccessful()); + self::assertTrue($client->getResponse()->isSuccessful()); $em->clear(); $timesheet = $em->getRepository(Timesheet::class)->find($id); - $this->assertFalse($timesheet->isExported()); + self::assertFalse($timesheet->isExported()); } public function testExportNotAllowedForUser(): void @@ -1482,13 +1482,13 @@ class TimesheetControllerTest extends APIControllerBaseTest self::assertIsString($json); $this->request($client, '/api/timesheets/' . $id . '/meta', 'PATCH', [], $json); - $this->assertTrue($client->getResponse()->isSuccessful()); + self::assertTrue($client->getResponse()->isSuccessful()); $content = $client->getResponse()->getContent(); self::assertIsString($content); $result = json_decode($content, true); - $this->assertIsArray($result); + self::assertIsArray($result); self::assertApiResponseTypeStructure('TimesheetEntity', $result); self::assertEquals(['name' => 'metatestmock', 'value' => 'another,testing,bar'], $result['metaFields'][0]); diff --git a/tests/API/UserControllerTest.php b/tests/API/UserControllerTest.php index 54bff0d8..40636601 100644 --- a/tests/API/UserControllerTest.php +++ b/tests/API/UserControllerTest.php @@ -14,7 +14,7 @@ use App\Entity\User; /** * @group integration */ -class UserControllerTest extends APIControllerBaseTest +class UserControllerTest extends APIControllerBaseTestCase { public function testIsSecure(): void { @@ -24,7 +24,7 @@ class UserControllerTest extends APIControllerBaseTest /** * @return array<array<string>> */ - public function getRoleTestData(): array + public static function getRoleTestData(): array { return [ [User::ROLE_USER], @@ -46,14 +46,14 @@ class UserControllerTest extends APIControllerBaseTest $client = $this->getClientForAuthenticatedUser(User::ROLE_SUPER_ADMIN); $this->assertAccessIsGranted($client, '/api/users'); $content = $client->getResponse()->getContent(); - $this->assertIsString($content); + self::assertIsString($content); $result = json_decode($content, true); - $this->assertIsArray($result); - $this->assertNotEmpty($result); - $this->assertEquals(7, \count($result)); + self::assertIsArray($result); + self::assertNotEmpty($result); + self::assertEquals(7, \count($result)); foreach ($result as $user) { - $this->assertIsArray($user); + self::assertIsArray($user); self::assertApiResponseTypeStructure('UserCollection', $user); } } @@ -64,14 +64,14 @@ class UserControllerTest extends APIControllerBaseTest $this->assertAccessIsGranted($client, '/api/users?full=true'); $content = $client->getResponse()->getContent(); - $this->assertIsString($content); + self::assertIsString($content); $result = json_decode($content, true); - $this->assertIsArray($result); - $this->assertNotEmpty($result); - $this->assertEquals(7, \count($result)); + self::assertIsArray($result); + self::assertNotEmpty($result); + self::assertEquals(7, \count($result)); foreach ($result as $user) { - $this->assertIsArray($user); + self::assertIsArray($user); self::assertApiResponseTypeStructure('UserEntity', $user); } } @@ -81,14 +81,14 @@ class UserControllerTest extends APIControllerBaseTest $client = $this->getClientForAuthenticatedUser(User::ROLE_SUPER_ADMIN); $this->assertAccessIsGranted($client, '/api/users', 'GET', ['visible' => 2, 'orderBy' => 'email', 'order' => 'DESC', 'term' => 'chris']); $content = $client->getResponse()->getContent(); - $this->assertIsString($content); + self::assertIsString($content); $result = json_decode($content, true); - $this->assertIsArray($result); - $this->assertNotEmpty($result); - $this->assertEquals(1, \count($result)); + self::assertIsArray($result); + self::assertNotEmpty($result); + self::assertEquals(1, \count($result)); foreach ($result as $user) { - $this->assertIsArray($user); + self::assertIsArray($user); self::assertApiResponseTypeStructure('UserCollection', $user); } } @@ -98,14 +98,14 @@ class UserControllerTest extends APIControllerBaseTest $client = $this->getClientForAuthenticatedUser(User::ROLE_SUPER_ADMIN); $this->assertAccessIsGranted($client, '/api/users', 'GET', ['visible' => 3, 'orderBy' => 'email', 'order' => 'DESC']); $content = $client->getResponse()->getContent(); - $this->assertIsString($content); + self::assertIsString($content); $result = json_decode($content, true); - $this->assertIsArray($result); - $this->assertNotEmpty($result); - $this->assertEquals(8, \count($result)); + self::assertIsArray($result); + self::assertNotEmpty($result); + self::assertEquals(8, \count($result)); foreach ($result as $user) { - $this->assertIsArray($user); + self::assertIsArray($user); self::assertApiResponseTypeStructure('UserCollection', $user); } } @@ -115,10 +115,10 @@ class UserControllerTest extends APIControllerBaseTest $client = $this->getClientForAuthenticatedUser(User::ROLE_SUPER_ADMIN); $this->assertAccessIsGranted($client, '/api/users/1'); $content = $client->getResponse()->getContent(); - $this->assertIsString($content); + self::assertIsString($content); $result = json_decode($content, true); - $this->assertIsArray($result); + self::assertIsArray($result); self::assertApiResponseTypeStructure('UserEntity', $result); self::assertEquals('1', $result['id']); self::assertEquals('CFO', $result['title']); @@ -130,10 +130,10 @@ class UserControllerTest extends APIControllerBaseTest $client = $this->getClientForAuthenticatedUser(User::ROLE_SUPER_ADMIN); $this->assertAccessIsGranted($client, '/api/users/me'); $content = $client->getResponse()->getContent(); - $this->assertIsString($content); + self::assertIsString($content); $result = json_decode($content, true); - $this->assertIsArray($result); + self::assertIsArray($result); self::assertApiResponseTypeStructure('UserEntity', $result); self::assertEquals('6', $result['id']); self::assertEquals('Super Administrator', $result['title']); @@ -156,10 +156,10 @@ class UserControllerTest extends APIControllerBaseTest $client = $this->getClientForAuthenticatedUser(User::ROLE_USER); $this->assertAccessIsGranted($client, '/api/users/2'); $content = $client->getResponse()->getContent(); - $this->assertIsString($content); + self::assertIsString($content); $result = json_decode($content, true); - $this->assertIsArray($result); + self::assertIsArray($result); self::assertApiResponseTypeStructure('UserEntity', $result); } @@ -181,14 +181,14 @@ class UserControllerTest extends APIControllerBaseTest ], ]; $this->request($client, '/api/users', 'POST', [], json_encode($data)); - $this->assertTrue($client->getResponse()->isSuccessful()); + self::assertTrue($client->getResponse()->isSuccessful()); $content = $client->getResponse()->getContent(); - $this->assertIsString($content); + self::assertIsString($content); $result = json_decode($content, true); - $this->assertIsArray($result); + self::assertIsArray($result); self::assertApiResponseTypeStructure('UserEntity', $result); - $this->assertNotEmpty($result['id']); + self::assertNotEmpty($result['id']); self::assertEquals('foo', $result['username']); self::assertEquals('asdfghjkl', $result['title']); self::assertTrue($result['enabled']); @@ -216,7 +216,7 @@ class UserControllerTest extends APIControllerBaseTest $this->request($client, '/api/users', 'POST', [], json_encode($data)); $response = $client->getResponse(); - $this->assertEquals(400, $response->getStatusCode()); + self::assertEquals(400, $response->getStatusCode()); $this->assertApiCallValidationError($response, ['plainPassword']); } @@ -236,7 +236,7 @@ class UserControllerTest extends APIControllerBaseTest $this->request($client, '/api/users', 'POST', [], json_encode($data)); $response = $client->getResponse(); - $this->assertEquals(400, $response->getStatusCode()); + self::assertEquals(400, $response->getStatusCode()); $this->assertApiCallValidationError($response, ['username', 'email', 'plainPassword', 'language', 'timezone', 'roles']); } @@ -272,9 +272,9 @@ class UserControllerTest extends APIControllerBaseTest ], ]; $this->request($client, '/api/users', 'POST', [], json_encode($data)); - $this->assertTrue($client->getResponse()->isSuccessful()); + self::assertTrue($client->getResponse()->isSuccessful()); $content = $client->getResponse()->getContent(); - $this->assertIsString($content); + self::assertIsString($content); $result = json_decode($content, true); self::assertFalse($result['enabled']); @@ -290,14 +290,14 @@ class UserControllerTest extends APIControllerBaseTest $id = $result['id']; self::assertIsNumeric($id); $this->request($client, '/api/users/' . $id, 'PATCH', [], json_encode($data)); - $this->assertTrue($client->getResponse()->isSuccessful()); + self::assertTrue($client->getResponse()->isSuccessful()); $content = $client->getResponse()->getContent(); - $this->assertIsString($content); + self::assertIsString($content); $result = json_decode($content, true); - $this->assertIsArray($result); + self::assertIsArray($result); self::assertApiResponseTypeStructure('UserEntity', $result); - $this->assertNotEmpty($result['id']); + self::assertNotEmpty($result['id']); self::assertEquals('foo', $result['username']); self::assertEquals('qwertzui', $result['title']); self::assertTrue($result['enabled']); @@ -335,7 +335,7 @@ class UserControllerTest extends APIControllerBaseTest $this->request($client, '/api/users/1', 'PATCH', [], json_encode($data)); $response = $client->getResponse(); - $this->assertEquals(400, $response->getStatusCode()); + self::assertEquals(400, $response->getStatusCode()); $this->assertApiCallValidationError($response, ['email', 'language', 'timezone', 'roles'], true); } } diff --git a/tests/Calendar/CalendarSourceTest.php b/tests/Calendar/CalendarSourceTest.php index 55ce3e54..45a0c5d6 100644 --- a/tests/Calendar/CalendarSourceTest.php +++ b/tests/Calendar/CalendarSourceTest.php @@ -25,17 +25,17 @@ class CalendarSourceTest extends TestCase $sut->addOption('hello', false); $sut->addOption('world', 123); - $this->assertEquals(CalendarSourceType::JSON, $sut->getType()); - $this->assertEquals('json', $sut->getTypeName()); - $this->assertEquals('0815', $sut->getId()); - $this->assertEquals('askdjfhlaksjdhflaksjhdflkjasdlkfjh', $sut->getUri()); - $this->assertEquals('#fffccc', $sut->getColor()); - $this->assertEquals(['foo' => 'bar', 'hello' => false, 'world' => 123], $sut->getOptions()); + self::assertEquals(CalendarSourceType::JSON, $sut->getType()); + self::assertEquals('json', $sut->getTypeName()); + self::assertEquals('0815', $sut->getId()); + self::assertEquals('askdjfhlaksjdhflaksjhdflkjasdlkfjh', $sut->getUri()); + self::assertEquals('#fffccc', $sut->getColor()); + self::assertEquals(['foo' => 'bar', 'hello' => false, 'world' => 123], $sut->getOptions()); $sut = new CalendarSource(CalendarSourceType::TIMESHEET, '0815', 'askdjfhlaksjdhflaksjhdflkjasdlkfjh', null); - $this->assertEquals('0815', $sut->getId()); - $this->assertEquals('askdjfhlaksjdhflaksjhdflkjasdlkfjh', $sut->getUri()); - $this->assertNull($sut->getColor()); + self::assertEquals('0815', $sut->getId()); + self::assertEquals('askdjfhlaksjdhflaksjhdflkjasdlkfjh', $sut->getUri()); + self::assertNull($sut->getColor()); } } diff --git a/tests/Calendar/GoogleSourceTest.php b/tests/Calendar/GoogleSourceTest.php index ce92e64d..2c500704 100644 --- a/tests/Calendar/GoogleSourceTest.php +++ b/tests/Calendar/GoogleSourceTest.php @@ -21,14 +21,14 @@ class GoogleSourceTest extends TestCase { $sut = new GoogleSource('0815', 'askdjfhlaksjdhflaksjhdflkjasdlkfjh', '#fffccc'); - $this->assertEquals('0815', $sut->getId()); - $this->assertEquals('askdjfhlaksjdhflaksjhdflkjasdlkfjh', $sut->getUri()); - $this->assertEquals('#fffccc', $sut->getColor()); + self::assertEquals('0815', $sut->getId()); + self::assertEquals('askdjfhlaksjdhflaksjhdflkjasdlkfjh', $sut->getUri()); + self::assertEquals('#fffccc', $sut->getColor()); $sut = new GoogleSource('0815', 'askdjfhlaksjdhflaksjhdflkjasdlkfjh', null); - $this->assertEquals('0815', $sut->getId()); - $this->assertEquals('askdjfhlaksjdhflaksjhdflkjasdlkfjh', $sut->getUri()); - $this->assertNull($sut->getColor()); + self::assertEquals('0815', $sut->getId()); + self::assertEquals('askdjfhlaksjdhflaksjhdflkjasdlkfjh', $sut->getUri()); + self::assertNull($sut->getColor()); } } diff --git a/tests/Calendar/GoogleTest.php b/tests/Calendar/GoogleTest.php index 0e8d51be..70c7ebb3 100644 --- a/tests/Calendar/GoogleTest.php +++ b/tests/Calendar/GoogleTest.php @@ -27,12 +27,12 @@ class GoogleTest extends TestCase $sut = new Google('qwertzuiop1234567890'); - $this->assertEquals([], $sut->getSources()); - $this->assertEquals('qwertzuiop1234567890', $sut->getApiKey()); + self::assertEquals([], $sut->getSources()); + self::assertEquals('qwertzuiop1234567890', $sut->getApiKey()); $sut = new Google('ewa6347865fg908ouhpoihui7f56', $sources); - $this->assertEquals($sources, $sut->getSources()); - $this->assertEquals('ewa6347865fg908ouhpoihui7f56', $sut->getApiKey()); + self::assertEquals($sources, $sut->getSources()); + self::assertEquals('ewa6347865fg908ouhpoihui7f56', $sut->getApiKey()); } } diff --git a/tests/Calendar/RecentActivitiesSourceTest.php b/tests/Calendar/RecentActivitiesSourceTest.php index f651f8e8..41315f83 100644 --- a/tests/Calendar/RecentActivitiesSourceTest.php +++ b/tests/Calendar/RecentActivitiesSourceTest.php @@ -25,12 +25,12 @@ class RecentActivitiesSourceTest extends TestCase $sut = new RecentActivitiesSource($entries); - $this->assertEquals('calendar/drag-drop.html.twig', $sut->getBlockInclude()); - $this->assertSame($entries, $sut->getEntries()); - $this->assertEquals('POST', $sut->getMethod()); - $this->assertEquals('post_timesheet', $sut->getRoute()); - $this->assertEquals(['full' => 'true'], $sut->getRouteParams()); - $this->assertEquals([], $sut->getRouteReplacer()); - $this->assertEquals('recent.activities', $sut->getTitle()); + self::assertEquals('calendar/drag-drop.html.twig', $sut->getBlockInclude()); + self::assertSame($entries, $sut->getEntries()); + self::assertEquals('POST', $sut->getMethod()); + self::assertEquals('post_timesheet', $sut->getRoute()); + self::assertEquals(['full' => 'true'], $sut->getRouteParams()); + self::assertEquals([], $sut->getRouteReplacer()); + self::assertEquals('recent.activities', $sut->getTitle()); } } diff --git a/tests/Calendar/TimesheetEntryTest.php b/tests/Calendar/TimesheetEntryTest.php index 035f5f9c..44dcbd98 100644 --- a/tests/Calendar/TimesheetEntryTest.php +++ b/tests/Calendar/TimesheetEntryTest.php @@ -41,12 +41,12 @@ class TimesheetEntryTest extends TestCase $sut = new TimesheetEntry($timesheet, '#cccccc'); - $this->assertEquals('a wonderful activity!!', $sut->getTitle()); - $this->assertEquals('#cccccc', $sut->getColor()); - $this->assertSame($project, $sut->getProject()); - $this->assertSame($activity, $sut->getActivity()); - $this->assertEquals('dd_timesheet', $sut->getBlockName()); - $this->assertEquals($expectedData, $sut->getData()); + self::assertEquals('a wonderful activity!!', $sut->getTitle()); + self::assertEquals('#cccccc', $sut->getColor()); + self::assertSame($project, $sut->getProject()); + self::assertSame($activity, $sut->getActivity()); + self::assertEquals('dd_timesheet', $sut->getBlockName()); + self::assertEquals($expectedData, $sut->getData()); $expectedData = [ 'activity' => null, @@ -57,7 +57,7 @@ class TimesheetEntryTest extends TestCase $sut = new TimesheetEntry($timesheet, '#cccccc', true); - $this->assertEquals($expectedData, $sut->getData()); + self::assertEquals($expectedData, $sut->getData()); } public function testEmpty(): void @@ -71,11 +71,11 @@ class TimesheetEntryTest extends TestCase $sut = new TimesheetEntry($timesheet, '#ddd'); - $this->assertEquals('', $sut->getTitle()); - $this->assertEquals('#ddd', $sut->getColor()); - $this->assertNull($sut->getProject()); - $this->assertNull($sut->getActivity()); - $this->assertEquals($expectedData, $sut->getData()); + self::assertEquals('', $sut->getTitle()); + self::assertEquals('#ddd', $sut->getColor()); + self::assertNull($sut->getProject()); + self::assertNull($sut->getActivity()); + self::assertEquals($expectedData, $sut->getData()); } public function testGetTitle(): void diff --git a/tests/Command/ActivateUserCommandTest.php b/tests/Command/ActivateUserCommandTest.php index 759e77f6..e79becac 100644 --- a/tests/Command/ActivateUserCommandTest.php +++ b/tests/Command/ActivateUserCommandTest.php @@ -70,7 +70,7 @@ class ActivateUserCommandTest extends KernelTestCase $commandTester = $this->callCommand('chris_user'); $output = $commandTester->getDisplay(); - $this->assertStringContainsString('[OK] User "chris_user" has been activated.', $output); + self::assertStringContainsString('[OK] User "chris_user" has been activated.', $output); $container = self::$kernel->getContainer(); /** @var Registry $doctrine */ @@ -87,7 +87,7 @@ class ActivateUserCommandTest extends KernelTestCase $commandTester = $this->callCommand('susan_super'); $output = $commandTester->getDisplay(); - $this->assertStringContainsString('[WARNING] User "susan_super" is already active.', $output); + self::assertStringContainsString('[WARNING] User "susan_super" is already active.', $output); } public function testWithMissingUsername(): void diff --git a/tests/Command/ChangePasswordCommandTest.php b/tests/Command/ChangePasswordCommandTest.php index 9702a5aa..971ab3cc 100644 --- a/tests/Command/ChangePasswordCommandTest.php +++ b/tests/Command/ChangePasswordCommandTest.php @@ -86,7 +86,7 @@ class ChangePasswordCommandTest extends KernelTestCase $commandTester = $this->callCommand('john_user', '0987654321'); $output = $commandTester->getDisplay(); - $this->assertStringContainsString('[OK] Changed password for user "john_user".', $output); + self::assertStringContainsString('[OK] Changed password for user "john_user".', $output); /** @var Registry $doctrine */ $doctrine = self::getContainer()->get('doctrine'); @@ -105,7 +105,7 @@ class ChangePasswordCommandTest extends KernelTestCase $commandTester = $this->callCommand('john_user', '1'); $output = $commandTester->getDisplay(); - $this->assertStringContainsString('[ERROR] plainPassword: This value is too short.', $output); + self::assertStringContainsString('[ERROR] plainPassword: This value is too short.', $output); } public function testWithMissingUsername(): void @@ -120,6 +120,6 @@ class ChangePasswordCommandTest extends KernelTestCase { $commandTester = $this->callCommand('john_user', null); $output = $commandTester->getDisplay(); - $this->assertStringContainsString('[OK] Changed password for user "john_user".', $output); + self::assertStringContainsString('[OK] Changed password for user "john_user".', $output); } } diff --git a/tests/Command/CreateUserCommandTest.php b/tests/Command/CreateUserCommandTest.php index 66843dc8..a263b321 100644 --- a/tests/Command/CreateUserCommandTest.php +++ b/tests/Command/CreateUserCommandTest.php @@ -42,7 +42,7 @@ class CreateUserCommandTest extends KernelTestCase $commandTester = $this->createUser('MyTestUser', 'user@example.com', 'ROLE_USER', 'foobar'); $output = $commandTester->getDisplay(); - $this->assertStringContainsString('[ERROR] plainPassword: This value is too short.', $output); + self::assertStringContainsString('[ERROR] plainPassword: This value is too short.', $output); } public function testCreateUser(): void @@ -50,7 +50,7 @@ class CreateUserCommandTest extends KernelTestCase $commandTester = $this->createUser('MyTestUser', 'user@example.com', 'ROLE_USER', 'foobar12'); $output = $commandTester->getDisplay(); - $this->assertStringContainsString('[OK] Success! Created user: MyTestUser', $output); + self::assertStringContainsString('[OK] Success! Created user: MyTestUser', $output); $container = self::$kernel->getContainer(); /** @var Registry $doctrine */ @@ -80,9 +80,9 @@ class CreateUserCommandTest extends KernelTestCase { $commandTester = $this->createUser('xx', '', 'ROLE_USER', ''); $output = $commandTester->getDisplay(); - $this->assertStringContainsString('[ERROR] email: This value should not be blank', $output); - $this->assertStringContainsString('[ERROR] plainPassword: This value should not be blank', $output); - $this->assertStringContainsString('[ERROR] plainPassword: This value is too short.', $output); + self::assertStringContainsString('[ERROR] email: This value should not be blank', $output); + self::assertStringContainsString('[ERROR] plainPassword: This value should not be blank', $output); + self::assertStringContainsString('[ERROR] plainPassword: This value is too short.', $output); } public function testUserAlreadyExisting(): void @@ -91,7 +91,7 @@ class CreateUserCommandTest extends KernelTestCase $commandTester = $this->createUser('MyTestUser', 'user2@example.com', 'ROLE_USER', 'foobar123'); $output = $commandTester->getDisplay(); - $this->assertStringContainsString('[ERROR] username: The username is already used.', $output); + self::assertStringContainsString('[ERROR] username: The username is already used.', $output); } public function testEmailAlreadyExisting(): void @@ -100,7 +100,7 @@ class CreateUserCommandTest extends KernelTestCase $commandTester = $this->createUser('MyTestUser2', 'user@example.com', 'ROLE_USER', 'foobar'); $output = $commandTester->getDisplay(); - $this->assertStringContainsString('[ERROR] email: This e-mail address is already in use.', $output); + self::assertStringContainsString('[ERROR] email: This e-mail address is already in use.', $output); } public function testUserEmail(): void @@ -108,6 +108,6 @@ class CreateUserCommandTest extends KernelTestCase $commandTester = $this->createUser('MyTestUser', 'ROLE_USER', 'ROLE_USER', 'foobar12'); $output = $commandTester->getDisplay(); - $this->assertStringContainsString('[ERROR] email: This value is not a valid email address', $output); + self::assertStringContainsString('[ERROR] email: This value is not a valid email address', $output); } } diff --git a/tests/Command/DeactivateUserCommandTest.php b/tests/Command/DeactivateUserCommandTest.php index 7cc03327..0a28ca90 100644 --- a/tests/Command/DeactivateUserCommandTest.php +++ b/tests/Command/DeactivateUserCommandTest.php @@ -69,7 +69,7 @@ class DeactivateUserCommandTest extends KernelTestCase $commandTester = $this->callCommand('john_user'); $output = $commandTester->getDisplay(); - $this->assertStringContainsString('[OK] User "john_user" has been deactivated.', $output); + self::assertStringContainsString('[OK] User "john_user" has been deactivated.', $output); $container = self::$kernel->getContainer(); /** @var Registry $doctrine */ @@ -86,7 +86,7 @@ class DeactivateUserCommandTest extends KernelTestCase $commandTester = $this->callCommand('chris_user'); $output = $commandTester->getDisplay(); - $this->assertStringContainsString('[WARNING] User "chris_user" is already deactivated.', $output); + self::assertStringContainsString('[WARNING] User "chris_user" is already deactivated.', $output); } public function testWithMissingUsername(): void diff --git a/tests/Command/DemoteUserCommandTest.php b/tests/Command/DemoteUserCommandTest.php index 05c4b1d6..83896fc4 100644 --- a/tests/Command/DemoteUserCommandTest.php +++ b/tests/Command/DemoteUserCommandTest.php @@ -79,7 +79,7 @@ class DemoteUserCommandTest extends KernelTestCase $commandTester = $this->callCommand('tony_teamlead', 'ROLE_TEAMLEAD'); $output = $commandTester->getDisplay(); - $this->assertStringContainsString('[OK] Role "ROLE_TEAMLEAD" has been removed from user "tony_teamlead".', $output); + self::assertStringContainsString('[OK] Role "ROLE_TEAMLEAD" has been removed from user "tony_teamlead".', $output); $container = self::$kernel->getContainer(); /** @var Registry $doctrine */ @@ -96,7 +96,7 @@ class DemoteUserCommandTest extends KernelTestCase $commandTester = $this->callCommand('susan_super', null, true); $output = $commandTester->getDisplay(); - $this->assertStringContainsString('[OK] Super administrator role has been removed from the user "susan_super".', $output); + self::assertStringContainsString('[OK] Super administrator role has been removed from the user "susan_super".', $output); $container = self::$kernel->getContainer(); /** @var Registry $doctrine */ @@ -113,7 +113,7 @@ class DemoteUserCommandTest extends KernelTestCase $commandTester = $this->callCommand('tony_teamlead', null, true); $output = $commandTester->getDisplay(); - $this->assertStringContainsString('[WARNING] User "tony_teamlead" doesn\'t have the super administrator role.', $output); + self::assertStringContainsString('[WARNING] User "tony_teamlead" doesn\'t have the super administrator role.', $output); } public function testDemoteAdminFailsOnTeamlead(): void @@ -121,7 +121,7 @@ class DemoteUserCommandTest extends KernelTestCase $commandTester = $this->callCommand('tony_teamlead', 'ROLE_ADMIN', false); $output = $commandTester->getDisplay(); - $this->assertStringContainsString('[WARNING] User "tony_teamlead" didn\'t have "ROLE_ADMIN" role.', $output); + self::assertStringContainsString('[WARNING] User "tony_teamlead" didn\'t have "ROLE_ADMIN" role.', $output); } public function testDemoteRoleAndSuperFails(): void diff --git a/tests/Command/ExportCreateCommandTest.php b/tests/Command/ExportCreateCommandTest.php index 63bd9e56..a06368e7 100644 --- a/tests/Command/ExportCreateCommandTest.php +++ b/tests/Command/ExportCreateCommandTest.php @@ -122,7 +122,7 @@ class ExportCreateCommandTest extends KernelTestCase $commandTester = $this->createExport($options); $output = $commandTester->getDisplay(); - $this->assertStringContainsString('[ERROR] ' . $errorMessage, $output); + self::assertStringContainsString('[ERROR] ' . $errorMessage, $output); } protected function assertCommandResult(array $options = [], string $message = ''): void @@ -130,7 +130,7 @@ class ExportCreateCommandTest extends KernelTestCase $commandTester = $this->createExport($options); $output = $commandTester->getDisplay(); - $this->assertStringContainsString('[OK] ' . $message, $output); + self::assertStringContainsString('[OK] ' . $message, $output); } public function testCreateWithUnknownExportFilter(): void @@ -179,7 +179,7 @@ class ExportCreateCommandTest extends KernelTestCase $commandTester = $this->createExport($options); $output = $commandTester->getDisplay(); - $this->assertStringContainsString('[OK] No entries found, skipping', $output); + self::assertStringContainsString('[OK] No entries found, skipping', $output); } /** @@ -217,7 +217,7 @@ class ExportCreateCommandTest extends KernelTestCase $commandTester = $this->createExport(['--template' => 'csv', '--customer' => [$data[0]->getId()], '--start' => $start->format('Y-m-d'), '--end' => $end->format('Y-m-d'), '--username' => UserFixtures::USERNAME_SUPER_ADMIN]); $output = $commandTester->getDisplay(); - $this->assertStringContainsString('Saved export to: ', $output); + self::assertStringContainsString('Saved export to: ', $output); } public function testCreateExportByProject(): void @@ -230,7 +230,7 @@ class ExportCreateCommandTest extends KernelTestCase $commandTester = $this->createExport(['--template' => 'csv', '--project' => [$data[1][0]->getId()], '--start' => $start->format('Y-m-d'), '--end' => $end->format('Y-m-d')]); $output = $commandTester->getDisplay(); - $this->assertStringContainsString('Saved export to: ', $output); + self::assertStringContainsString('Saved export to: ', $output); } public function testCreateExportWithEmail(): void @@ -252,7 +252,7 @@ class ExportCreateCommandTest extends KernelTestCase ])); $output = $commandTester->getDisplay(); - $this->assertStringContainsString('Send email with report to: foo@example.com', $output); - $this->assertStringContainsString('Send email with report to: foo2@example.com', $output); + self::assertStringContainsString('Send email with report to: foo@example.com', $output); + self::assertStringContainsString('Send email with report to: foo2@example.com', $output); } } diff --git a/tests/Command/InvoiceCreateCommandTest.php b/tests/Command/InvoiceCreateCommandTest.php index 48a6cd2a..135f8cf9 100644 --- a/tests/Command/InvoiceCreateCommandTest.php +++ b/tests/Command/InvoiceCreateCommandTest.php @@ -108,7 +108,7 @@ class InvoiceCreateCommandTest extends KernelTestCase $commandTester = $this->createInvoice($options); $output = $commandTester->getDisplay(); - $this->assertStringContainsString('[ERROR] ' . $errorMessage, $output); + self::assertStringContainsString('[ERROR] ' . $errorMessage, $output); } public function testCreateWithUnknownExportFilter(): void @@ -174,13 +174,13 @@ class InvoiceCreateCommandTest extends KernelTestCase $commandTester = $this->createInvoice(['--user' => UserFixtures::USERNAME_SUPER_ADMIN, '--customer' => 1, '--template' => 'Invoice', '--start' => '2020-01-01', '--end' => '2020-03-01']); $output = $commandTester->getDisplay(); - $this->assertStringContainsString('Created 1 invoice(s)', $output); - $this->assertStringContainsString('| ID', $output); - $this->assertStringContainsString('| Customer', $output); - $this->assertStringContainsString('| Total', $output); - $this->assertStringContainsString('| Filename', $output); - $this->assertStringContainsString('0 EUR', $output); - $this->assertStringContainsString('/tests/_data/invoices/' . ((new \DateTime())->format('Y')) . '-001-Test.html |', $output); + self::assertStringContainsString('Created 1 invoice(s)', $output); + self::assertStringContainsString('| ID', $output); + self::assertStringContainsString('| Customer', $output); + self::assertStringContainsString('| Total', $output); + self::assertStringContainsString('| Filename', $output); + self::assertStringContainsString('0 EUR', $output); + self::assertStringContainsString('/tests/_data/invoices/' . ((new \DateTime())->format('Y')) . '-001-Test.html |', $output); } /** @@ -224,7 +224,7 @@ class InvoiceCreateCommandTest extends KernelTestCase $commandTester = $this->createInvoice(['--user' => UserFixtures::USERNAME_SUPER_ADMIN, '--by-customer' => null, '--start' => $start->format('Y-m-d'), '--end' => $end->format('Y-m-d')]); $output = $commandTester->getDisplay(); - $this->assertStringContainsString('Created 1 invoice(s) ', $output); + self::assertStringContainsString('Created 1 invoice(s) ', $output); } public function testCreateInvoiceByCustomerId(): void @@ -238,7 +238,7 @@ class InvoiceCreateCommandTest extends KernelTestCase $commandTester = $this->createInvoice(['--user' => UserFixtures::USERNAME_SUPER_ADMIN, '--customer' => $customer . ',1', '--start' => $start->format('Y-m-d'), '--end' => $end->format('Y-m-d')]); $output = $commandTester->getDisplay(); - $this->assertStringContainsString('Created 1 invoice(s) ', $output); + self::assertStringContainsString('Created 1 invoice(s) ', $output); } public function testCreateInvoiceByProject(): void @@ -251,7 +251,7 @@ class InvoiceCreateCommandTest extends KernelTestCase $commandTester = $this->createInvoice(['--user' => UserFixtures::USERNAME_SUPER_ADMIN, '--exported' => 'all', '--by-project' => null, '--start' => $start->format('Y-m-d'), '--end' => $end->format('Y-m-d')]); $output = $commandTester->getDisplay(); - $this->assertStringContainsString('Created 1 invoice(s) ', $output); + self::assertStringContainsString('Created 1 invoice(s) ', $output); } public function testCreateInvoiceByProjectId(): void @@ -264,7 +264,7 @@ class InvoiceCreateCommandTest extends KernelTestCase $commandTester = $this->createInvoice(['--user' => UserFixtures::USERNAME_SUPER_ADMIN, '--exported' => 'all', '--project' => '1', '--template' => 'Invoice', '--start' => $start->format('Y-m-d'), '--end' => $end->format('Y-m-d')]); $output = $commandTester->getDisplay(); - $this->assertStringContainsString('Created 1 invoice(s) ', $output); + self::assertStringContainsString('Created 1 invoice(s) ', $output); } public function testCreateInvoiceByProjectWithPreview(): void @@ -277,6 +277,6 @@ class InvoiceCreateCommandTest extends KernelTestCase $commandTester = $this->createInvoice(['--user' => UserFixtures::USERNAME_SUPER_ADMIN, '--exported' => 'all', '--preview' => sys_get_temp_dir(), '--by-project' => null, '--start' => $start->format('Y-m-d'), '--end' => $end->format('Y-m-d')]); $output = $commandTester->getDisplay(); - $this->assertStringContainsString('Created 1 invoice(s) ', $output); + self::assertStringContainsString('Created 1 invoice(s) ', $output); } } diff --git a/tests/Command/ListUserCommandTest.php b/tests/Command/ListUserCommandTest.php index 92ecffd2..b20f1ad2 100644 --- a/tests/Command/ListUserCommandTest.php +++ b/tests/Command/ListUserCommandTest.php @@ -25,8 +25,8 @@ class ListUserCommandTest extends KernelTestCase { $commandTester = $this->getCommandTester(); $output = $commandTester->getDisplay(); - $this->assertStringContainsString('Username Email Roles Active Authenticator', $output); - $this->assertStringContainsString('---------- ------- ------- -------- -------------', $output); + self::assertStringContainsString('Username Email Roles Active Authenticator', $output); + self::assertStringContainsString('---------- ------- ------- -------- -------------', $output); } protected function getCommandTester(): CommandTester diff --git a/tests/Command/PluginCommandTest.php b/tests/Command/PluginCommandTest.php index 8561fae5..3ceb6ce8 100644 --- a/tests/Command/PluginCommandTest.php +++ b/tests/Command/PluginCommandTest.php @@ -33,9 +33,9 @@ class PluginCommandTest extends KernelTestCase $commandTester = $this->getCommandTester([$plugin1], []); $output = $commandTester->getDisplay(); - $this->assertStringContainsString(__DIR__, $output); - $this->assertStringContainsString('Plugin/Fixtures/TestPlugin', $output); - $this->assertStringContainsString('TestPlugin from composer.json', $output); + self::assertStringContainsString(__DIR__, $output); + self::assertStringContainsString('Plugin/Fixtures/TestPlugin', $output); + self::assertStringContainsString('TestPlugin from composer.json', $output); } private function getCommandTester(array $plugins, array $options = []): CommandTester diff --git a/tests/Command/PromoteUserCommandTest.php b/tests/Command/PromoteUserCommandTest.php index 0a1a7c69..af873ff3 100644 --- a/tests/Command/PromoteUserCommandTest.php +++ b/tests/Command/PromoteUserCommandTest.php @@ -36,7 +36,7 @@ class PromoteUserCommandTest extends KernelTestCase $container = self::$kernel->getContainer(); $userService = $container->get(UserService::class); - $this->assertInstanceOf(UserService::class, $userService); + self::assertInstanceOf(UserService::class, $userService); $this->application->add(new PromoteUserCommand($userService)); } @@ -79,7 +79,7 @@ class PromoteUserCommandTest extends KernelTestCase $commandTester = $this->callCommand('john_user', 'ROLE_TEAMLEAD'); $output = $commandTester->getDisplay(); - $this->assertStringContainsString('[OK] Role "ROLE_TEAMLEAD" has been added to user "john_user".', $output); + self::assertStringContainsString('[OK] Role "ROLE_TEAMLEAD" has been added to user "john_user".', $output); $container = self::$kernel->getContainer(); /** @var Registry $doctrine */ @@ -96,7 +96,7 @@ class PromoteUserCommandTest extends KernelTestCase $commandTester = $this->callCommand('john_user', null, true); $output = $commandTester->getDisplay(); - $this->assertStringContainsString('[OK] User "john_user" has been promoted as a super administrator.', $output); + self::assertStringContainsString('[OK] User "john_user" has been promoted as a super administrator.', $output); $container = self::$kernel->getContainer(); /** @var Registry $doctrine */ @@ -113,7 +113,7 @@ class PromoteUserCommandTest extends KernelTestCase $commandTester = $this->callCommand('susan_super', null, true); $output = $commandTester->getDisplay(); - $this->assertStringContainsString('[WARNING] User "susan_super" does already have the super administrator role.', $output); + self::assertStringContainsString('[WARNING] User "susan_super" does already have the super administrator role.', $output); } public function testPromoteTeamleadFailsOnTeamlead(): void @@ -121,7 +121,7 @@ class PromoteUserCommandTest extends KernelTestCase $commandTester = $this->callCommand('tony_teamlead', 'ROLE_TEAMLEAD', false); $output = $commandTester->getDisplay(); - $this->assertStringContainsString('[WARNING] User "tony_teamlead" did already have "ROLE_TEAMLEAD" role.', $output); + self::assertStringContainsString('[WARNING] User "tony_teamlead" did already have "ROLE_TEAMLEAD" role.', $output); } public function testPromoteRoleAndSuperFails(): void diff --git a/tests/Command/VersionCommandTest.php b/tests/Command/VersionCommandTest.php index bb797eb8..05f686d3 100644 --- a/tests/Command/VersionCommandTest.php +++ b/tests/Command/VersionCommandTest.php @@ -39,10 +39,10 @@ class VersionCommandTest extends KernelTestCase { $commandTester = $this->getCommandTester($options); $output = $commandTester->getDisplay(); - $this->assertEquals($result . PHP_EOL, $output); + self::assertEquals($result . PHP_EOL, $output); } - public function getTestData(): array // @phpstan-ignore missingType.iterableValue + public static function getTestData(): array // @phpstan-ignore missingType.iterableValue { return [ [[], 'Kimai ' . Constants::VERSION . ' by Kevin Papst.'], diff --git a/tests/Configuration/LdapConfigurationTest.php b/tests/Configuration/LdapConfigurationTest.php index d0e787b9..1c1ae76b 100644 --- a/tests/Configuration/LdapConfigurationTest.php +++ b/tests/Configuration/LdapConfigurationTest.php @@ -45,18 +45,18 @@ class LdapConfigurationTest extends TestCase public function testDefault(): void { $sut = $this->getSut([]); - $this->assertFalse($sut->isActivated()); - $this->assertEquals([], $sut->getUserParameters()); - $this->assertEquals([], $sut->getRoleParameters()); - $this->assertEquals([], $sut->getConnectionParameters()); + self::assertFalse($sut->isActivated()); + self::assertEquals([], $sut->getUserParameters()); + self::assertEquals([], $sut->getRoleParameters()); + self::assertEquals([], $sut->getConnectionParameters()); } public function testMapping(): void { $sut = $this->getSut($this->getDefaultSettings()); - $this->assertTrue($sut->isActivated()); - $this->assertEquals(['foo' => 'bar'], $sut->getUserParameters()); - $this->assertEquals(['bar' => 'foo'], $sut->getRoleParameters()); - $this->assertEquals(['host' => '1.2.3.4'], $sut->getConnectionParameters()); + self::assertTrue($sut->isActivated()); + self::assertEquals(['foo' => 'bar'], $sut->getUserParameters()); + self::assertEquals(['bar' => 'foo'], $sut->getRoleParameters()); + self::assertEquals(['host' => '1.2.3.4'], $sut->getConnectionParameters()); } } diff --git a/tests/Configuration/LocaleServiceTest.php b/tests/Configuration/LocaleServiceTest.php index d7818af3..094ee93c 100644 --- a/tests/Configuration/LocaleServiceTest.php +++ b/tests/Configuration/LocaleServiceTest.php @@ -106,10 +106,10 @@ class LocaleServiceTest extends TestCase public function testGetAllLocales(): void { $sut = $this->getSut([]); - $this->assertEquals([], $sut->getAllLocales()); + self::assertEquals([], $sut->getAllLocales()); $sut = $this->getSut($this->getDefaultSettings()); - $this->assertEquals(['de', 'en', 'en_AU', 'pt_BR', 'it', 'fr', 'fr_BE', 'fr_CA', 'es', 'ru', 'ar', 'hu'], $sut->getAllLocales()); + self::assertEquals(['de', 'en', 'en_AU', 'pt_BR', 'it', 'fr', 'fr_BE', 'fr_CA', 'es', 'ru', 'ar', 'hu'], $sut->getAllLocales()); } public function testInvalidLocaleWithGivenLocale(): void @@ -124,26 +124,26 @@ class LocaleServiceTest extends TestCase public function testGetDurationFormat(): void { $sut = $this->getSut($this->getDefaultSettings()); - $this->assertEquals('%h:%m', $sut->getDurationFormat('de')); + self::assertEquals('%h:%m', $sut->getDurationFormat('de')); } public function testGetDateFormat(): void { $sut = $this->getSut($this->getDefaultSettings()); - $this->assertEquals('d.m.Y', $sut->getDateFormat('de')); + self::assertEquals('d.m.Y', $sut->getDateFormat('de')); } public function testGetDateTimeFormat(): void { $sut = $this->getSut($this->getDefaultSettings()); - $this->assertEquals('d.m.Y H:i', $sut->getDateTimeFormat('de')); + self::assertEquals('d.m.Y H:i', $sut->getDateTimeFormat('de')); } public function testGetTimeFormat(): void { $sut = $this->getSut($this->getDefaultSettings()); - $this->assertEquals('H:i', $sut->getTimeFormat('de')); - $this->assertEquals('H:i:s', $sut->getTimeFormat('en')); + self::assertEquals('H:i', $sut->getTimeFormat('de')); + self::assertEquals('H:i:s', $sut->getTimeFormat('en')); } /** @@ -153,13 +153,13 @@ class LocaleServiceTest extends TestCase { $sut = $this->getSut($this->getDefaultSettings()); $actual = $sut->getNearestTranslationLocale($locale); - $this->assertEquals($expected, $actual); + self::assertEquals($expected, $actual); } /** * @return array<int, array<int, string>> */ - public function getNearestTranslationLocaleData(): array + public static function getNearestTranslationLocaleData(): array { return [ ['de', 'de'], // registered and translated: use it diff --git a/tests/Configuration/SamlConfigurationTest.php b/tests/Configuration/SamlConfigurationTest.php index 74396c78..013b2e73 100644 --- a/tests/Configuration/SamlConfigurationTest.php +++ b/tests/Configuration/SamlConfigurationTest.php @@ -53,31 +53,31 @@ class SamlConfigurationTest extends TestCase public function testDefault(): void { $sut = $this->getSut([]); - $this->assertFalse($sut->isActivated()); - $this->assertEquals('', $sut->getTitle()); - $this->assertEquals([], $sut->getConnection()); - $this->assertEquals([], $sut->getRolesMapping()); - $this->assertEquals('', $sut->getRolesAttribute()); - $this->assertEquals([], $sut->getAttributeMapping()); - $this->assertFalse($sut->isRolesResetOnLogin()); + self::assertFalse($sut->isActivated()); + self::assertEquals('', $sut->getTitle()); + self::assertEquals([], $sut->getConnection()); + self::assertEquals([], $sut->getRolesMapping()); + self::assertEquals('', $sut->getRolesAttribute()); + self::assertEquals([], $sut->getAttributeMapping()); + self::assertFalse($sut->isRolesResetOnLogin()); } public function testDefaultSettings(): void { $sut = $this->getSut($this->getDefaultSettings()); - $this->assertTrue($sut->isActivated()); - $this->assertTrue($sut->isRolesResetOnLogin()); - $this->assertEquals('SAML title', $sut->getTitle()); - $this->assertEquals('google', $sut->getProvider()); - $this->assertEquals([ + self::assertTrue($sut->isActivated()); + self::assertTrue($sut->isRolesResetOnLogin()); + self::assertEquals('SAML title', $sut->getTitle()); + self::assertEquals('google', $sut->getProvider()); + self::assertEquals([ 'host' => '1.2.3.4', ], $sut->getConnection()); - $this->assertEquals([ + self::assertEquals([ ['saml' => 'Kimai - Admin', 'kimai' => 'ROLE_SUPER_ADMIN'], ['saml' => 'Management', 'kimai' => 'ROLE_TEAMLEAD'], ], $sut->getRolesMapping()); - $this->assertEquals('Roles', $sut->getRolesAttribute()); - $this->assertEquals([ + self::assertEquals('Roles', $sut->getRolesAttribute()); + self::assertEquals([ ['saml' => '$Email', 'kimai' => 'email'], ['saml' => '$FirstName $LastName', 'kimai' => 'alias'], ], $sut->getAttributeMapping()); diff --git a/tests/Configuration/SystemConfigurationTest.php b/tests/Configuration/SystemConfigurationTest.php index 9de6fae0..fb038615 100644 --- a/tests/Configuration/SystemConfigurationTest.php +++ b/tests/Configuration/SystemConfigurationTest.php @@ -132,22 +132,22 @@ class SystemConfigurationTest extends TestCase public function testDefaultWithoutLoader(): void { $sut = $this->getSut($this->getDefaultSettings(), []); - $this->assertEquals('Europe/London', $sut->find('defaults.customer.timezone')); - $this->assertEquals('GBP', $sut->find('defaults.customer.currency')); - $this->assertFalse($sut->find('timesheet.rules.allow_future_times')); - $this->assertEquals(99, $sut->find('timesheet.active_entries.hard_limit')); - $this->assertEquals('Maroon|#800000,Brown|#a52a2a,Red|#ff0000,Orange|#ffa500,#ffffff,,|#000000', $sut->getThemeColorChoices()); - $this->assertEquals(['Maroon' => '#800000', 'Brown' => '#a52a2a', 'Red' => '#ff0000', 'Orange' => '#ffa500', '#ffffff' => '#ffffff', '#000000' => '#000000'], $sut->getThemeColors()); + self::assertEquals('Europe/London', $sut->find('defaults.customer.timezone')); + self::assertEquals('GBP', $sut->find('defaults.customer.currency')); + self::assertFalse($sut->find('timesheet.rules.allow_future_times')); + self::assertEquals(99, $sut->find('timesheet.active_entries.hard_limit')); + self::assertEquals('Maroon|#800000,Brown|#a52a2a,Red|#ff0000,Orange|#ffa500,#ffffff,,|#000000', $sut->getThemeColorChoices()); + self::assertEquals(['Maroon' => '#800000', 'Brown' => '#a52a2a', 'Red' => '#ff0000', 'Orange' => '#ffa500', '#ffffff' => '#ffffff', '#000000' => '#000000'], $sut->getThemeColors()); } public function testDefaultWithLoader(): void { $sut = $this->getSut($this->getDefaultSettings(), $this->getDefaultLoaderSettings()); - $this->assertEquals('Russia/Moscov', $sut->find('defaults.customer.timezone')); - $this->assertEquals('RUB', $sut->find('defaults.customer.currency')); - $this->assertTrue($sut->find('timesheet.rules.allow_future_times')); - $this->assertEquals(7, $sut->find('timesheet.active_entries.hard_limit')); - $this->assertFalse($sut->isSamlActive()); + self::assertEquals('Russia/Moscov', $sut->find('defaults.customer.timezone')); + self::assertEquals('RUB', $sut->find('defaults.customer.currency')); + self::assertTrue($sut->find('timesheet.rules.allow_future_times')); + self::assertEquals(7, $sut->find('timesheet.active_entries.hard_limit')); + self::assertFalse($sut->isSamlActive()); } public function testDefaultWithMixedConfigs(): void @@ -158,11 +158,11 @@ class SystemConfigurationTest extends TestCase (new Configuration())->setName('theme.color_choices')->setValue(''), (new Configuration())->setName('company.financial_year')->setValue('2020-03-27'), ]); - $this->assertFalse($sut->find('timesheet.rules.allow_future_times')); - $this->assertTrue($sut->isSamlActive()); - $this->assertEquals('Silver|#c0c0c0', $sut->getThemeColorChoices()); - $this->assertEquals(['Silver' => '#c0c0c0'], $sut->getThemeColors()); - $this->assertEquals('2020-03-27', $sut->getFinancialYearStart()); + self::assertFalse($sut->find('timesheet.rules.allow_future_times')); + self::assertTrue($sut->isSamlActive()); + self::assertEquals('Silver|#c0c0c0', $sut->getThemeColorChoices()); + self::assertEquals(['Silver' => '#c0c0c0'], $sut->getThemeColors()); + self::assertEquals('2020-03-27', $sut->getFinancialYearStart()); } public function testUnknownConfigs(): void @@ -170,100 +170,100 @@ class SystemConfigurationTest extends TestCase $sut = $this->getSut($this->getDefaultSettings(), [ (new Configuration())->setName('timesheet.foo')->setValue('hello'), ]); - $this->assertEquals('hello', $sut->find('timesheet.foo')); - $this->assertTrue($sut->has('timesheet.foo')); - $this->assertFalse($sut->has('timesheet.yyyyyyyyy')); - $this->assertFalse($sut->has('xxxxxxxx.yyyyyyyyy')); - $this->assertNull($sut->find('xxxxxxxx.yyyyyyyyy')); + self::assertEquals('hello', $sut->find('timesheet.foo')); + self::assertTrue($sut->has('timesheet.foo')); + self::assertFalse($sut->has('timesheet.yyyyyyyyy')); + self::assertFalse($sut->has('xxxxxxxx.yyyyyyyyy')); + self::assertNull($sut->find('xxxxxxxx.yyyyyyyyy')); $sut->set('xxxxxxxx.yyyyyyyyy', 'foooo-bar!'); - $this->assertTrue($sut->has('xxxxxxxx.yyyyyyyyy')); - $this->assertEquals('foooo-bar!', $sut->find('xxxxxxxx.yyyyyyyyy')); + self::assertTrue($sut->has('xxxxxxxx.yyyyyyyyy')); + self::assertEquals('foooo-bar!', $sut->find('xxxxxxxx.yyyyyyyyy')); } public function testCalendarWithoutLoader(): void { $sut = $this->getSut($this->getDefaultSettings(), []); - $this->assertEquals('07:49', $sut->getCalendarBusinessTimeBegin()); - $this->assertEquals('19:27', $sut->getCalendarBusinessTimeEnd()); - $this->assertEquals('06:00:00', $sut->getCalendarTimeframeBegin()); - $this->assertEquals('21:00:43', $sut->getCalendarTimeframeEnd()); - $this->assertEquals('01:11:00', $sut->getCalendarSlotDuration()); - $this->assertEquals(20, $sut->getCalendarDayLimit()); - $this->assertFalse($sut->isCalendarShowWeekNumbers()); - $this->assertTrue($sut->isCalendarShowWeekends()); + self::assertEquals('07:49', $sut->getCalendarBusinessTimeBegin()); + self::assertEquals('19:27', $sut->getCalendarBusinessTimeEnd()); + self::assertEquals('06:00:00', $sut->getCalendarTimeframeBegin()); + self::assertEquals('21:00:43', $sut->getCalendarTimeframeEnd()); + self::assertEquals('01:11:00', $sut->getCalendarSlotDuration()); + self::assertEquals(20, $sut->getCalendarDayLimit()); + self::assertFalse($sut->isCalendarShowWeekNumbers()); + self::assertTrue($sut->isCalendarShowWeekends()); - $this->assertEquals('wertwertwegsdfbdf243w567fg8ihuon', $sut->getCalendarGoogleApiKey()); + self::assertEquals('wertwertwegsdfbdf243w567fg8ihuon', $sut->getCalendarGoogleApiKey()); $sources = $sut->getCalendarGoogleSources(); - $this->assertEquals(2, \count($sources)); + self::assertEquals(2, \count($sources)); } public function testCalendarWithLoader(): void { $sut = $this->getSut($this->getDefaultSettings(), $this->getDefaultLoaderSettings()); - $this->assertEquals('00:30:00', $sut->getCalendarSlotDuration()); + self::assertEquals('00:30:00', $sut->getCalendarSlotDuration()); $sources = $sut->getCalendarGoogleSources(); - $this->assertEquals(2, \count($sources)); + self::assertEquals(2, \count($sources)); } public function testFormDefaultWithoutLoader(): void { $sut = $this->getSut($this->getDefaultSettings(), []); - $this->assertEquals('Europe/London', $sut->getCustomerDefaultTimezone()); - $this->assertEquals('GBP', $sut->getCustomerDefaultCurrency()); - $this->assertEquals('FR', $sut->getCustomerDefaultCountry()); - $this->assertEquals('foo/bar', $sut->getUserDefaultTimezone()); - $this->assertEquals('blue', $sut->getUserDefaultTheme()); - $this->assertEquals('IT', $sut->getUserDefaultLanguage()); - $this->assertEquals('USD', $sut->getUserDefaultCurrency()); - $this->assertNull($sut->getFinancialYearStart()); + self::assertEquals('Europe/London', $sut->getCustomerDefaultTimezone()); + self::assertEquals('GBP', $sut->getCustomerDefaultCurrency()); + self::assertEquals('FR', $sut->getCustomerDefaultCountry()); + self::assertEquals('foo/bar', $sut->getUserDefaultTimezone()); + self::assertEquals('blue', $sut->getUserDefaultTheme()); + self::assertEquals('IT', $sut->getUserDefaultLanguage()); + self::assertEquals('USD', $sut->getUserDefaultCurrency()); + self::assertNull($sut->getFinancialYearStart()); } public function testFormDefaultWithLoader(): void { $sut = $this->getSut($this->getDefaultSettings(), $this->getDefaultLoaderSettings()); - $this->assertEquals('Russia/Moscov', $sut->getCustomerDefaultTimezone()); - $this->assertEquals('RUB', $sut->getCustomerDefaultCurrency()); - $this->assertEquals('FR', $sut->getCustomerDefaultCountry()); - $this->assertEquals('foo/bar', $sut->getUserDefaultTimezone()); - $this->assertEquals('blue', $sut->getUserDefaultTheme()); - $this->assertEquals('IT', $sut->getUserDefaultLanguage()); - $this->assertEquals('USD', $sut->getUserDefaultCurrency()); + self::assertEquals('Russia/Moscov', $sut->getCustomerDefaultTimezone()); + self::assertEquals('RUB', $sut->getCustomerDefaultCurrency()); + self::assertEquals('FR', $sut->getCustomerDefaultCountry()); + self::assertEquals('foo/bar', $sut->getUserDefaultTimezone()); + self::assertEquals('blue', $sut->getUserDefaultTheme()); + self::assertEquals('IT', $sut->getUserDefaultLanguage()); + self::assertEquals('USD', $sut->getUserDefaultCurrency()); } public function testTimesheetWithoutLoader(): void { $sut = $this->getSut($this->getDefaultSettings(), []); - $this->assertEquals(99, $sut->getTimesheetActiveEntriesHardLimit()); - $this->assertFalse($sut->isTimesheetAllowFutureTimes()); - $this->assertFalse($sut->isTimesheetMarkdownEnabled()); - $this->assertEquals('punch', $sut->getTimesheetTrackingMode()); - $this->assertEquals('now', $sut->getTimesheetDefaultBeginTime()); - $this->assertEquals('', $sut->isTimesheetAllowOverlappingRecords()); - $this->assertEquals('', $sut->getTimesheetDefaultRoundingDays()); - $this->assertEquals('', $sut->getTimesheetDefaultRoundingMode()); - $this->assertEquals(0, $sut->getTimesheetDefaultRoundingDuration()); - $this->assertEquals(0, $sut->getTimesheetDefaultRoundingEnd()); - $this->assertEquals(0, $sut->getTimesheetDefaultRoundingBegin()); - $this->assertEquals(10, $sut->getTimesheetIncrementDuration()); - $this->assertEquals(5, $sut->getTimesheetIncrementMinutes()); + self::assertEquals(99, $sut->getTimesheetActiveEntriesHardLimit()); + self::assertFalse($sut->isTimesheetAllowFutureTimes()); + self::assertFalse($sut->isTimesheetMarkdownEnabled()); + self::assertEquals('punch', $sut->getTimesheetTrackingMode()); + self::assertEquals('now', $sut->getTimesheetDefaultBeginTime()); + self::assertEquals('', $sut->isTimesheetAllowOverlappingRecords()); + self::assertEquals('', $sut->getTimesheetDefaultRoundingDays()); + self::assertEquals('', $sut->getTimesheetDefaultRoundingMode()); + self::assertEquals(0, $sut->getTimesheetDefaultRoundingDuration()); + self::assertEquals(0, $sut->getTimesheetDefaultRoundingEnd()); + self::assertEquals(0, $sut->getTimesheetDefaultRoundingBegin()); + self::assertEquals(10, $sut->getTimesheetIncrementDuration()); + self::assertEquals(5, $sut->getTimesheetIncrementMinutes()); } public function testTimesheetWithLoader(): void { $sut = $this->getSut($this->getDefaultSettings(), $this->getDefaultLoaderSettings()); - $this->assertEquals(7, $sut->getTimesheetActiveEntriesHardLimit()); - $this->assertTrue($sut->isTimesheetAllowFutureTimes()); - $this->assertTrue($sut->isTimesheetMarkdownEnabled()); - $this->assertEquals('default', $sut->getTimesheetTrackingMode()); - $this->assertEquals('07:00', $sut->getTimesheetDefaultBeginTime()); - $this->assertEquals('', $sut->isTimesheetAllowOverlappingRecords()); - $this->assertEquals('', $sut->getTimesheetDefaultRoundingDays()); - $this->assertEquals('', $sut->getTimesheetDefaultRoundingMode()); - $this->assertEquals(0, $sut->getTimesheetDefaultRoundingDuration()); - $this->assertEquals(0, $sut->getTimesheetDefaultRoundingEnd()); - $this->assertEquals(0, $sut->getTimesheetDefaultRoundingBegin()); - $this->assertEquals(10, $sut->getTimesheetIncrementDuration()); - $this->assertEquals(5, $sut->getTimesheetIncrementMinutes()); + self::assertEquals(7, $sut->getTimesheetActiveEntriesHardLimit()); + self::assertTrue($sut->isTimesheetAllowFutureTimes()); + self::assertTrue($sut->isTimesheetMarkdownEnabled()); + self::assertEquals('default', $sut->getTimesheetTrackingMode()); + self::assertEquals('07:00', $sut->getTimesheetDefaultBeginTime()); + self::assertEquals('', $sut->isTimesheetAllowOverlappingRecords()); + self::assertEquals('', $sut->getTimesheetDefaultRoundingDays()); + self::assertEquals('', $sut->getTimesheetDefaultRoundingMode()); + self::assertEquals(0, $sut->getTimesheetDefaultRoundingDuration()); + self::assertEquals(0, $sut->getTimesheetDefaultRoundingEnd()); + self::assertEquals(0, $sut->getTimesheetDefaultRoundingBegin()); + self::assertEquals(10, $sut->getTimesheetIncrementDuration()); + self::assertEquals(5, $sut->getTimesheetIncrementMinutes()); } } diff --git a/tests/Controller/AboutControllerTest.php b/tests/Controller/AboutControllerTest.php index ddfe0e80..e498d9cd 100644 --- a/tests/Controller/AboutControllerTest.php +++ b/tests/Controller/AboutControllerTest.php @@ -14,7 +14,7 @@ use App\Entity\User; /** * @group integration */ -class AboutControllerTest extends ControllerBaseTest +class AboutControllerTest extends AbstractControllerBaseTestCase { public function testIndexAction(): void { diff --git a/tests/Controller/ControllerBaseTest.php b/tests/Controller/AbstractControllerBaseTestCase.php similarity index 99% rename from tests/Controller/ControllerBaseTest.php rename to tests/Controller/AbstractControllerBaseTestCase.php index 1804c0a2..f944a9fd 100644 --- a/tests/Controller/ControllerBaseTest.php +++ b/tests/Controller/AbstractControllerBaseTestCase.php @@ -34,7 +34,7 @@ use Symfony\Component\Security\Csrf\CsrfTokenManager; /** * ControllerBaseTest adds some useful functions for writing integration tests. */ -abstract class ControllerBaseTest extends WebTestCase +abstract class AbstractControllerBaseTestCase extends WebTestCase { use KernelTestTrait; @@ -155,6 +155,9 @@ abstract class ControllerBaseTest extends WebTestCase return $client; } + /** + * @return non-empty-string + */ protected function createUrl(string $url): string { $prefix = '/' . self::DEFAULT_LANGUAGE; @@ -404,10 +407,6 @@ abstract class ControllerBaseTest extends WebTestCase } } - /** - * @param HttpKernelBrowser $client - * @param string $url - */ protected function assertIsRedirect(HttpKernelBrowser $client, ?string $url = null, bool $endsWith = true): void { self::assertResponseRedirects(); @@ -431,7 +430,7 @@ abstract class ControllerBaseTest extends WebTestCase self::assertStringContainsString($expectedMeta, $client->getResponse()->getContent()); if ($url !== null) { - if ($endsWith) { + if ($endsWith && $url !== '') { self::assertStringEndsWith($url, $location, 'Redirect URL does not match'); } else { self::assertStringContainsString($url, $location, 'Redirect URL does not match'); @@ -447,7 +446,7 @@ abstract class ControllerBaseTest extends WebTestCase $location = $client->getResponse()->headers->get('Location'); self::assertNotNull($location); - if ($endsWith) { + if ($endsWith && $url !== '') { self::assertStringEndsWith($url, $location, 'Redirect URL does not match'); } else { self::assertStringContainsString($url, $location, 'Redirect URL does not match'); diff --git a/tests/Controller/ActivityControllerTest.php b/tests/Controller/ActivityControllerTest.php index 040a0972..48a47983 100644 --- a/tests/Controller/ActivityControllerTest.php +++ b/tests/Controller/ActivityControllerTest.php @@ -26,7 +26,7 @@ use Symfony\Component\HttpKernel\HttpKernelBrowser; /** * @group integration */ -class ActivityControllerTest extends ControllerBaseTest +class ActivityControllerTest extends AbstractControllerBaseTestCase { public function testIsSecure(): void { @@ -88,7 +88,7 @@ class ActivityControllerTest extends ControllerBaseTest 'page' => 1, ]); - $this->assertTrue($client->getResponse()->isSuccessful()); + self::assertTrue($client->getResponse()->isSuccessful()); $this->assertHasDataTable($client); $this->assertDataTableRowCount($client, 'datatable_activity_admin', 5); } @@ -215,7 +215,7 @@ class ActivityControllerTest extends ControllerBaseTest $this->request($client, '/admin/activity/' . $id . '/edit'); $editForm = $client->getCrawler()->filter('form[name=activity_edit_form]')->form(); - $this->assertEquals('An AcTiVitY Name', $editForm->get('activity_edit_form[name]')->getValue()); + self::assertEquals('An AcTiVitY Name', $editForm->get('activity_edit_form[name]')->getValue()); } public function testCreateActionShowsMetaFields(): void @@ -225,12 +225,12 @@ class ActivityControllerTest extends ControllerBaseTest static::assertInstanceOf(EventDispatcher::class, $eventDispatcher); $eventDispatcher->addSubscriber(new ActivityTestMetaFieldSubscriberMock()); $this->assertAccessIsGranted($client, '/admin/activity/create'); - $this->assertTrue($client->getResponse()->isSuccessful()); + self::assertTrue($client->getResponse()->isSuccessful()); $form = $client->getCrawler()->filter('form[name=activity_edit_form]')->form(); - $this->assertTrue($form->has('activity_edit_form[metaFields][metatestmock][value]')); - $this->assertTrue($form->has('activity_edit_form[metaFields][foobar][value]')); - $this->assertFalse($form->has('activity_edit_form[metaFields][0][value]')); + self::assertTrue($form->has('activity_edit_form[metaFields][metatestmock][value]')); + self::assertTrue($form->has('activity_edit_form[metaFields][foobar][value]')); + self::assertFalse($form->has('activity_edit_form[metaFields][0][value]')); } public function testEditAction(): void @@ -238,7 +238,7 @@ class ActivityControllerTest extends ControllerBaseTest $client = $this->getClientForAuthenticatedUser(User::ROLE_ADMIN); $this->assertAccessIsGranted($client, '/admin/activity/1/edit'); $form = $client->getCrawler()->filter('form[name=activity_edit_form]')->form(); - $this->assertEquals('Test', $form->get('activity_edit_form[name]')->getValue()); + self::assertEquals('Test', $form->get('activity_edit_form[name]')->getValue()); $client->submit($form, [ 'activity_edit_form' => ['name' => 'Test 2'] ]); @@ -246,7 +246,7 @@ class ActivityControllerTest extends ControllerBaseTest $client->followRedirect(); $this->request($client, '/admin/activity/1/edit'); $editForm = $client->getCrawler()->filter('form[name=activity_edit_form]')->form(); - $this->assertEquals('Test 2', $editForm->get('activity_edit_form[name]')->getValue()); + self::assertEquals('Test 2', $editForm->get('activity_edit_form[name]')->getValue()); } public function testEditActionForGlobalActivity(): void @@ -254,7 +254,7 @@ class ActivityControllerTest extends ControllerBaseTest $client = $this->getClientForAuthenticatedUser(User::ROLE_ADMIN); $this->assertAccessIsGranted($client, '/admin/activity/1/edit'); $form = $client->getCrawler()->filter('form[name=activity_edit_form]')->form(); - $this->assertEquals('Test', $form->get('activity_edit_form[name]')->getValue()); + self::assertEquals('Test', $form->get('activity_edit_form[name]')->getValue()); $client->submit($form, [ 'activity_edit_form' => ['name' => 'Test 2'] ]); @@ -262,7 +262,7 @@ class ActivityControllerTest extends ControllerBaseTest $client->followRedirect(); $this->request($client, '/admin/activity/1/edit'); $editForm = $client->getCrawler()->filter('form[name=activity_edit_form]')->form(); - $this->assertEquals('Test 2', $editForm->get('activity_edit_form[name]')->getValue()); + self::assertEquals('Test 2', $editForm->get('activity_edit_form[name]')->getValue()); } public function testTeamPermissionAction(): void @@ -317,13 +317,13 @@ class ActivityControllerTest extends ControllerBaseTest { $client = $this->getClientForAuthenticatedUser(User::ROLE_ADMIN); $this->request($client, '/admin/activity/1/edit'); - $this->assertTrue($client->getResponse()->isSuccessful()); + self::assertTrue($client->getResponse()->isSuccessful()); $this->request($client, '/admin/activity/1/delete'); - $this->assertTrue($client->getResponse()->isSuccessful()); + self::assertTrue($client->getResponse()->isSuccessful()); $form = $client->getCrawler()->filter('form[name=form]')->form(); - $this->assertStringEndsWith($this->createUrl('/admin/activity/1/delete'), $form->getUri()); + self::assertStringEndsWith($this->createUrl('/admin/activity/1/delete'), $form->getUri()); $client->submit($form); $client->followRedirect(); @@ -331,7 +331,7 @@ class ActivityControllerTest extends ControllerBaseTest $this->assertHasNoEntriesWithFilter($client); $this->request($client, '/admin/activity/1/edit'); - $this->assertFalse($client->getResponse()->isSuccessful()); + self::assertFalse($client->getResponse()->isSuccessful()); } public function testDeleteActionWithTimesheetEntries(): void @@ -347,18 +347,18 @@ class ActivityControllerTest extends ControllerBaseTest $this->importFixture($fixture); $timesheets = $em->getRepository(Timesheet::class)->findAll(); - $this->assertEquals(10, \count($timesheets)); + self::assertEquals(10, \count($timesheets)); /** @var Timesheet $entry */ foreach ($timesheets as $entry) { - $this->assertEquals(1, $entry->getActivity()->getId()); + self::assertEquals(1, $entry->getActivity()->getId()); } $this->request($client, '/admin/activity/1/delete'); - $this->assertTrue($client->getResponse()->isSuccessful()); + self::assertTrue($client->getResponse()->isSuccessful()); $form = $client->getCrawler()->filter('form[name=form]')->form(); - $this->assertStringEndsWith($this->createUrl('/admin/activity/1/delete'), $form->getUri()); + self::assertStringEndsWith($this->createUrl('/admin/activity/1/delete'), $form->getUri()); $client->submit($form); $this->assertIsRedirect($client, $this->createUrl('/admin/activity/')); @@ -368,10 +368,10 @@ class ActivityControllerTest extends ControllerBaseTest $em->clear(); $timesheets = $em->getRepository(Timesheet::class)->findAll(); - $this->assertEquals(0, \count($timesheets)); + self::assertEquals(0, \count($timesheets)); $this->request($client, '/admin/activity/1/edit'); - $this->assertFalse($client->getResponse()->isSuccessful()); + self::assertFalse($client->getResponse()->isSuccessful()); } public function testDeleteActionWithTimesheetEntriesAndReplacement(): void @@ -392,18 +392,18 @@ class ActivityControllerTest extends ControllerBaseTest $id = $activity->getId(); $timesheets = $em->getRepository(Timesheet::class)->findAll(); - $this->assertEquals(10, \count($timesheets)); + self::assertEquals(10, \count($timesheets)); /** @var Timesheet $entry */ foreach ($timesheets as $entry) { - $this->assertEquals(1, $entry->getActivity()->getId()); + self::assertEquals(1, $entry->getActivity()->getId()); } $this->request($client, '/admin/activity/1/delete'); - $this->assertTrue($client->getResponse()->isSuccessful()); + self::assertTrue($client->getResponse()->isSuccessful()); $form = $client->getCrawler()->filter('form[name=form]')->form(); - $this->assertStringEndsWith($this->createUrl('/admin/activity/1/delete'), $form->getUri()); + self::assertStringEndsWith($this->createUrl('/admin/activity/1/delete'), $form->getUri()); $client->submit($form, [ 'form' => [ 'activity' => $id @@ -416,15 +416,15 @@ class ActivityControllerTest extends ControllerBaseTest $this->assertHasFlashSuccess($client); $timesheets = $em->getRepository(Timesheet::class)->findAll(); - $this->assertEquals(10, \count($timesheets)); + self::assertEquals(10, \count($timesheets)); /** @var Timesheet $entry */ foreach ($timesheets as $entry) { - $this->assertEquals($id, $entry->getActivity()->getId()); + self::assertEquals($id, $entry->getActivity()->getId()); } $this->request($client, '/admin/activity/1/edit'); - $this->assertFalse($client->getResponse()->isSuccessful()); + self::assertFalse($client->getResponse()->isSuccessful()); } /** @@ -441,7 +441,7 @@ class ActivityControllerTest extends ControllerBaseTest ); } - public function getValidationTestData() + public static function getValidationTestData() { return [ [ diff --git a/tests/Controller/CalendarControllerTest.php b/tests/Controller/CalendarControllerTest.php index d58b1fcc..47386af0 100644 --- a/tests/Controller/CalendarControllerTest.php +++ b/tests/Controller/CalendarControllerTest.php @@ -18,7 +18,7 @@ use App\Tests\Mocks\SystemConfigurationFactory; /** * @group integration */ -class CalendarControllerTest extends ControllerBaseTest +class CalendarControllerTest extends AbstractControllerBaseTestCase { public function testIsSecure(): void { @@ -33,13 +33,13 @@ class CalendarControllerTest extends ControllerBaseTest $this->importFixture($fixtures); $this->request($client, '/calendar/'); - $this->assertTrue($client->getResponse()->isSuccessful()); + self::assertTrue($client->getResponse()->isSuccessful()); $crawler = $client->getCrawler(); $calendar = $crawler->filter('div#timesheet_calendar'); - $this->assertEquals(1, $calendar->count()); + self::assertEquals(1, $calendar->count()); $dragAndDropBoxes = $crawler->filter('div.card-body.drag-and-drop-source'); - $this->assertEquals(1, $dragAndDropBoxes->count()); + self::assertEquals(1, $dragAndDropBoxes->count()); } public function testCalendarActionAsSuperAdmin(): void @@ -60,13 +60,13 @@ class CalendarControllerTest extends ControllerBaseTest $crawler = $client->getCrawler(); $calendar = $crawler->filter('div#timesheet_calendar'); - $this->assertEquals(1, $calendar->count()); + self::assertEquals(1, $calendar->count()); $content = $client->getResponse()->getContent(); - $this->assertStringContainsString("googleCalendarId: 'de.german#holiday@group.v.calendar.google.com',", $content); - $this->assertStringContainsString("name: 'holidays'", $content); - $this->assertStringContainsString("googleCalendarId: 'en.german#holiday@group.v.calendar.google.com',", $content); - $this->assertStringContainsString("name: 'holidays_en'", $content); + self::assertStringContainsString("googleCalendarId: 'de.german#holiday@group.v.calendar.google.com',", $content); + self::assertStringContainsString("name: 'holidays'", $content); + self::assertStringContainsString("googleCalendarId: 'en.german#holiday@group.v.calendar.google.com',", $content); + self::assertStringContainsString("name: 'holidays_en'", $content); } protected function getDefaultSettings(): array diff --git a/tests/Controller/ContractControllerTest.php b/tests/Controller/ContractControllerTest.php index b395ed75..857edcb9 100644 --- a/tests/Controller/ContractControllerTest.php +++ b/tests/Controller/ContractControllerTest.php @@ -14,7 +14,7 @@ use App\Entity\User; /** * @group integration */ -class ContractControllerTest extends ControllerBaseTest +class ContractControllerTest extends AbstractControllerBaseTestCase { public function testIsSecure(): void { diff --git a/tests/Controller/CustomerControllerTest.php b/tests/Controller/CustomerControllerTest.php index 301c9314..07113d51 100644 --- a/tests/Controller/CustomerControllerTest.php +++ b/tests/Controller/CustomerControllerTest.php @@ -27,7 +27,7 @@ use Symfony\Component\HttpKernel\HttpKernelBrowser; /** * @group integration */ -class CustomerControllerTest extends ControllerBaseTest +class CustomerControllerTest extends AbstractControllerBaseTestCase { public function testIsSecure(): void { @@ -91,7 +91,7 @@ class CustomerControllerTest extends ControllerBaseTest 'page' => 1, ]); - $this->assertTrue($client->getResponse()->isSuccessful()); + self::assertTrue($client->getResponse()->isSuccessful()); $this->assertHasDataTable($client); $this->assertDataTableRowCount($client, 'datatable_customer_admin', 5); } @@ -113,7 +113,7 @@ class CustomerControllerTest extends ControllerBaseTest $client = $this->getClientForAuthenticatedUser(User::ROLE_TEAMLEAD); $this->request($client, '/admin/customer/'); - $this->assertTrue($client->getResponse()->isSuccessful()); + self::assertTrue($client->getResponse()->isSuccessful()); $form = $client->getCrawler()->filter('form.searchform')->form(); $form->getFormNode()->setAttribute('action', $this->createUrl('/admin/customer/export')); @@ -318,7 +318,7 @@ class CustomerControllerTest extends ControllerBaseTest $form = $client->getCrawler()->filter('form[name=customer_edit_form]')->form(); $editForm = $client->getCrawler()->filter('form[name=customer_edit_form]')->form(); - $this->assertEquals(date_default_timezone_get(), $editForm->get('customer_edit_form[timezone]')->getValue()); + self::assertEquals(date_default_timezone_get(), $editForm->get('customer_edit_form[timezone]')->getValue()); $client->submit($form, [ 'customer_edit_form' => [ @@ -340,12 +340,12 @@ class CustomerControllerTest extends ControllerBaseTest $dispatcher = self::getContainer()->get('event_dispatcher'); $dispatcher->addSubscriber(new CustomerTestMetaFieldSubscriberMock()); $this->assertAccessIsGranted($client, '/admin/customer/create'); - $this->assertTrue($client->getResponse()->isSuccessful()); + self::assertTrue($client->getResponse()->isSuccessful()); $form = $client->getCrawler()->filter('form[name=customer_edit_form]')->form(); - $this->assertTrue($form->has('customer_edit_form[metaFields][metatestmock][value]')); - $this->assertTrue($form->has('customer_edit_form[metaFields][foobar][value]')); - $this->assertFalse($form->has('customer_edit_form[metaFields][0][value]')); + self::assertTrue($form->has('customer_edit_form[metaFields][metatestmock][value]')); + self::assertTrue($form->has('customer_edit_form[metaFields][foobar][value]')); + self::assertFalse($form->has('customer_edit_form[metaFields][0][value]')); } public function testEditAction(): void @@ -353,7 +353,7 @@ class CustomerControllerTest extends ControllerBaseTest $client = $this->getClientForAuthenticatedUser(User::ROLE_ADMIN); $this->assertAccessIsGranted($client, '/admin/customer/1/edit'); $form = $client->getCrawler()->filter('form[name=customer_edit_form]')->form(); - $this->assertEquals('Test', $form->get('customer_edit_form[name]')->getValue()); + self::assertEquals('Test', $form->get('customer_edit_form[name]')->getValue()); $client->submit($form, [ 'customer_edit_form' => [ 'name' => 'Test Customer 2' @@ -363,7 +363,7 @@ class CustomerControllerTest extends ControllerBaseTest $client->followRedirect(); $this->request($client, '/admin/customer/1/edit'); $editForm = $client->getCrawler()->filter('form[name=customer_edit_form]')->form(); - $this->assertEquals('Test Customer 2', $editForm->get('customer_edit_form[name]')->getValue()); + self::assertEquals('Test Customer 2', $editForm->get('customer_edit_form[name]')->getValue()); } public function testTeamPermissionAction(): void @@ -408,12 +408,12 @@ class CustomerControllerTest extends ControllerBaseTest $id = $customer->getId(); $this->request($client, '/admin/customer/' . $id . '/edit'); - $this->assertTrue($client->getResponse()->isSuccessful()); + self::assertTrue($client->getResponse()->isSuccessful()); $this->request($client, '/admin/customer/' . $id . '/delete'); - $this->assertTrue($client->getResponse()->isSuccessful()); + self::assertTrue($client->getResponse()->isSuccessful()); $form = $client->getCrawler()->filter('form[name=form]')->form(); - $this->assertStringEndsWith($this->createUrl('/admin/customer/' . $id . '/delete'), $form->getUri()); + self::assertStringEndsWith($this->createUrl('/admin/customer/' . $id . '/delete'), $form->getUri()); $client->submit($form); $client->followRedirect(); @@ -421,7 +421,7 @@ class CustomerControllerTest extends ControllerBaseTest $this->assertHasFlashSuccess($client); $this->request($client, '/admin/customer/' . $id . '/edit'); - $this->assertFalse($client->getResponse()->isSuccessful()); + self::assertFalse($client->getResponse()->isSuccessful()); } public function testDeleteActionWithTimesheetEntries(): void @@ -435,18 +435,18 @@ class CustomerControllerTest extends ControllerBaseTest $this->importFixture($fixture); $timesheets = $em->getRepository(Timesheet::class)->findAll(); - $this->assertEquals(10, \count($timesheets)); + self::assertEquals(10, \count($timesheets)); /** @var Timesheet $entry */ foreach ($timesheets as $entry) { - $this->assertEquals(1, $entry->getActivity()->getId()); + self::assertEquals(1, $entry->getActivity()->getId()); } $this->request($client, '/admin/customer/1/delete'); - $this->assertTrue($client->getResponse()->isSuccessful()); + self::assertTrue($client->getResponse()->isSuccessful()); $form = $client->getCrawler()->filter('form[name=form]')->form(); - $this->assertStringEndsWith($this->createUrl('/admin/customer/1/delete'), $form->getUri()); + self::assertStringEndsWith($this->createUrl('/admin/customer/1/delete'), $form->getUri()); $client->submit($form); $this->assertIsRedirect($client, $this->createUrl('/admin/customer/')); @@ -456,10 +456,10 @@ class CustomerControllerTest extends ControllerBaseTest $em->clear(); $timesheets = $em->getRepository(Timesheet::class)->findAll(); - $this->assertEquals(0, \count($timesheets)); + self::assertEquals(0, \count($timesheets)); $this->request($client, '/admin/customer/1/edit'); - $this->assertFalse($client->getResponse()->isSuccessful()); + self::assertFalse($client->getResponse()->isSuccessful()); } public function testDeleteActionWithTimesheetEntriesAndReplacement(): void @@ -478,18 +478,18 @@ class CustomerControllerTest extends ControllerBaseTest $id = $customer->getId(); $timesheets = $em->getRepository(Timesheet::class)->findAll(); - $this->assertEquals(10, \count($timesheets)); + self::assertEquals(10, \count($timesheets)); /** @var Timesheet $entry */ foreach ($timesheets as $entry) { - $this->assertEquals(1, $entry->getProject()->getCustomer()->getId()); + self::assertEquals(1, $entry->getProject()->getCustomer()->getId()); } $this->request($client, '/admin/customer/1/delete'); - $this->assertTrue($client->getResponse()->isSuccessful()); + self::assertTrue($client->getResponse()->isSuccessful()); $form = $client->getCrawler()->filter('form[name=form]')->form(); - $this->assertStringEndsWith($this->createUrl('/admin/customer/1/delete'), $form->getUri()); + self::assertStringEndsWith($this->createUrl('/admin/customer/1/delete'), $form->getUri()); $client->submit($form, [ 'form' => [ 'customer' => $id @@ -502,15 +502,15 @@ class CustomerControllerTest extends ControllerBaseTest $this->assertHasFlashSuccess($client); $timesheets = $em->getRepository(Timesheet::class)->findAll(); - $this->assertEquals(10, \count($timesheets)); + self::assertEquals(10, \count($timesheets)); /** @var Timesheet $entry */ foreach ($timesheets as $entry) { - $this->assertEquals($id, $entry->getProject()->getCustomer()->getId()); + self::assertEquals($id, $entry->getProject()->getCustomer()->getId()); } $this->request($client, '/admin/customer/1/edit'); - $this->assertFalse($client->getResponse()->isSuccessful()); + self::assertFalse($client->getResponse()->isSuccessful()); } /** @@ -527,7 +527,7 @@ class CustomerControllerTest extends ControllerBaseTest ); } - public function getValidationTestData() + public static function getValidationTestData() { return [ [ diff --git a/tests/Controller/DashboardControllerTest.php b/tests/Controller/DashboardControllerTest.php index 320ceaa8..593f8182 100644 --- a/tests/Controller/DashboardControllerTest.php +++ b/tests/Controller/DashboardControllerTest.php @@ -12,7 +12,7 @@ namespace App\Tests\Controller; /** * @group integration */ -class DashboardControllerTest extends ControllerBaseTest +class DashboardControllerTest extends AbstractControllerBaseTestCase { public function testIsSecure(): void { @@ -23,7 +23,7 @@ class DashboardControllerTest extends ControllerBaseTest { $client = $this->getClientForAuthenticatedUser(); $this->request($client, '/dashboard/'); - $this->assertTrue($client->getResponse()->isSuccessful()); + self::assertTrue($client->getResponse()->isSuccessful()); $this->assertMainContentClass($client, 'dashboard'); self::assertEquals(1, $client->getCrawler()->filter('div#PaginatedWorkingTimeChartBox canvas')->count()); } diff --git a/tests/Controller/DoctorControllerTest.php b/tests/Controller/DoctorControllerTest.php index a42951c0..8f5e7d6b 100644 --- a/tests/Controller/DoctorControllerTest.php +++ b/tests/Controller/DoctorControllerTest.php @@ -14,7 +14,7 @@ use App\Entity\User; /** * @group integration */ -class DoctorControllerTest extends ControllerBaseTest +class DoctorControllerTest extends AbstractControllerBaseTestCase { public function testDoctorIsSecure(): void { diff --git a/tests/Controller/ExportControllerTest.php b/tests/Controller/ExportControllerTest.php index 8db26f88..663bfa96 100644 --- a/tests/Controller/ExportControllerTest.php +++ b/tests/Controller/ExportControllerTest.php @@ -18,7 +18,7 @@ use Doctrine\ORM\EntityManager; /** * @group integration */ -class ExportControllerTest extends ControllerBaseTest +class ExportControllerTest extends AbstractControllerBaseTestCase { public function testIsSecure(): void { @@ -35,7 +35,7 @@ class ExportControllerTest extends ControllerBaseTest $client = $this->getClientForAuthenticatedUser(User::ROLE_TEAMLEAD); $this->request($client, '/export/?performSearch=performSearch'); - $this->assertTrue($client->getResponse()->isSuccessful()); + self::assertTrue($client->getResponse()->isSuccessful()); $this->assertHasNoEntriesWithFilter($client); } @@ -83,7 +83,7 @@ class ExportControllerTest extends ControllerBaseTest $em->flush(); $this->request($client, '/export/?performSearch=performSearch'); - $this->assertTrue($client->getResponse()->isSuccessful()); + self::assertTrue($client->getResponse()->isSuccessful()); // make sure all existing records are displayed $this->assertHasDataTable($client); @@ -106,7 +106,7 @@ class ExportControllerTest extends ControllerBaseTest $type = $button->getAttribute('data-type'); unset($expected[$type]); } - $this->assertEmpty($expected); + self::assertEmpty($expected); } public function testIndexActionWithEntriesForTeamleadDoesNotShowUserWithoutTeam(): void @@ -126,7 +126,7 @@ class ExportControllerTest extends ControllerBaseTest $this->importFixture($fixture); $this->request($client, '/export/?performSearch=performSearch'); - $this->assertTrue($client->getResponse()->isSuccessful()); + self::assertTrue($client->getResponse()->isSuccessful()); // make sure existing records are not displayed $this->assertHasNoEntriesWithFilter($client); @@ -142,7 +142,7 @@ class ExportControllerTest extends ControllerBaseTest $this->importFixture($fixture); $this->request($client, '/export/?performSearch=performSearch'); - $this->assertTrue($client->getResponse()->isSuccessful()); + self::assertTrue($client->getResponse()->isSuccessful()); // make sure all existing records are displayed $this->assertHasDataTable($client); @@ -165,7 +165,7 @@ class ExportControllerTest extends ControllerBaseTest $type = $button->getAttribute('data-type'); unset($expected[$type]); } - $this->assertEmpty($expected); + self::assertEmpty($expected); } public function testExportActionWithMissingRenderer(): void @@ -180,7 +180,7 @@ class ExportControllerTest extends ControllerBaseTest $client = $this->getClientForAuthenticatedUser(User::ROLE_TEAMLEAD); $this->request($client, '/export/', 'GET'); - $this->assertTrue($client->getResponse()->isSuccessful()); + self::assertTrue($client->getResponse()->isSuccessful()); $form = $client->getCrawler()->filter('#export-form')->form(); $node = $form->getFormNode(); @@ -210,7 +210,7 @@ class ExportControllerTest extends ControllerBaseTest $this->importFixture($fixture); $this->request($client, '/export/'); - $this->assertTrue($client->getResponse()->isSuccessful()); + self::assertTrue($client->getResponse()->isSuccessful()); $form = $client->getCrawler()->filter('#export-form')->form(); $node = $form->getFormNode(); @@ -224,26 +224,26 @@ class ExportControllerTest extends ControllerBaseTest ]); $response = $client->getResponse(); - $this->assertTrue($response->isSuccessful()); + self::assertTrue($response->isSuccessful()); $content = $response->getContent(); $node = $client->getCrawler()->filter('body'); - $this->assertEquals(1, $node->count()); + self::assertEquals(1, $node->count()); // poor mans assertions ;-) /** @var \DOMElement $element */ $element = $node->getIterator()[0]; - $this->assertStringContainsString('export_print', $element->getAttribute('class')); - $this->assertStringContainsString('<h2 id="doc-title" contenteditable="true"', $content); - $this->assertStringContainsString('<h3 class="card-title" id="doc-summary" contenteditable="true" data-original="Summary">Summary</h3>', $content); + self::assertStringContainsString('export_print', $element->getAttribute('class')); + self::assertStringContainsString('<h2 id="doc-title" contenteditable="true"', $content); + self::assertStringContainsString('<h3 class="card-title" id="doc-summary" contenteditable="true" data-original="Summary">Summary</h3>', $content); $node = $client->getCrawler()->filter('section.export div#export-records table.dataTable tbody tr'); // 20 rows + the summary footer - $this->assertEquals(21, $node->count()); + self::assertEquals(21, $node->count()); $timesheets = $em->getRepository(Timesheet::class)->findAll(); /** @var Timesheet $timesheet */ foreach ($timesheets as $timesheet) { - $this->assertTrue($timesheet->isExported()); + self::assertTrue($timesheet->isExported()); } } } diff --git a/tests/Controller/FavoriteControllerTest.php b/tests/Controller/FavoriteControllerTest.php index 69add600..3e16e68f 100644 --- a/tests/Controller/FavoriteControllerTest.php +++ b/tests/Controller/FavoriteControllerTest.php @@ -15,7 +15,7 @@ use App\Tests\DataFixtures\TimesheetFixtures; /** * @group integration */ -class FavoriteControllerTest extends ControllerBaseTest +class FavoriteControllerTest extends AbstractControllerBaseTestCase { public function testIsSecure(): void { @@ -35,7 +35,7 @@ class FavoriteControllerTest extends ControllerBaseTest $this->importFixture($fixture); $this->request($client, '/favorite/timesheet/'); - $this->assertTrue($client->getResponse()->isSuccessful()); + self::assertTrue($client->getResponse()->isSuccessful()); $content = $client->getResponse()->getContent(); self::assertNotFalse($content); diff --git a/tests/Controller/HelpControllerTest.php b/tests/Controller/HelpControllerTest.php index a72e6c85..c9238ea5 100644 --- a/tests/Controller/HelpControllerTest.php +++ b/tests/Controller/HelpControllerTest.php @@ -14,7 +14,7 @@ use App\Entity\User; /** * @group integration */ -class HelpControllerTest extends ControllerBaseTest +class HelpControllerTest extends AbstractControllerBaseTestCase { public function testHelpLocalesAction(): void { diff --git a/tests/Controller/HomepageControllerTest.php b/tests/Controller/HomepageControllerTest.php index 3959bc59..778c28b3 100644 --- a/tests/Controller/HomepageControllerTest.php +++ b/tests/Controller/HomepageControllerTest.php @@ -16,7 +16,7 @@ use App\Form\Type\InitialViewType; /** * @group integration */ -class HomepageControllerTest extends ControllerBaseTest +class HomepageControllerTest extends AbstractControllerBaseTestCase { public function testIsSecure(): void { diff --git a/tests/Controller/InvoiceControllerTest.php b/tests/Controller/InvoiceControllerTest.php index b82399ed..dee49aa0 100644 --- a/tests/Controller/InvoiceControllerTest.php +++ b/tests/Controller/InvoiceControllerTest.php @@ -20,7 +20,7 @@ use Symfony\Component\HttpFoundation\BinaryFileResponse; /** * @group integration */ -class InvoiceControllerTest extends ControllerBaseTest +class InvoiceControllerTest extends AbstractControllerBaseTestCase { protected function setUp(): void { @@ -76,7 +76,7 @@ class InvoiceControllerTest extends ControllerBaseTest $id = $templates[0]->getId(); $this->request($client, '/invoice/?customers[]=1&template=' . $id); - $this->assertTrue($client->getResponse()->isSuccessful()); + self::assertTrue($client->getResponse()->isSuccessful()); $this->assertHasNoEntriesWithFilter($client); } @@ -90,7 +90,7 @@ class InvoiceControllerTest extends ControllerBaseTest $this->request($client, '/invoice/template'); - $this->assertTrue($client->getResponse()->isSuccessful()); + self::assertTrue($client->getResponse()->isSuccessful()); $this->assertHasDataTable($client); } @@ -98,7 +98,7 @@ class InvoiceControllerTest extends ControllerBaseTest { $client = $this->getClientForAuthenticatedUser(User::ROLE_ADMIN); $this->request($client, '/invoice/template/create'); - $this->assertTrue($client->getResponse()->isSuccessful()); + self::assertTrue($client->getResponse()->isSuccessful()); $form = $client->getCrawler()->filter('form[name=invoice_template_form]')->form(); $client->submit($form, [ @@ -114,7 +114,7 @@ class InvoiceControllerTest extends ControllerBaseTest $this->assertIsRedirect($client, $this->createUrl('/invoice/template')); $client->followRedirect(); - $this->assertTrue($client->getResponse()->isSuccessful()); + self::assertTrue($client->getResponse()->isSuccessful()); $this->assertHasFlashSuccess($client); $template = $this->getEntityManager()->getRepository(InvoiceTemplate::class)->findAll()[0]; @@ -136,19 +136,19 @@ class InvoiceControllerTest extends ControllerBaseTest $template = $templates[0]; $this->request($client, '/invoice/template/create/' . $template->getId()); - $this->assertTrue($client->getResponse()->isSuccessful()); + self::assertTrue($client->getResponse()->isSuccessful()); $form = $client->getCrawler()->filter('form[name=invoice_template_form]')->form(); $values = $form->getPhpValues()['invoice_template_form']; - $this->assertEquals($template->getName() . ' (1)', $values['name']); - $this->assertEquals($template->getTitle(), $values['title']); - $this->assertEquals($template->getDueDays(), $values['dueDays']); - $this->assertEquals($template->getCalculator(), $values['calculator']); - $this->assertEquals($template->getVat(), $values['vat']); - $this->assertEquals($template->getRenderer(), $values['renderer']); - $this->assertEquals($template->getCompany(), $values['company']); - $this->assertEquals($template->getAddress(), $values['address']); - $this->assertEquals($template->getPaymentTerms(), $values['paymentTerms']); + self::assertEquals($template->getName() . ' (1)', $values['name']); + self::assertEquals($template->getTitle(), $values['title']); + self::assertEquals($template->getDueDays(), $values['dueDays']); + self::assertEquals($template->getCalculator(), $values['calculator']); + self::assertEquals($template->getVat(), $values['vat']); + self::assertEquals($template->getRenderer(), $values['renderer']); + self::assertEquals($template->getCompany(), $values['company']); + self::assertEquals($template->getAddress(), $values['address']); + self::assertEquals($template->getPaymentTerms(), $values['paymentTerms']); } public function testCreateAction(): void @@ -170,11 +170,11 @@ class InvoiceControllerTest extends ControllerBaseTest ; $timesheets = $this->importFixture($fixture); foreach ($timesheets as $timesheet) { - $this->assertFalse($timesheet->isExported()); + self::assertFalse($timesheet->isExported()); } $this->request($client, '/invoice/'); - $this->assertTrue($client->getResponse()->isSuccessful()); + self::assertTrue($client->getResponse()->isSuccessful()); $dateRange = $this->formatDateRange($begin, $end); @@ -188,11 +188,11 @@ class InvoiceControllerTest extends ControllerBaseTest 'customers' => [1], ]); - $this->assertTrue($client->getResponse()->isSuccessful()); + self::assertTrue($client->getResponse()->isSuccessful()); // no warning should be displayed $node = $client->getCrawler()->filter('div.callout.callout-warning.lead'); - $this->assertEquals(0, $node->count()); + self::assertEquals(0, $node->count()); // but the datatable with all timesheets $this->assertDataTableRowCount($client, 'datatable_invoice_create', 20); @@ -208,16 +208,16 @@ class InvoiceControllerTest extends ControllerBaseTest $this->request($client, $action); $this->assertIsRedirect($client, '/invoice/show?id=', false); $client->followRedirect(); - $this->assertTrue($client->getResponse()->isSuccessful()); + self::assertTrue($client->getResponse()->isSuccessful()); $this->assertDataTableRowCount($client, 'datatable_invoices', 1); $em = $this->getEntityManager(); $em->clear(); $timesheets = $em->getRepository(Timesheet::class)->findAll(); - $this->assertCount(20, $timesheets); + self::assertCount(20, $timesheets); /** @var Timesheet $timesheet */ foreach ($timesheets as $timesheet) { - $this->assertTrue($timesheet->isExported()); + self::assertTrue($timesheet->isExported()); } } @@ -240,7 +240,7 @@ class InvoiceControllerTest extends ControllerBaseTest $this->importFixture($fixture); $this->request($client, '/invoice/'); - $this->assertTrue($client->getResponse()->isSuccessful()); + self::assertTrue($client->getResponse()->isSuccessful()); $dateRange = $this->formatDateRange($begin, $end); @@ -254,7 +254,7 @@ class InvoiceControllerTest extends ControllerBaseTest 'customers' => [1], ]); - $this->assertTrue($client->getResponse()->isSuccessful()); + self::assertTrue($client->getResponse()->isSuccessful()); $params = [ 'daterange' => $dateRange, @@ -267,13 +267,13 @@ class InvoiceControllerTest extends ControllerBaseTest $action = '/invoice/preview/1/' . $token . '?' . http_build_query($params); $this->request($client, $action); - $this->assertTrue($client->getResponse()->isSuccessful()); + self::assertTrue($client->getResponse()->isSuccessful()); $node = $client->getCrawler()->filter('body'); - $this->assertEquals(1, $node->count()); + self::assertEquals(1, $node->count()); /** @var \DOMElement $element */ $element = $node->getIterator()[0]; - $this->assertEquals('invoice_print', $element->getAttribute('class')); + self::assertEquals('invoice_print', $element->getAttribute('class')); } public function testCreateActionAsAdminWithDownloadAndStatusChange(): void @@ -295,7 +295,7 @@ class InvoiceControllerTest extends ControllerBaseTest $this->importFixture($fixture); $this->request($client, '/invoice/'); - $this->assertTrue($client->getResponse()->isSuccessful()); + self::assertTrue($client->getResponse()->isSuccessful()); $dateRange = $this->formatDateRange($begin, $end); @@ -309,11 +309,11 @@ class InvoiceControllerTest extends ControllerBaseTest 'customers' => [1], ]); - $this->assertTrue($client->getResponse()->isSuccessful()); + self::assertTrue($client->getResponse()->isSuccessful()); // no warning should be displayed $node = $client->getCrawler()->filter('div.callout.callout-warning.lead'); - $this->assertEquals(0, $node->count()); + self::assertEquals(0, $node->count()); // but the datatable with all timesheets $this->assertDataTableRowCount($client, 'datatable_invoice_create', 20); @@ -331,7 +331,7 @@ class InvoiceControllerTest extends ControllerBaseTest $this->assertIsRedirect($client, '/invoice/show?id=', false); $client->followRedirect(); - $this->assertTrue($client->getResponse()->isSuccessful()); + self::assertTrue($client->getResponse()->isSuccessful()); $invoices = $this->getEntityManager()->getRepository(Invoice::class)->findAll(); self::assertCount(1, $invoices); @@ -345,23 +345,23 @@ class InvoiceControllerTest extends ControllerBaseTest // make sure the invoice is saved $this->request($client, '/invoice/download/' . $id); $response = $client->getResponse(); - $this->assertTrue($response->isSuccessful()); + self::assertTrue($response->isSuccessful()); self::assertInstanceOf(BinaryFileResponse::class, $response); self::assertFileExists($response->getFile()); $this->request($client, '/invoice/show'); - $this->assertTrue($client->getResponse()->isSuccessful()); + self::assertTrue($client->getResponse()->isSuccessful()); $link = $client->getCrawler()->selectLink('Waiting for payment'); $this->request($client, $link->attr('href')); $this->assertIsRedirect($client, '/invoice/show'); $client->followRedirect(); - $this->assertTrue($client->getResponse()->isSuccessful()); + self::assertTrue($client->getResponse()->isSuccessful()); $link = $client->getCrawler()->selectLink('Invoice paid'); $url = $link->attr('href'); $this->request($client, $url); - $this->assertTrue($client->getResponse()->isSuccessful()); + self::assertTrue($client->getResponse()->isSuccessful()); $this->assertHasValidationError( $client, @@ -375,7 +375,7 @@ class InvoiceControllerTest extends ControllerBaseTest ['#invoice_edit_form_paymentDate'] ); - $this->assertTrue($client->getResponse()->isSuccessful()); + self::assertTrue($client->getResponse()->isSuccessful()); $form = $client->getCrawler()->filter('form[name=invoice_edit_form]')->form(); $client->submit($form, [ @@ -386,13 +386,13 @@ class InvoiceControllerTest extends ControllerBaseTest $this->assertIsRedirect($client, '/invoice/show'); $client->followRedirect(); - $this->assertTrue($client->getResponse()->isSuccessful()); + self::assertTrue($client->getResponse()->isSuccessful()); $token = $this->getCsrfToken($client, 'invoice.status'); $this->request($client, '/invoice/change-status/' . $id . '/new/' . $token->getValue()); $this->assertIsRedirect($client, '/invoice/show'); $client->followRedirect(); - $this->assertTrue($client->getResponse()->isSuccessful()); + self::assertTrue($client->getResponse()->isSuccessful()); } public function testEditTemplateAction(): void @@ -417,7 +417,7 @@ class InvoiceControllerTest extends ControllerBaseTest $this->assertIsRedirect($client, $this->createUrl('/invoice/template')); $client->followRedirect(); - $this->assertTrue($client->getResponse()->isSuccessful()); + self::assertTrue($client->getResponse()->isSuccessful()); $this->assertHasFlashSuccess($client); } @@ -438,10 +438,10 @@ class InvoiceControllerTest extends ControllerBaseTest $this->assertIsRedirect($client, '/invoice/template'); $client->followRedirect(); - $this->assertTrue($client->getResponse()->isSuccessful()); + self::assertTrue($client->getResponse()->isSuccessful()); $this->assertHasFlashSuccess($client); - $this->assertEquals(0, $this->getEntityManager()->getRepository(InvoiceTemplate::class)->count([])); + self::assertEquals(0, $this->getEntityManager()->getRepository(InvoiceTemplate::class)->count([])); } public function testUploadDocumentAction(): void @@ -452,7 +452,7 @@ class InvoiceControllerTest extends ControllerBaseTest $this->importFixture($fixture); $this->request($client, '/invoice/document_upload'); - $this->assertTrue($client->getResponse()->isSuccessful()); + self::assertTrue($client->getResponse()->isSuccessful()); $node = $client->getCrawler()->filter('form[name=invoice_document_upload_form]'); self::assertEquals(1, $node->count(), 'Could not find upload form'); diff --git a/tests/Controller/LayoutControllerTest.php b/tests/Controller/LayoutControllerTest.php index ee54746f..979ea021 100644 --- a/tests/Controller/LayoutControllerTest.php +++ b/tests/Controller/LayoutControllerTest.php @@ -15,7 +15,7 @@ use Symfony\Component\HttpKernel\HttpKernelBrowser; /** * @group integration */ -class LayoutControllerTest extends ControllerBaseTest +class LayoutControllerTest extends AbstractControllerBaseTestCase { public function testNavigationMenus(): void { @@ -24,7 +24,7 @@ class LayoutControllerTest extends ControllerBaseTest $user = $this->getUserByRole(User::ROLE_USER); $this->request($client, '/dashboard/'); - $this->assertTrue($client->getResponse()->isSuccessful()); + self::assertTrue($client->getResponse()->isSuccessful()); $this->assertHasMainHeader($client, $user); $this->assertHasNavigation($client); @@ -34,22 +34,22 @@ class LayoutControllerTest extends ControllerBaseTest { $content = $client->getResponse()->getContent(); - $this->assertStringContainsString('data-bs-toggle="dropdown" aria-label="Open personal menu"', $content); - $this->assertStringContainsString('href="/en/profile/' . $user->getUserIdentifier() . '"', $content); - $this->assertStringContainsString('href="/en/profile/' . $user->getUserIdentifier() . '/edit"', $content); - $this->assertStringContainsString('href="/en/profile/' . $user->getUserIdentifier() . '/prefs"', $content); - $this->assertStringContainsString('href="/en/logout', $content); + self::assertStringContainsString('data-bs-toggle="dropdown" aria-label="Open personal menu"', $content); + self::assertStringContainsString('href="/en/profile/' . $user->getUserIdentifier() . '"', $content); + self::assertStringContainsString('href="/en/profile/' . $user->getUserIdentifier() . '/edit"', $content); + self::assertStringContainsString('href="/en/profile/' . $user->getUserIdentifier() . '/prefs"', $content); + self::assertStringContainsString('href="/en/logout', $content); } protected function assertHasNavigation(HttpKernelBrowser $client): void { $content = $client->getResponse()->getContent(); - $this->assertStringContainsString('href="/en/dashboard/"', $content); - $this->assertStringContainsString('href="/en/timesheet/"', $content); - $this->assertStringContainsString('My times', $content); - $this->assertStringContainsString('href="/en/calendar/"', $content); - $this->assertStringContainsString('Calendar', $content); + self::assertStringContainsString('href="/en/dashboard/"', $content); + self::assertStringContainsString('href="/en/timesheet/"', $content); + self::assertStringContainsString('My times', $content); + self::assertStringContainsString('href="/en/calendar/"', $content); + self::assertStringContainsString('Calendar', $content); } public function testActiveEntries(): void @@ -57,10 +57,10 @@ class LayoutControllerTest extends ControllerBaseTest $client = $this->getClientForAuthenticatedUser(User::ROLE_USER); $this->request($client, '/dashboard/'); - $this->assertTrue($client->getResponse()->isSuccessful()); + self::assertTrue($client->getResponse()->isSuccessful()); $content = $client->getResponse()->getContent(); - $this->assertStringContainsString('<a title="Start time-tracking" href="/en/timesheet/create" class="modal-ajax-form ticktac-start btn', $content); + self::assertStringContainsString('<a title="Start time-tracking" href="/en/timesheet/create" class="modal-ajax-form ticktac-start btn', $content); } } diff --git a/tests/Controller/PermissionControllerTest.php b/tests/Controller/PermissionControllerTest.php index 0749d2e5..3f89a95e 100644 --- a/tests/Controller/PermissionControllerTest.php +++ b/tests/Controller/PermissionControllerTest.php @@ -17,7 +17,7 @@ use App\Entity\User; /** * @group integration */ -class PermissionControllerTest extends ControllerBaseTest +class PermissionControllerTest extends AbstractControllerBaseTestCase { public function testIsSecure(): void { @@ -135,10 +135,10 @@ class PermissionControllerTest extends ControllerBaseTest ]); $this->assertIsRedirect($client, $this->createUrl('/profile/' . urlencode(UserFixtures::USERNAME_USER) . '/roles')); $client->followRedirect(); - $this->assertTrue($client->getResponse()->isSuccessful()); + self::assertTrue($client->getResponse()->isSuccessful()); $user = $this->getUserByName(UserFixtures::USERNAME_USER); - $this->assertEquals(['ROLE_TEAMLEAD', 'ROLE_SUPER_ADMIN', 'TEST_ROLE', 'ROLE_USER'], $user->getRoles()); + self::assertEquals(['ROLE_TEAMLEAD', 'ROLE_SUPER_ADMIN', 'TEST_ROLE', 'ROLE_USER'], $user->getRoles()); $this->request($client, '/admin/permissions'); $node = $client->getCrawler()->filter('div.card .card-title a.confirmation-link'); @@ -154,7 +154,7 @@ class PermissionControllerTest extends ControllerBaseTest // verify that role was removed from user $user = $this->getUserByName(UserFixtures::USERNAME_USER); - $this->assertEquals(['ROLE_TEAMLEAD', 'ROLE_SUPER_ADMIN', 'ROLE_USER'], $user->getRoles()); + self::assertEquals(['ROLE_TEAMLEAD', 'ROLE_SUPER_ADMIN', 'ROLE_USER'], $user->getRoles()); } public function testSavePermissionIsSecured(): void @@ -191,7 +191,7 @@ class PermissionControllerTest extends ControllerBaseTest $em = $this->getEntityManager(); $rolePermissions = $em->getRepository(RolePermission::class)->findAll(); - $this->assertEquals(0, \count($rolePermissions)); + self::assertEquals(0, \count($rolePermissions)); $roles = $em->getRepository(Role::class)->findAll(); $id = null; @@ -212,7 +212,7 @@ class PermissionControllerTest extends ControllerBaseTest self::assertArrayHasKey('token', $result); $rolePermissions = $em->getRepository(RolePermission::class)->findAll(); - $this->assertCount(1, $rolePermissions); + self::assertCount(1, $rolePermissions); $permission = $rolePermissions[0]; self::assertInstanceOf(RolePermission::class, $permission); self::assertEquals('view_user', $permission->getPermission()); @@ -232,7 +232,7 @@ class PermissionControllerTest extends ControllerBaseTest self::assertArrayHasKey('token', $result); $rolePermissions = $em->getRepository(RolePermission::class)->findAll(); - $this->assertEquals(1, \count($rolePermissions)); + self::assertEquals(1, \count($rolePermissions)); $permission = $rolePermissions[0]; self::assertInstanceOf(RolePermission::class, $permission); self::assertEquals('view_user', $permission->getPermission()); diff --git a/tests/Controller/PluginControllerTest.php b/tests/Controller/PluginControllerTest.php index 1399e156..4647fa9d 100644 --- a/tests/Controller/PluginControllerTest.php +++ b/tests/Controller/PluginControllerTest.php @@ -16,7 +16,7 @@ use App\Tests\Plugin\Fixtures\TestPlugin\TestPlugin; /** * @group integration */ -class PluginControllerTest extends ControllerBaseTest +class PluginControllerTest extends AbstractControllerBaseTestCase { public function testIsSecure(): void { diff --git a/tests/Controller/ProfileControllerTest.php b/tests/Controller/ProfileControllerTest.php index 91b5ce4e..56528a0c 100644 --- a/tests/Controller/ProfileControllerTest.php +++ b/tests/Controller/ProfileControllerTest.php @@ -22,7 +22,7 @@ use Symfony\Component\PasswordHasher\Hasher\PasswordHasherFactoryInterface; /** * @group integration */ -class ProfileControllerTest extends ControllerBaseTest +class ProfileControllerTest extends AbstractControllerBaseTestCase { public function testIsSecure(): void { @@ -40,16 +40,16 @@ class ProfileControllerTest extends ControllerBaseTest { $client = $this->getClientForAuthenticatedUser(User::ROLE_USER); $this->request($client, '/profile/' . UserFixtures::USERNAME_USER); - $this->assertTrue($client->getResponse()->isSuccessful()); + self::assertTrue($client->getResponse()->isSuccessful()); $this->assertHasProfileBox($client, 'John Doe'); $this->assertHasAboutMeBox($client, UserFixtures::USERNAME_USER); $content = $client->getResponse()->getContent(); $year = (new \DateTime())->format('Y'); - $this->assertStringContainsString('<h3 class="card-title">' . $year, $content); - $this->assertStringContainsString('new Chart(', $content); - $this->assertStringContainsString('<canvas id="userProfileChart' . $year . '"', $content); + self::assertStringContainsString('<h3 class="card-title">' . $year, $content); + self::assertStringContainsString('new Chart(', $content); + self::assertStringContainsString('<canvas id="userProfileChart' . $year . '"', $content); } public function testIndexAction(): void @@ -70,13 +70,13 @@ class ProfileControllerTest extends ControllerBaseTest } $this->request($client, '/profile/' . UserFixtures::USERNAME_USER); - $this->assertTrue($client->getResponse()->isSuccessful()); + self::assertTrue($client->getResponse()->isSuccessful()); $content = $client->getResponse()->getContent(); foreach ($dates as $start) { $year = $start->format('Y'); - $this->assertStringContainsString('<h3 class="card-title">' . $year, $content); - $this->assertStringContainsString('<canvas id="userProfileChart' . $year . '"', $content); + self::assertStringContainsString('<h3 class="card-title">' . $year, $content); + self::assertStringContainsString('<canvas id="userProfileChart' . $year . '"', $content); } $this->assertHasProfileBox($client, 'John Doe'); @@ -86,19 +86,19 @@ class ProfileControllerTest extends ControllerBaseTest protected function assertHasProfileBox(HttpKernelBrowser $client, string $username): void { $profileBox = $client->getCrawler()->filter('div.box-user-profile'); - $this->assertEquals(1, $profileBox->count()); + self::assertEquals(1, $profileBox->count()); $profileAvatar = $profileBox->filter('span.avatar'); - $this->assertEquals(1, $profileAvatar->count()); + self::assertEquals(1, $profileAvatar->count()); } protected function assertHasAboutMeBox(HttpKernelBrowser $client, string $username): void { $content = $client->getResponse()->getContent(); - $this->assertStringContainsString('<div class="datagrid-content">' . $username . '</div>', $content); + self::assertStringContainsString('<div class="datagrid-content">' . $username . '</div>', $content); } - public function getTabTestData(): array + public static function getTabTestData(): array { return [ [User::ROLE_USER, UserFixtures::USERNAME_USER], @@ -113,14 +113,14 @@ class ProfileControllerTest extends ControllerBaseTest { $client = $this->getClientForAuthenticatedUser($role); $this->request($client, '/profile/' . $username . '/edit'); - $this->assertTrue($client->getResponse()->isSuccessful()); + self::assertTrue($client->getResponse()->isSuccessful()); } public function testIndexActionWithDifferentUsername(): void { $client = $this->getClientForAuthenticatedUser(); $this->request($client, '/profile/' . UserFixtures::USERNAME_TEAMLEAD); - $this->assertFalse($client->getResponse()->isSuccessful()); + self::assertFalse($client->getResponse()->isSuccessful()); } public function testEditAction(): void @@ -131,11 +131,11 @@ class ProfileControllerTest extends ControllerBaseTest /** @var User $user */ $user = $this->getUserByRole(User::ROLE_USER); - $this->assertEquals(UserFixtures::USERNAME_USER, $user->getUserIdentifier()); - $this->assertEquals('John Doe', $user->getAlias()); - $this->assertEquals('Developer', $user->getTitle()); - $this->assertEquals('john_user@example.com', $user->getEmail()); - $this->assertTrue($user->isEnabled()); + self::assertEquals(UserFixtures::USERNAME_USER, $user->getUserIdentifier()); + self::assertEquals('John Doe', $user->getAlias()); + self::assertEquals('Developer', $user->getTitle()); + self::assertEquals('john_user@example.com', $user->getEmail()); + self::assertTrue($user->isEnabled()); $form = $client->getCrawler()->filter('form[name=user_edit]')->form(); $client->submit($form, [ @@ -148,17 +148,17 @@ class ProfileControllerTest extends ControllerBaseTest $this->assertIsRedirect($client, $this->createUrl('/profile/' . urlencode(UserFixtures::USERNAME_USER) . '/edit')); $client->followRedirect(); - $this->assertTrue($client->getResponse()->isSuccessful()); + self::assertTrue($client->getResponse()->isSuccessful()); $this->assertHasFlashSuccess($client); $user = $this->getUserByRole(User::ROLE_USER); - $this->assertEquals(UserFixtures::USERNAME_USER, $user->getUserIdentifier()); - $this->assertEquals('Johnny', $user->getAlias()); - $this->assertEquals('Code Monkey', $user->getTitle()); - $this->assertEquals('updated@example.com', $user->getEmail()); - $this->assertTrue($user->isEnabled()); + self::assertEquals(UserFixtures::USERNAME_USER, $user->getUserIdentifier()); + self::assertEquals('Johnny', $user->getAlias()); + self::assertEquals('Code Monkey', $user->getTitle()); + self::assertEquals('updated@example.com', $user->getEmail()); + self::assertTrue($user->isEnabled()); } public function testEditActionWithActiveFlag(): void @@ -178,17 +178,17 @@ class ProfileControllerTest extends ControllerBaseTest $this->assertIsRedirect($client, $this->createUrl('/profile/' . urlencode(UserFixtures::USERNAME_USER) . '/edit')); $client->followRedirect(); - $this->assertTrue($client->getResponse()->isSuccessful()); + self::assertTrue($client->getResponse()->isSuccessful()); $this->assertHasFlashSuccess($client); $user = $this->getUserByRole(User::ROLE_USER); - $this->assertEquals(UserFixtures::USERNAME_USER, $user->getUserIdentifier()); - $this->assertEquals('Johnny', $user->getAlias()); - $this->assertEquals('Code Monkey', $user->getTitle()); - $this->assertEquals('updated@example.com', $user->getEmail()); - $this->assertFalse($user->isEnabled()); + self::assertEquals(UserFixtures::USERNAME_USER, $user->getUserIdentifier()); + self::assertEquals('Johnny', $user->getAlias()); + self::assertEquals('Code Monkey', $user->getTitle()); + self::assertEquals('updated@example.com', $user->getEmail()); + self::assertFalse($user->isEnabled()); } public function testPasswordAction(): void @@ -202,9 +202,9 @@ class ProfileControllerTest extends ControllerBaseTest /** @var PasswordHasherFactoryInterface $passwordEncoder */ $passwordEncoder = self::getContainer()->get('security.password_hasher_factory'); - $this->assertTrue($passwordEncoder->getPasswordHasher($user)->verify($user->getPassword(), UserFixtures::DEFAULT_PASSWORD)); - $this->assertFalse($passwordEncoder->getPasswordHasher($user)->verify($user->getPassword(), 'test123')); - $this->assertEquals(UserFixtures::USERNAME_USER, $user->getUserIdentifier()); + self::assertTrue($passwordEncoder->getPasswordHasher($user)->verify($user->getPassword(), UserFixtures::DEFAULT_PASSWORD)); + self::assertFalse($passwordEncoder->getPasswordHasher($user)->verify($user->getPassword(), 'test123')); + self::assertEquals(UserFixtures::USERNAME_USER, $user->getUserIdentifier()); $form = $client->getCrawler()->filter('form[name=user_password]')->form(); $client->submit($form, [ @@ -221,8 +221,8 @@ class ProfileControllerTest extends ControllerBaseTest // are the old ones, so following the redirect would fail with "Unauthorized". $user = $this->getUserByRole(User::ROLE_USER); - $this->assertFalse($passwordEncoder->getPasswordHasher($user)->verify($user->getPassword(), UserFixtures::DEFAULT_PASSWORD)); - $this->assertTrue($passwordEncoder->getPasswordHasher($user)->verify($user->getPassword(), 'test1234')); + self::assertFalse($passwordEncoder->getPasswordHasher($user)->verify($user->getPassword(), UserFixtures::DEFAULT_PASSWORD)); + self::assertTrue($passwordEncoder->getPasswordHasher($user)->verify($user->getPassword(), 'test1234')); } public function testPasswordActionFailsIfPasswordLengthToShort(): void @@ -256,9 +256,9 @@ class ProfileControllerTest extends ControllerBaseTest /** @var PasswordHasherFactoryInterface $passwordEncoder */ $passwordEncoder = self::getContainer()->get('security.password_hasher_factory'); - $this->assertTrue($passwordEncoder->getPasswordHasher($user)->verify($user->getApiToken(), UserFixtures::DEFAULT_API_TOKEN)); - $this->assertFalse($passwordEncoder->getPasswordHasher($user)->verify($user->getApiToken(), 'test1234')); - $this->assertEquals(UserFixtures::USERNAME_USER, $user->getUserIdentifier()); + self::assertTrue($passwordEncoder->getPasswordHasher($user)->verify($user->getApiToken(), UserFixtures::DEFAULT_API_TOKEN)); + self::assertFalse($passwordEncoder->getPasswordHasher($user)->verify($user->getApiToken(), 'test1234')); + self::assertEquals(UserFixtures::USERNAME_USER, $user->getUserIdentifier()); $form = $client->getCrawler()->filter('form[name=user_api_password]')->form(); $client->submit($form, [ @@ -272,14 +272,14 @@ class ProfileControllerTest extends ControllerBaseTest $this->assertIsRedirect($client, $this->createUrl('/profile/' . urlencode(UserFixtures::USERNAME_USER) . '/api-token')); $client->followRedirect(); - $this->assertTrue($client->getResponse()->isSuccessful()); + self::assertTrue($client->getResponse()->isSuccessful()); $this->assertHasFlashSuccess($client); $user = $this->getUserByRole(User::ROLE_USER); - $this->assertFalse($passwordEncoder->getPasswordHasher($user)->verify($user->getApiToken(), UserFixtures::DEFAULT_API_TOKEN)); - $this->assertTrue($passwordEncoder->getPasswordHasher($user)->verify($user->getApiToken(), 'test1234')); + self::assertFalse($passwordEncoder->getPasswordHasher($user)->verify($user->getApiToken(), UserFixtures::DEFAULT_API_TOKEN)); + self::assertTrue($passwordEncoder->getPasswordHasher($user)->verify($user->getApiToken(), 'test1234')); } public function testApiTokenActionFailsIfPasswordLengthToShort(): void @@ -304,7 +304,7 @@ class ProfileControllerTest extends ControllerBaseTest { $client = $this->getClientForAuthenticatedUser(User::ROLE_TEAMLEAD); $this->request($client, '/profile/' . UserFixtures::USERNAME_USER . '/roles'); - $this->assertFalse($client->getResponse()->isSuccessful()); + self::assertFalse($client->getResponse()->isSuccessful()); } public function testRolesAction(): void @@ -315,7 +315,7 @@ class ProfileControllerTest extends ControllerBaseTest /** @var User $user */ $user = $this->getUserByRole(User::ROLE_USER); - $this->assertEquals(['ROLE_USER'], $user->getRoles()); + self::assertEquals(['ROLE_USER'], $user->getRoles()); $form = $client->getCrawler()->filter('form[name=user_roles]')->form(); $client->submit($form, [ @@ -327,13 +327,13 @@ class ProfileControllerTest extends ControllerBaseTest $this->assertIsRedirect($client, $this->createUrl('/profile/' . urlencode(UserFixtures::USERNAME_USER) . '/roles')); $client->followRedirect(); - $this->assertTrue($client->getResponse()->isSuccessful()); + self::assertTrue($client->getResponse()->isSuccessful()); $this->assertHasFlashSuccess($client); $user = $this->getUserByRole(User::ROLE_USER); - $this->assertEquals(['ROLE_TEAMLEAD', 'ROLE_SUPER_ADMIN', 'ROLE_USER'], $user->getRoles()); + self::assertEquals(['ROLE_TEAMLEAD', 'ROLE_SUPER_ADMIN', 'ROLE_USER'], $user->getRoles()); } public function testTeamsActionIsSecured(): void @@ -364,7 +364,7 @@ class ProfileControllerTest extends ControllerBaseTest /** @var User $user */ $user = $this->getUserByRole(User::ROLE_USER); - $this->assertEquals([], $user->getTeams()); + self::assertEquals([], $user->getTeams()); $form = $client->getCrawler()->filter('form[name=user_teams]')->form(); /** @var ChoiceFormField $team */ @@ -375,16 +375,16 @@ class ProfileControllerTest extends ControllerBaseTest $this->assertIsRedirect($client, $this->createUrl('/profile/' . urlencode(UserFixtures::USERNAME_USER) . '/teams')); $client->followRedirect(); - $this->assertTrue($client->getResponse()->isSuccessful()); + self::assertTrue($client->getResponse()->isSuccessful()); $this->assertHasFlashSuccess($client); $user = $this->getUserByRole(User::ROLE_USER); - $this->assertCount(1, $user->getTeams()); + self::assertCount(1, $user->getTeams()); } - public function getPreferencesTestData(): array + public static function getPreferencesTestData(): array { return [ // assert that the user doesn't have the "hourly-rate_own_profile" permission @@ -411,9 +411,9 @@ class ProfileControllerTest extends ControllerBaseTest /** @var User $user */ $user = $this->getUserByName($username); - $this->assertEquals($hourlyRateOriginal, $user->getPreferenceValue(UserPreference::HOURLY_RATE)); - $this->assertNull($user->getPreferenceValue(UserPreference::INTERNAL_RATE)); - $this->assertEquals('default', $user->getPreferenceValue(UserPreference::SKIN)); + self::assertEquals($hourlyRateOriginal, $user->getPreferenceValue(UserPreference::HOURLY_RATE)); + self::assertNull($user->getPreferenceValue(UserPreference::INTERNAL_RATE)); + self::assertEquals('default', $user->getPreferenceValue(UserPreference::SKIN)); $data = [ UserPreference::TIMEZONE => ['value' => 'America/Creston'], @@ -439,23 +439,23 @@ class ProfileControllerTest extends ControllerBaseTest $this->assertIsRedirect($client, $targetUrl); $client->followRedirect(); - $this->assertTrue($client->getResponse()->isSuccessful()); + self::assertTrue($client->getResponse()->isSuccessful()); $this->assertHasFlashSuccess($client); $user = $this->getUserByName($username); - $this->assertEquals($hourlyRate, $user->getPreferenceValue(UserPreference::HOURLY_RATE)); - $this->assertEquals($expectedInternalRate, $user->getPreferenceValue(UserPreference::INTERNAL_RATE)); - $this->assertEquals('America/Creston', $user->getPreferenceValue(UserPreference::TIMEZONE)); - $this->assertEquals('America/Creston', $user->getTimezone()); - $this->assertEquals('ar', $user->getPreferenceValue(UserPreference::LANGUAGE)); - $this->assertEquals('ru', $user->getPreferenceValue(UserPreference::LOCALE)); - $this->assertEquals('ru', $user->getLocale()); - $this->assertEquals('ar', $user->getLanguage()); - $this->assertEquals('dark', $user->getPreferenceValue(UserPreference::SKIN)); - $this->assertEquals('sunday', $user->getPreferenceValue(UserPreference::FIRST_WEEKDAY)); - $this->assertEquals('sunday', $user->getFirstDayOfWeek()); + self::assertEquals($hourlyRate, $user->getPreferenceValue(UserPreference::HOURLY_RATE)); + self::assertEquals($expectedInternalRate, $user->getPreferenceValue(UserPreference::INTERNAL_RATE)); + self::assertEquals('America/Creston', $user->getPreferenceValue(UserPreference::TIMEZONE)); + self::assertEquals('America/Creston', $user->getTimezone()); + self::assertEquals('ar', $user->getPreferenceValue(UserPreference::LANGUAGE)); + self::assertEquals('ru', $user->getPreferenceValue(UserPreference::LOCALE)); + self::assertEquals('ru', $user->getLocale()); + self::assertEquals('ar', $user->getLanguage()); + self::assertEquals('dark', $user->getPreferenceValue(UserPreference::SKIN)); + self::assertEquals('sunday', $user->getPreferenceValue(UserPreference::FIRST_WEEKDAY)); + self::assertEquals('sunday', $user->getFirstDayOfWeek()); } public function testIsTwoFactorSecure(): void @@ -471,17 +471,17 @@ class ProfileControllerTest extends ControllerBaseTest self::assertFalse($user->hasTotpSecret()); $this->request($client, '/profile/' . UserFixtures::USERNAME_USER . '/2fa'); - $this->assertTrue($client->getResponse()->isSuccessful()); + self::assertTrue($client->getResponse()->isSuccessful()); $user = $this->getUserByName(UserFixtures::USERNAME_USER); self::assertTrue($user->hasTotpSecret()); $formUrl = $this->createUrl('/profile/' . UserFixtures::USERNAME_USER . '/2fa'); $content = $client->getResponse()->getContent(); - $this->assertNotFalse($content); + self::assertNotFalse($content); - $this->assertStringContainsString(' data-toggle="tooltip" title="Click to show code" alt="TOTP QR Code" style="max-width: 200px; max-height: 200px;" src="', $content); - $this->assertStringContainsString('<form name="user_two_factor" method="post" action="' . $formUrl . '" id="user_two_factor_form">', $content); + self::assertStringContainsString(' data-toggle="tooltip" title="Click to show code" alt="TOTP QR Code" style="max-width: 200px; max-height: 200px;" src="', $content); + self::assertStringContainsString('<form name="user_two_factor" method="post" action="' . $formUrl . '" id="user_two_factor_form">', $content); } public function testTwoFactorAsAdmin(): void @@ -494,14 +494,14 @@ class ProfileControllerTest extends ControllerBaseTest $client = $this->getClientForAuthenticatedUser(User::ROLE_SUPER_ADMIN); $this->request($client, '/profile/' . UserFixtures::USERNAME_USER . '/2fa'); - $this->assertTrue($client->getResponse()->isSuccessful()); + self::assertTrue($client->getResponse()->isSuccessful()); $content = $client->getResponse()->getContent(); - $this->assertNotFalse($content); + self::assertNotFalse($content); $formUrl = $this->createUrl('/profile/' . UserFixtures::USERNAME_USER . '/2fa'); - $this->assertStringContainsString(' data-toggle="tooltip" title="Click to show code" alt="TOTP QR Code" style="max-width: 200px; max-height: 200px;" src="', $content); - $this->assertStringContainsString('<form name="user_two_factor" method="post" action="' . $formUrl . '" id="user_two_factor_form">', $content); + self::assertStringContainsString(' data-toggle="tooltip" title="Click to show code" alt="TOTP QR Code" style="max-width: 200px; max-height: 200px;" src="', $content); + self::assertStringContainsString('<form name="user_two_factor" method="post" action="' . $formUrl . '" id="user_two_factor_form">', $content); } public function testActivateTwoFactorWithEmptyToken(): void @@ -543,25 +543,25 @@ class ProfileControllerTest extends ControllerBaseTest { $client = $this->getClientForAuthenticatedUser(User::ROLE_TEAMLEAD); $this->request($client, '/profile/' . UserFixtures::USERNAME_USER . '/contract'); - $this->assertFalse($client->getResponse()->isSuccessful()); + self::assertFalse($client->getResponse()->isSuccessful()); } public function testContractAction(): void { $client = $this->getClientForAuthenticatedUser(User::ROLE_SUPER_ADMIN); $this->request($client, '/profile/' . UserFixtures::USERNAME_USER . '/contract'); - $this->assertTrue($client->getResponse()->isSuccessful()); + self::assertTrue($client->getResponse()->isSuccessful()); $user = $this->getUserByRole(User::ROLE_USER); $calculator = (new WorkingTimeModeDay())->getCalculator($user); - $this->assertEquals(0, $calculator->getWorkHoursForDay(new \DateTime('monday this week'))); - $this->assertEquals(0, $calculator->getWorkHoursForDay(new \DateTime('tuesday this week'))); - $this->assertEquals(0, $calculator->getWorkHoursForDay(new \DateTime('wednesday this week'))); - $this->assertEquals(0, $calculator->getWorkHoursForDay(new \DateTime('thursday this week'))); - $this->assertEquals(0, $calculator->getWorkHoursForDay(new \DateTime('friday this week'))); - $this->assertEquals(0, $calculator->getWorkHoursForDay(new \DateTime('saturday this week'))); - $this->assertEquals(0, $calculator->getWorkHoursForDay(new \DateTime('sunday this week'))); + self::assertEquals(0, $calculator->getWorkHoursForDay(new \DateTime('monday this week'))); + self::assertEquals(0, $calculator->getWorkHoursForDay(new \DateTime('tuesday this week'))); + self::assertEquals(0, $calculator->getWorkHoursForDay(new \DateTime('wednesday this week'))); + self::assertEquals(0, $calculator->getWorkHoursForDay(new \DateTime('thursday this week'))); + self::assertEquals(0, $calculator->getWorkHoursForDay(new \DateTime('friday this week'))); + self::assertEquals(0, $calculator->getWorkHoursForDay(new \DateTime('saturday this week'))); + self::assertEquals(0, $calculator->getWorkHoursForDay(new \DateTime('sunday this week'))); $form = $client->getCrawler()->filter('form[name=user_contract]')->form(); @@ -577,19 +577,19 @@ class ProfileControllerTest extends ControllerBaseTest $this->assertIsRedirect($client, $this->createUrl('/profile/' . urlencode(UserFixtures::USERNAME_USER) . '/contract')); $client->followRedirect(); - $this->assertTrue($client->getResponse()->isSuccessful()); + self::assertTrue($client->getResponse()->isSuccessful()); $this->assertHasFlashSuccess($client); $user = $this->getUserByRole(User::ROLE_USER); $calculator = (new WorkingTimeModeDay())->getCalculator($user); - $this->assertEquals(3600, $calculator->getWorkHoursForDay(new \DateTime('monday this week'))); - $this->assertEquals(7200, $calculator->getWorkHoursForDay(new \DateTime('tuesday this week'))); - $this->assertEquals(10800, $calculator->getWorkHoursForDay(new \DateTime('wednesday this week'))); - $this->assertEquals(16200, $calculator->getWorkHoursForDay(new \DateTime('thursday this week'))); - $this->assertEquals(18720, $calculator->getWorkHoursForDay(new \DateTime('friday this week'))); - $this->assertEquals(25140, $calculator->getWorkHoursForDay(new \DateTime('saturday this week'))); - $this->assertEquals(60, $calculator->getWorkHoursForDay(new \DateTime('sunday this week'))); + self::assertEquals(3600, $calculator->getWorkHoursForDay(new \DateTime('monday this week'))); + self::assertEquals(7200, $calculator->getWorkHoursForDay(new \DateTime('tuesday this week'))); + self::assertEquals(10800, $calculator->getWorkHoursForDay(new \DateTime('wednesday this week'))); + self::assertEquals(16200, $calculator->getWorkHoursForDay(new \DateTime('thursday this week'))); + self::assertEquals(18720, $calculator->getWorkHoursForDay(new \DateTime('friday this week'))); + self::assertEquals(25140, $calculator->getWorkHoursForDay(new \DateTime('saturday this week'))); + self::assertEquals(60, $calculator->getWorkHoursForDay(new \DateTime('sunday this week'))); } } diff --git a/tests/Controller/ProjectControllerTest.php b/tests/Controller/ProjectControllerTest.php index a2359ae2..604daacb 100644 --- a/tests/Controller/ProjectControllerTest.php +++ b/tests/Controller/ProjectControllerTest.php @@ -31,7 +31,7 @@ use Symfony\Component\HttpKernel\HttpKernelBrowser; /** * @group integration */ -class ProjectControllerTest extends ControllerBaseTest +class ProjectControllerTest extends AbstractControllerBaseTestCase { public function testIsSecure(): void { @@ -96,7 +96,7 @@ class ProjectControllerTest extends ControllerBaseTest 'page' => 1, ]); - $this->assertTrue($client->getResponse()->isSuccessful()); + self::assertTrue($client->getResponse()->isSuccessful()); $this->assertHasDataTable($client); $this->assertDataTableRowCount($client, 'datatable_project_admin', 5); } @@ -411,12 +411,12 @@ class ProjectControllerTest extends ControllerBaseTest $dispatcher = self::getContainer()->get('event_dispatcher'); $dispatcher->addSubscriber(new ProjectTestMetaFieldSubscriberMock()); $this->assertAccessIsGranted($client, '/admin/project/create'); - $this->assertTrue($client->getResponse()->isSuccessful()); + self::assertTrue($client->getResponse()->isSuccessful()); $form = $client->getCrawler()->filter('form[name=project_edit_form]')->form(); - $this->assertTrue($form->has('project_edit_form[metaFields][metatestmock][value]')); - $this->assertTrue($form->has('project_edit_form[metaFields][foobar][value]')); - $this->assertFalse($form->has('project_edit_form[metaFields][0][value]')); + self::assertTrue($form->has('project_edit_form[metaFields][metatestmock][value]')); + self::assertTrue($form->has('project_edit_form[metaFields][foobar][value]')); + self::assertFalse($form->has('project_edit_form[metaFields][0][value]')); } public function testEditAction(): void @@ -424,7 +424,7 @@ class ProjectControllerTest extends ControllerBaseTest $client = $this->getClientForAuthenticatedUser(User::ROLE_ADMIN); $this->assertAccessIsGranted($client, '/admin/project/1/edit'); $form = $client->getCrawler()->filter('form[name=project_edit_form]')->form(); - $this->assertEquals('Test', $form->get('project_edit_form[name]')->getValue()); + self::assertEquals('Test', $form->get('project_edit_form[name]')->getValue()); $client->submit($form, [ 'project_edit_form' => ['name' => 'Test 2'] ]); @@ -432,7 +432,7 @@ class ProjectControllerTest extends ControllerBaseTest $client->followRedirect(); $this->request($client, '/admin/project/1/edit'); $editForm = $client->getCrawler()->filter('form[name=project_edit_form]')->form(); - $this->assertEquals('Test 2', $editForm->get('project_edit_form[name]')->getValue()); + self::assertEquals('Test 2', $editForm->get('project_edit_form[name]')->getValue()); } public function testTeamPermissionAction(): void @@ -477,12 +477,12 @@ class ProjectControllerTest extends ControllerBaseTest $id = $projects[0]->getId(); $this->request($client, '/admin/project/' . $id . '/edit'); - $this->assertTrue($client->getResponse()->isSuccessful()); + self::assertTrue($client->getResponse()->isSuccessful()); $this->request($client, '/admin/project/' . $id . '/delete'); - $this->assertTrue($client->getResponse()->isSuccessful()); + self::assertTrue($client->getResponse()->isSuccessful()); $form = $client->getCrawler()->filter('form[name=form]')->form(); - $this->assertStringEndsWith($this->createUrl('/admin/project/' . $id . '/delete'), $form->getUri()); + self::assertStringEndsWith($this->createUrl('/admin/project/' . $id . '/delete'), $form->getUri()); $client->submit($form); $client->followRedirect(); @@ -490,7 +490,7 @@ class ProjectControllerTest extends ControllerBaseTest $this->assertHasFlashSuccess($client); $this->request($client, '/admin/project/' . $id . '/edit'); - $this->assertFalse($client->getResponse()->isSuccessful()); + self::assertFalse($client->getResponse()->isSuccessful()); } public function testDeleteActionWithTimesheetEntries(): void @@ -504,18 +504,18 @@ class ProjectControllerTest extends ControllerBaseTest $this->importFixture($fixture); $timesheets = $em->getRepository(Timesheet::class)->findAll(); - $this->assertEquals(10, \count($timesheets)); + self::assertEquals(10, \count($timesheets)); /** @var Timesheet $entry */ foreach ($timesheets as $entry) { - $this->assertEquals(1, $entry->getActivity()->getId()); + self::assertEquals(1, $entry->getActivity()->getId()); } $this->request($client, '/admin/project/1/delete'); - $this->assertTrue($client->getResponse()->isSuccessful()); + self::assertTrue($client->getResponse()->isSuccessful()); $form = $client->getCrawler()->filter('form[name=form]')->form(); - $this->assertStringEndsWith($this->createUrl('/admin/project/1/delete'), $form->getUri()); + self::assertStringEndsWith($this->createUrl('/admin/project/1/delete'), $form->getUri()); $client->submit($form); $this->assertIsRedirect($client, $this->createUrl('/admin/project/')); @@ -525,10 +525,10 @@ class ProjectControllerTest extends ControllerBaseTest $em->clear(); $timesheets = $em->getRepository(Timesheet::class)->findAll(); - $this->assertEquals(0, \count($timesheets)); + self::assertEquals(0, \count($timesheets)); $this->request($client, '/admin/project/1/edit'); - $this->assertFalse($client->getResponse()->isSuccessful()); + self::assertFalse($client->getResponse()->isSuccessful()); } public function testDeleteActionWithTimesheetEntriesAndReplacement(): void @@ -546,18 +546,18 @@ class ProjectControllerTest extends ControllerBaseTest $id = $projects[0]->getId(); $timesheets = $em->getRepository(Timesheet::class)->findAll(); - $this->assertEquals(10, \count($timesheets)); + self::assertEquals(10, \count($timesheets)); /** @var Timesheet $entry */ foreach ($timesheets as $entry) { - $this->assertEquals(1, $entry->getProject()->getId()); + self::assertEquals(1, $entry->getProject()->getId()); } $this->request($client, '/admin/project/1/delete'); - $this->assertTrue($client->getResponse()->isSuccessful()); + self::assertTrue($client->getResponse()->isSuccessful()); $form = $client->getCrawler()->filter('form[name=form]')->form(); - $this->assertStringEndsWith($this->createUrl('/admin/project/1/delete'), $form->getUri()); + self::assertStringEndsWith($this->createUrl('/admin/project/1/delete'), $form->getUri()); $client->submit($form, [ 'form' => [ 'project' => $id @@ -570,15 +570,15 @@ class ProjectControllerTest extends ControllerBaseTest $this->assertHasFlashSuccess($client); $timesheets = $em->getRepository(Timesheet::class)->findAll(); - $this->assertEquals(10, \count($timesheets)); + self::assertEquals(10, \count($timesheets)); /** @var Timesheet $entry */ foreach ($timesheets as $entry) { - $this->assertEquals($id, $entry->getProject()->getId()); + self::assertEquals($id, $entry->getProject()->getId()); } $this->request($client, '/admin/project/1/edit'); - $this->assertFalse($client->getResponse()->isSuccessful()); + self::assertFalse($client->getResponse()->isSuccessful()); } /** @@ -595,7 +595,7 @@ class ProjectControllerTest extends ControllerBaseTest ); } - public function getValidationTestData() + public static function getValidationTestData() { return [ [ diff --git a/tests/Controller/QuickEntryControllerTest.php b/tests/Controller/QuickEntryControllerTest.php index b3b581e1..e4ebdc6b 100644 --- a/tests/Controller/QuickEntryControllerTest.php +++ b/tests/Controller/QuickEntryControllerTest.php @@ -14,7 +14,7 @@ use App\Tests\DataFixtures\TimesheetFixtures; /** * @group integration */ -class QuickEntryControllerTest extends ControllerBaseTest +class QuickEntryControllerTest extends AbstractControllerBaseTestCase { public function testIsSecure(): void { @@ -25,7 +25,7 @@ class QuickEntryControllerTest extends ControllerBaseTest { $client = $this->getClientForAuthenticatedUser(); $this->request($client, '/quick_entry/'); - $this->assertTrue($client->getResponse()->isSuccessful()); + self::assertTrue($client->getResponse()->isSuccessful()); $node = $client->getCrawler()->filter('form[name=quick_entry_weekrange_form]'); self::assertEquals(1, $node->filter('div.btn-group.week-picker-btn-group')->count()); @@ -65,7 +65,7 @@ class QuickEntryControllerTest extends ControllerBaseTest $this->importFixture($fixture); $this->request($client, '/quick_entry/'); - $this->assertTrue($client->getResponse()->isSuccessful()); + self::assertTrue($client->getResponse()->isSuccessful()); $node = $client->getCrawler()->filter('form[name=quick_entry_form]'); self::assertEquals(1, $node->filter('input.btn-primary[type=submit]')->count()); diff --git a/tests/Controller/Reporting/AbstractUserPeriodControllerTest.php b/tests/Controller/Reporting/AbstractUserPeriodControllerTestCase.php similarity index 93% rename from tests/Controller/Reporting/AbstractUserPeriodControllerTest.php rename to tests/Controller/Reporting/AbstractUserPeriodControllerTestCase.php index c95c3d61..07c56b9f 100644 --- a/tests/Controller/Reporting/AbstractUserPeriodControllerTest.php +++ b/tests/Controller/Reporting/AbstractUserPeriodControllerTestCase.php @@ -10,13 +10,13 @@ namespace App\Tests\Controller\Reporting; use App\Entity\User; -use App\Tests\Controller\ControllerBaseTest; +use App\Tests\Controller\AbstractControllerBaseTestCase; use App\Tests\DataFixtures\TimesheetFixtures; /** * @group integration */ -abstract class AbstractUserPeriodControllerTest extends ControllerBaseTest +abstract class AbstractUserPeriodControllerTestCase extends AbstractControllerBaseTestCase { protected function importReportingFixture(string $role): void { @@ -37,7 +37,7 @@ abstract class AbstractUserPeriodControllerTest extends ControllerBaseTest $this->assertUrlIsSecured($this->getReportUrl()); } - public function getTestData(): array + public static function getTestData(): array { return [ [4, 'duration', 'Working hours total'], diff --git a/tests/Controller/Reporting/AbstractUsersPeriodControllerTest.php b/tests/Controller/Reporting/AbstractUsersPeriodControllerTestCase.php similarity index 91% rename from tests/Controller/Reporting/AbstractUsersPeriodControllerTest.php rename to tests/Controller/Reporting/AbstractUsersPeriodControllerTestCase.php index 79f754ec..d4695eae 100644 --- a/tests/Controller/Reporting/AbstractUsersPeriodControllerTest.php +++ b/tests/Controller/Reporting/AbstractUsersPeriodControllerTestCase.php @@ -10,16 +10,16 @@ namespace App\Tests\Controller\Reporting; use App\Entity\User; -use App\Tests\Controller\ControllerBaseTest; +use App\Tests\Controller\AbstractControllerBaseTestCase; use App\Tests\DataFixtures\TimesheetFixtures; use Symfony\Component\HttpFoundation\BinaryFileResponse; /** * @group integration */ -abstract class AbstractUsersPeriodControllerTest extends ControllerBaseTest +abstract class AbstractUsersPeriodControllerTestCase extends AbstractControllerBaseTestCase { - protected function importReportingFixture(string $role) + protected function importReportingFixture(string $role): void { $fixture = new TimesheetFixtures(); $fixture->setAmount(50); @@ -40,7 +40,7 @@ abstract class AbstractUsersPeriodControllerTest extends ControllerBaseTest $this->assertUrlIsSecured($this->getReportUrl()); } - public function getTestData(): array + public static function getTestData(): array { return [ ['duration', 'Working hours total'], @@ -86,7 +86,7 @@ abstract class AbstractUsersPeriodControllerTest extends ControllerBaseTest $this->importReportingFixture(User::ROLE_SUPER_ADMIN); $this->request($client, \sprintf('%s?date=12999119191&sumType=%s', $this->getReportExportUrl(), $dataType)); $response = $client->getResponse(); - $this->assertTrue($response->isSuccessful()); + self::assertTrue($response->isSuccessful()); self::assertInstanceOf(BinaryFileResponse::class, $response); self::assertEquals('application/vnd.openxmlformats-officedocument.spreadsheetml.sheet', $response->headers->get('Content-Type')); self::assertStringContainsString('attachment; filename=kimai-export-users-', $response->headers->get('Content-Disposition')); diff --git a/tests/Controller/Reporting/CustomerMonthlyProjectsControllerTest.php b/tests/Controller/Reporting/CustomerMonthlyProjectsControllerTest.php index 8d70282a..47c7fc53 100644 --- a/tests/Controller/Reporting/CustomerMonthlyProjectsControllerTest.php +++ b/tests/Controller/Reporting/CustomerMonthlyProjectsControllerTest.php @@ -11,7 +11,7 @@ namespace App\Tests\Controller\Reporting; use App\Entity\Project; use App\Entity\User; -use App\Tests\Controller\ControllerBaseTest; +use App\Tests\Controller\AbstractControllerBaseTestCase; use App\Tests\DataFixtures\ActivityFixtures; use App\Tests\DataFixtures\CustomerFixtures; use App\Tests\DataFixtures\ProjectFixtures; @@ -22,7 +22,7 @@ use Symfony\Component\HttpKernel\HttpKernelBrowser; /** * @group integration */ -class CustomerMonthlyProjectsControllerTest extends ControllerBaseTest +class CustomerMonthlyProjectsControllerTest extends AbstractControllerBaseTestCase { public function testReportIsSecure(): void { @@ -90,14 +90,14 @@ class CustomerMonthlyProjectsControllerTest extends ControllerBaseTest $this->assertAccessIsGranted($client, '/reporting/customer/monthly_projects/export'); $response = $client->getResponse(); - $this->assertTrue($response->isSuccessful()); + self::assertTrue($response->isSuccessful()); self::assertInstanceOf(BinaryFileResponse::class, $response); // temporary file! $file = $response->getFile(); self::assertFileDoesNotExist($response->getFile()); - $this->assertEquals('application/vnd.openxmlformats-officedocument.spreadsheetml.sheet', $response->headers->get('Content-Type')); - $this->assertStringContainsString('attachment; filename=kimai-export-users-', $response->headers->get('Content-Disposition')); + self::assertEquals('application/vnd.openxmlformats-officedocument.spreadsheetml.sheet', $response->headers->get('Content-Type')); + self::assertStringContainsString('attachment; filename=kimai-export-users-', $response->headers->get('Content-Disposition')); } } diff --git a/tests/Controller/Reporting/ProjectDateRangeControllerTest.php b/tests/Controller/Reporting/ProjectDateRangeControllerTest.php index 8fb5ca92..8be5e4b9 100644 --- a/tests/Controller/Reporting/ProjectDateRangeControllerTest.php +++ b/tests/Controller/Reporting/ProjectDateRangeControllerTest.php @@ -11,7 +11,7 @@ namespace App\Tests\Controller\Reporting; use App\Entity\Project; use App\Entity\User; -use App\Tests\Controller\ControllerBaseTest; +use App\Tests\Controller\AbstractControllerBaseTestCase; use App\Tests\DataFixtures\ActivityFixtures; use App\Tests\DataFixtures\CustomerFixtures; use App\Tests\DataFixtures\ProjectFixtures; @@ -21,7 +21,7 @@ use App\Timesheet\DateTimeFactory; /** * @group integration */ -class ProjectDateRangeControllerTest extends ControllerBaseTest +class ProjectDateRangeControllerTest extends AbstractControllerBaseTestCase { public function testReportIsSecure(): void { diff --git a/tests/Controller/Reporting/ProjectDetailsControllerTest.php b/tests/Controller/Reporting/ProjectDetailsControllerTest.php index bb3f1858..a5d88cb2 100644 --- a/tests/Controller/Reporting/ProjectDetailsControllerTest.php +++ b/tests/Controller/Reporting/ProjectDetailsControllerTest.php @@ -10,7 +10,7 @@ namespace App\Tests\Controller\Reporting; use App\Entity\User; -use App\Tests\Controller\ControllerBaseTest; +use App\Tests\Controller\AbstractControllerBaseTestCase; use App\Tests\DataFixtures\ActivityFixtures; use App\Tests\DataFixtures\CustomerFixtures; use App\Tests\DataFixtures\ProjectFixtures; @@ -19,7 +19,7 @@ use App\Tests\DataFixtures\TimesheetFixtures; /** * @group integration */ -class ProjectDetailsControllerTest extends ControllerBaseTest +class ProjectDetailsControllerTest extends AbstractControllerBaseTestCase { public function testReportIsSecure(): void { diff --git a/tests/Controller/Reporting/ProjectInactiveControllerTest.php b/tests/Controller/Reporting/ProjectInactiveControllerTest.php index c3cafa8e..e02635fe 100644 --- a/tests/Controller/Reporting/ProjectInactiveControllerTest.php +++ b/tests/Controller/Reporting/ProjectInactiveControllerTest.php @@ -10,7 +10,7 @@ namespace App\Tests\Controller\Reporting; use App\Entity\User; -use App\Tests\Controller\ControllerBaseTest; +use App\Tests\Controller\AbstractControllerBaseTestCase; use App\Tests\DataFixtures\ActivityFixtures; use App\Tests\DataFixtures\CustomerFixtures; use App\Tests\DataFixtures\ProjectFixtures; @@ -19,7 +19,7 @@ use App\Tests\DataFixtures\TimesheetFixtures; /** * @group integration */ -class ProjectInactiveControllerTest extends ControllerBaseTest +class ProjectInactiveControllerTest extends AbstractControllerBaseTestCase { public function testReportIsSecure(): void { diff --git a/tests/Controller/Reporting/ProjectViewControllerTest.php b/tests/Controller/Reporting/ProjectViewControllerTest.php index ea415bb6..c8cb1ca6 100644 --- a/tests/Controller/Reporting/ProjectViewControllerTest.php +++ b/tests/Controller/Reporting/ProjectViewControllerTest.php @@ -10,7 +10,7 @@ namespace App\Tests\Controller\Reporting; use App\Entity\User; -use App\Tests\Controller\ControllerBaseTest; +use App\Tests\Controller\AbstractControllerBaseTestCase; use App\Tests\DataFixtures\ActivityFixtures; use App\Tests\DataFixtures\CustomerFixtures; use App\Tests\DataFixtures\ProjectFixtures; @@ -20,7 +20,7 @@ use Symfony\Component\HttpFoundation\BinaryFileResponse; /** * @group integration */ -class ProjectViewControllerTest extends ControllerBaseTest +class ProjectViewControllerTest extends AbstractControllerBaseTestCase { public function testReportIsSecure(): void { @@ -87,7 +87,7 @@ class ProjectViewControllerTest extends ControllerBaseTest $this->assertAccessIsGranted($client, '/reporting/project_view/export'); $response = $client->getResponse(); - $this->assertTrue($response->isSuccessful()); + self::assertTrue($response->isSuccessful()); self::assertInstanceOf(BinaryFileResponse::class, $response); self::assertNotNull($response->headers->get('Content-Type')); self::assertEquals('application/vnd.openxmlformats-officedocument.spreadsheetml.sheet', $response->headers->get('Content-Type')); diff --git a/tests/Controller/Reporting/ReportUsersMonthControllerTest.php b/tests/Controller/Reporting/ReportUsersMonthControllerTest.php index 69b1196b..9c00b7ed 100644 --- a/tests/Controller/Reporting/ReportUsersMonthControllerTest.php +++ b/tests/Controller/Reporting/ReportUsersMonthControllerTest.php @@ -12,7 +12,7 @@ namespace App\Tests\Controller\Reporting; /** * @group integration */ -class ReportUsersMonthControllerTest extends AbstractUsersPeriodControllerTest +class ReportUsersMonthControllerTest extends AbstractUsersPeriodControllerTestCase { protected function getReportUrl(): string { diff --git a/tests/Controller/Reporting/ReportUsersWeekControllerTest.php b/tests/Controller/Reporting/ReportUsersWeekControllerTest.php index 5275a977..99d22964 100644 --- a/tests/Controller/Reporting/ReportUsersWeekControllerTest.php +++ b/tests/Controller/Reporting/ReportUsersWeekControllerTest.php @@ -12,7 +12,7 @@ namespace App\Tests\Controller\Reporting; /** * @group integration */ -class ReportUsersWeekControllerTest extends AbstractUsersPeriodControllerTest +class ReportUsersWeekControllerTest extends AbstractUsersPeriodControllerTestCase { protected function getReportUrl(): string { diff --git a/tests/Controller/Reporting/ReportUsersYearControllerTest.php b/tests/Controller/Reporting/ReportUsersYearControllerTest.php index 7c32c253..748da1ae 100644 --- a/tests/Controller/Reporting/ReportUsersYearControllerTest.php +++ b/tests/Controller/Reporting/ReportUsersYearControllerTest.php @@ -12,7 +12,7 @@ namespace App\Tests\Controller\Reporting; /** * @group integration */ -class ReportUsersYearControllerTest extends AbstractUsersPeriodControllerTest +class ReportUsersYearControllerTest extends AbstractUsersPeriodControllerTestCase { protected function getReportUrl(): string { diff --git a/tests/Controller/Reporting/UserMonthControllerTest.php b/tests/Controller/Reporting/UserMonthControllerTest.php index e4b05766..8b3b5b03 100644 --- a/tests/Controller/Reporting/UserMonthControllerTest.php +++ b/tests/Controller/Reporting/UserMonthControllerTest.php @@ -12,7 +12,7 @@ namespace App\Tests\Controller\Reporting; /** * @group integration */ -class UserMonthControllerTest extends AbstractUserPeriodControllerTest +class UserMonthControllerTest extends AbstractUserPeriodControllerTestCase { protected function getReportUrl(): string { diff --git a/tests/Controller/Reporting/UserWeekControllerTest.php b/tests/Controller/Reporting/UserWeekControllerTest.php index 3c34382c..5760a5fc 100644 --- a/tests/Controller/Reporting/UserWeekControllerTest.php +++ b/tests/Controller/Reporting/UserWeekControllerTest.php @@ -12,7 +12,7 @@ namespace App\Tests\Controller\Reporting; /** * @group integration */ -class UserWeekControllerTest extends AbstractUserPeriodControllerTest +class UserWeekControllerTest extends AbstractUserPeriodControllerTestCase { protected function getReportUrl(): string { diff --git a/tests/Controller/Reporting/UserYearControllerTest.php b/tests/Controller/Reporting/UserYearControllerTest.php index 5f888c39..59fb1107 100644 --- a/tests/Controller/Reporting/UserYearControllerTest.php +++ b/tests/Controller/Reporting/UserYearControllerTest.php @@ -12,7 +12,7 @@ namespace App\Tests\Controller\Reporting; /** * @group integration */ -class UserYearControllerTest extends AbstractUserPeriodControllerTest +class UserYearControllerTest extends AbstractUserPeriodControllerTestCase { protected function getReportUrl(): string { diff --git a/tests/Controller/ReportingControllerTest.php b/tests/Controller/ReportingControllerTest.php index 0a3fe074..be67be78 100644 --- a/tests/Controller/ReportingControllerTest.php +++ b/tests/Controller/ReportingControllerTest.php @@ -14,7 +14,7 @@ use App\Entity\User; /** * @group integration */ -class ReportingControllerTest extends ControllerBaseTest +class ReportingControllerTest extends AbstractControllerBaseTestCase { public function testIsSecure(): void { @@ -26,7 +26,7 @@ class ReportingControllerTest extends ControllerBaseTest $client = $this->getClientForAuthenticatedUser(User::ROLE_ADMIN); $this->request($client, '/reporting/'); $nodes = $client->getCrawler()->filter('section.content div.row-cards a.card-link'); - $this->assertCount(11, $nodes); + self::assertCount(11, $nodes); } public function testAllReports(): void @@ -34,7 +34,7 @@ class ReportingControllerTest extends ControllerBaseTest $client = $this->getClientForAuthenticatedUser(User::ROLE_SUPER_ADMIN); $this->request($client, '/reporting/'); $nodes = $client->getCrawler()->filter('section.content div.row-cards a.card-link'); - $this->assertCount(11, $nodes); + self::assertCount(11, $nodes); foreach ($nodes as $node) { self::assertNotNull($node->attributes); $link = $node->attributes->getNamedItem('href'); @@ -52,6 +52,6 @@ class ReportingControllerTest extends ControllerBaseTest $client = $this->getClientForAuthenticatedUser(User::ROLE_USER); $this->request($client, '/reporting/'); $nodes = $client->getCrawler()->filter('section.content div.row-cards a.card-link'); - $this->assertCount(3, $nodes); + self::assertCount(3, $nodes); } } diff --git a/tests/Controller/Security/PasswordResetControllerTest.php b/tests/Controller/Security/PasswordResetControllerTest.php index e2d891fd..27fd76fd 100644 --- a/tests/Controller/Security/PasswordResetControllerTest.php +++ b/tests/Controller/Security/PasswordResetControllerTest.php @@ -9,12 +9,12 @@ namespace App\Tests\Controller\Security; -use App\Tests\Controller\ControllerBaseTest; +use App\Tests\Controller\AbstractControllerBaseTestCase; /** * @group integration */ -class PasswordResetControllerTest extends ControllerBaseTest +class PasswordResetControllerTest extends AbstractControllerBaseTestCase { private function testResetActionWithDeactivatedFeature(string $route, string $method = 'GET'): void { @@ -47,16 +47,16 @@ class PasswordResetControllerTest extends ControllerBaseTest $this->request($client, '/resetting/request'); $response = $client->getResponse(); - $this->assertTrue($response->isSuccessful()); + self::assertTrue($response->isSuccessful()); $content = $response->getContent(); - $this->assertNotFalse($content); - $this->assertStringContainsString('<title>Kimai – Time Tracking', $content); - $this->assertStringContainsString('Reset your password', $content); - $this->assertStringContainsString('
', $content); - $this->assertStringContainsString('assertStringContainsString('id="username" name="username" required="required"', $content); - $this->assertStringContainsString('Reset your password', $content); + self::assertNotFalse($content); + self::assertStringContainsString('Kimai – Time Tracking', $content); + self::assertStringContainsString('Reset your password', $content); + self::assertStringContainsString('', $content); + self::assertStringContainsString('getCrawler()->filter('form')->form(); $client->submit($form, [ @@ -65,12 +65,12 @@ class PasswordResetControllerTest extends ControllerBaseTest $this->assertIsRedirect($client, $this->createUrl('/resetting/check-email')); $client->followRedirect(); - $this->assertTrue($client->getResponse()->isSuccessful()); + self::assertTrue($client->getResponse()->isSuccessful()); // TODO test the actual email and provided login link $user = $this->loadUserFromDatabase('john_user'); - $this->assertTrue($user->requiresPasswordReset()); + self::assertTrue($user->requiresPasswordReset()); } public function testRequestAsLoggedInUserRedirects(): void @@ -93,11 +93,11 @@ class PasswordResetControllerTest extends ControllerBaseTest $this->request($client, '/resetting/send-email', 'POST'); $this->assertIsRedirect($client, $this->createUrl('/resetting/check-email')); $client->followRedirect(); - $this->assertTrue($client->getResponse()->isSuccessful()); + self::assertTrue($client->getResponse()->isSuccessful()); $content = $client->getResponse()->getContent(); - $this->assertNotFalse($content); - $this->assertStringContainsString('An email has been sent with a link to reset your password.', $content); - $this->assertStringContainsString('Note: You can only request a new password once every 1:00 hours.', $content); + self::assertNotFalse($content); + self::assertStringContainsString('An email has been sent with a link to reset your password.', $content); + self::assertStringContainsString('Note: You can only request a new password once every 1:00 hours.', $content); } public function testResetWithEmptyUsername(): void @@ -106,11 +106,11 @@ class PasswordResetControllerTest extends ControllerBaseTest $this->request($client, '/resetting/send-email', 'POST', ['username' => '']); $this->assertIsRedirect($client, $this->createUrl('/resetting/check-email')); $client->followRedirect(); - $this->assertTrue($client->getResponse()->isSuccessful()); + self::assertTrue($client->getResponse()->isSuccessful()); $content = $client->getResponse()->getContent(); - $this->assertNotFalse($content); - $this->assertStringContainsString('An email has been sent with a link to reset your password.', $content); - $this->assertStringContainsString('Note: You can only request a new password once every 1:00 hours.', $content); + self::assertNotFalse($content); + self::assertStringContainsString('An email has been sent with a link to reset your password.', $content); + self::assertStringContainsString('Note: You can only request a new password once every 1:00 hours.', $content); } public function testResetWithUnknownUsername(): void @@ -119,11 +119,11 @@ class PasswordResetControllerTest extends ControllerBaseTest $this->request($client, '/resetting/send-email', 'POST', ['username' => 'foobar']); $this->assertIsRedirect($client, $this->createUrl('/resetting/check-email')); $client->followRedirect(); - $this->assertTrue($client->getResponse()->isSuccessful()); + self::assertTrue($client->getResponse()->isSuccessful()); $content = $client->getResponse()->getContent(); - $this->assertNotFalse($content); - $this->assertStringContainsString('An email has been sent with a link to reset your password.', $content); - $this->assertStringContainsString('Note: You can only request a new password once every 1:00 hours.', $content); + self::assertNotFalse($content); + self::assertStringContainsString('An email has been sent with a link to reset your password.', $content); + self::assertStringContainsString('Note: You can only request a new password once every 1:00 hours.', $content); } public function testResetWithKnownUsername(): void @@ -131,10 +131,10 @@ class PasswordResetControllerTest extends ControllerBaseTest $client = self::createClient(); $user = $this->loadUserFromDatabase('john_user'); - $this->assertFalse($user->requiresPasswordReset()); + self::assertFalse($user->requiresPasswordReset()); $this->request($client, '/resetting/request'); - $this->assertTrue($client->getResponse()->isSuccessful()); + self::assertTrue($client->getResponse()->isSuccessful()); $form = $client->getCrawler()->filter('form')->form(); $client->submit($form, [ 'username' => 'john_user', @@ -142,15 +142,15 @@ class PasswordResetControllerTest extends ControllerBaseTest $this->assertIsRedirect($client, $this->createUrl('/resetting/check-email')); $client->followRedirect(); - $this->assertTrue($client->getResponse()->isSuccessful()); + self::assertTrue($client->getResponse()->isSuccessful()); $content = $client->getResponse()->getContent(); - $this->assertNotFalse($content); - $this->assertStringContainsString('An email has been sent with a link to reset your password.', $content); - $this->assertStringContainsString('Note: You can only request a new password once every 1:00 hours.', $content); + self::assertNotFalse($content); + self::assertStringContainsString('An email has been sent with a link to reset your password.', $content); + self::assertStringContainsString('Note: You can only request a new password once every 1:00 hours.', $content); // TODO test the actual email and provided login link $user = $this->loadUserFromDatabase('john_user'); - $this->assertTrue($user->requiresPasswordReset()); + self::assertTrue($user->requiresPasswordReset()); } } diff --git a/tests/Controller/Security/SecurityControllerTest.php b/tests/Controller/Security/SecurityControllerTest.php index 5786ec97..00ad1adb 100644 --- a/tests/Controller/Security/SecurityControllerTest.php +++ b/tests/Controller/Security/SecurityControllerTest.php @@ -15,7 +15,7 @@ use App\Controller\Security\SecurityController; use App\DataFixtures\UserFixtures; use App\Entity\User; use App\Tests\Configuration\TestConfigLoader; -use App\Tests\Controller\ControllerBaseTest; +use App\Tests\Controller\AbstractControllerBaseTestCase; use Symfony\Component\Security\Csrf\CsrfTokenManagerInterface; /** @@ -24,7 +24,7 @@ use Symfony\Component\Security\Csrf\CsrfTokenManagerInterface; * * @group integration */ -class SecurityControllerTest extends ControllerBaseTest +class SecurityControllerTest extends AbstractControllerBaseTestCase { public function testRootUrlIsRedirectedToLogin(): void { @@ -42,17 +42,17 @@ class SecurityControllerTest extends ControllerBaseTest $this->request($client, '/login'); $response = $client->getResponse(); - $this->assertTrue($client->getResponse()->isSuccessful()); + self::assertTrue($client->getResponse()->isSuccessful()); $content = $response->getContent(); - $this->assertStringContainsString('Kimai – Time Tracking', $content); - $this->assertStringContainsString('assertStringContainsString('assertStringContainsString('assertStringContainsString('">Log in', $content); - $this->assertStringContainsString('assertStringNotContainsString('Register a new account', $content); + self::assertStringContainsString('Kimai – Time Tracking', $content); + self::assertStringContainsString('Log in', $content); + self::assertStringContainsString('request($client, '/login'); - $this->assertTrue($client->getResponse()->isSuccessful()); + self::assertTrue($client->getResponse()->isSuccessful()); $form = $client->getCrawler()->filter('body form')->form(); $client->submit($form, [ @@ -77,7 +77,7 @@ class SecurityControllerTest extends ControllerBaseTest $this->assertIsRedirect($client, '/timesheet/'); // redirect to configured start page $client->followRedirect(); - $this->assertTrue($client->getResponse()->isSuccessful()); + self::assertTrue($client->getResponse()->isSuccessful()); } public function testLoginAlreadyLoggedIn(): void @@ -92,7 +92,7 @@ class SecurityControllerTest extends ControllerBaseTest $this->assertIsRedirect($client, '/timesheet/'); // redirect to configured start page $client->followRedirect(); - $this->assertTrue($client->getResponse()->isSuccessful()); + self::assertTrue($client->getResponse()->isSuccessful()); } public function testLoginNegative(): void @@ -100,7 +100,7 @@ class SecurityControllerTest extends ControllerBaseTest $client = self::createClient(); $this->request($client, '/login'); - $this->assertTrue($client->getResponse()->isSuccessful()); + self::assertTrue($client->getResponse()->isSuccessful()); $form = $client->getCrawler()->filter('body form')->form(); $client->submit($form, [ @@ -111,7 +111,7 @@ class SecurityControllerTest extends ControllerBaseTest $this->assertIsRedirect($client); // redirect to root URL $client->followRedirect(); - $this->assertTrue($client->getResponse()->isSuccessful()); + self::assertTrue($client->getResponse()->isSuccessful()); self::assertStringContainsString('
Invalid credentials.
', $client->getResponse()->getContent()); } diff --git a/tests/Controller/Security/SelfRegistrationControllerTest.php b/tests/Controller/Security/SelfRegistrationControllerTest.php index 0e690fa7..b4bb55f3 100644 --- a/tests/Controller/Security/SelfRegistrationControllerTest.php +++ b/tests/Controller/Security/SelfRegistrationControllerTest.php @@ -10,13 +10,13 @@ namespace App\Tests\Controller\Security; use App\Entity\User; -use App\Tests\Controller\ControllerBaseTest; +use App\Tests\Controller\AbstractControllerBaseTestCase; use Symfony\Bundle\FrameworkBundle\KernelBrowser; /** * @group integration */ -class SelfRegistrationControllerTest extends ControllerBaseTest +class SelfRegistrationControllerTest extends AbstractControllerBaseTestCase { private function assertRegisterActionWithDeactivatedFeature(string $route): void { @@ -53,22 +53,22 @@ class SelfRegistrationControllerTest extends ControllerBaseTest $this->request($client, '/register/'); $response = $client->getResponse(); - $this->assertTrue($response->isSuccessful()); + self::assertTrue($response->isSuccessful()); $content = $response->getContent(); - $this->assertStringContainsString('Kimai – Time Tracking', $content); - $this->assertStringContainsString('Register a new account', $content); - $this->assertStringContainsString('assertStringContainsString('assertStringContainsString('id="user_registration_form_email" name="user_registration_form[email]" required="required"', $content); - $this->assertStringContainsString('assertStringContainsString('id="user_registration_form_username" name="user_registration_form[username]" required="required" maxlength="64" pattern="', $content); - $this->assertStringContainsString('assertStringContainsString('id="user_registration_form_plainPassword_first" name="user_registration_form[plainPassword][first]" required="required"', $content); - $this->assertStringContainsString('id="user_registration_form_plainPassword_second" name="user_registration_form[plainPassword][second]" required="required"', $content); - $this->assertStringContainsString('assertStringContainsString('id="user_registration_form__token" name="user_registration_form[_token]"', $content); - $this->assertStringContainsString('>Register', $content); + self::assertStringContainsString('Kimai – Time Tracking', $content); + self::assertStringContainsString('Register a new account', $content); + self::assertStringContainsString('Register', $content); } private function createUser(KernelBrowser $client, string $username, string $email, string $password): User @@ -77,7 +77,7 @@ class SelfRegistrationControllerTest extends ControllerBaseTest $this->request($client, '/register/'); $response = $client->getResponse(); - $this->assertTrue($response->isSuccessful()); + self::assertTrue($response->isSuccessful()); $form = $client->getCrawler()->filter('form[name=user_registration_form]')->form(); $client->submit($form, [ @@ -93,7 +93,7 @@ class SelfRegistrationControllerTest extends ControllerBaseTest $this->assertIsRedirect($client, $this->createUrl('/register/check-email')); $client->followRedirect(); - $this->assertTrue($client->getResponse()->isSuccessful()); + self::assertTrue($client->getResponse()->isSuccessful()); return $this->loadUserFromDatabase($username); } @@ -106,7 +106,7 @@ class SelfRegistrationControllerTest extends ControllerBaseTest $this->assertIsRedirect($client, $this->createUrl('/register/')); $client->followRedirect(); - $this->assertTrue($client->getResponse()->isSuccessful()); + self::assertTrue($client->getResponse()->isSuccessful()); } public function testRegisterAccount(): void @@ -115,9 +115,9 @@ class SelfRegistrationControllerTest extends ControllerBaseTest $this->createUser($client, 'example', 'register@example.com', 'test1234'); $content = $client->getResponse()->getContent(); - $this->assertStringContainsString('Kimai – Time Tracking', $content); - $this->assertStringContainsString('An e-mail has been sent to register@example.com. It contains a link you must click to activate your account.', $content); - $this->assertStringContainsString('', $content); + self::assertStringContainsString('Kimai – Time Tracking', $content); + self::assertStringContainsString('An e-mail has been sent to register@example.com. It contains a link you must click to activate your account.', $content); + self::assertStringContainsString('', $content); } public function testConfirmWithInvalidToken(): void @@ -128,7 +128,7 @@ class SelfRegistrationControllerTest extends ControllerBaseTest $this->assertIsRedirect($client, $this->createUrl('/login')); $client->followRedirect(); - $this->assertTrue($client->getResponse()->isSuccessful()); + self::assertTrue($client->getResponse()->isSuccessful()); } public function testConfirmAccount(): void @@ -143,9 +143,9 @@ class SelfRegistrationControllerTest extends ControllerBaseTest $this->request($client, '/register/confirm/' . $token); $this->assertIsRedirect($client, $this->createUrl('/register/confirmed')); $client->followRedirect(); - $this->assertTrue($client->getResponse()->isSuccessful()); + self::assertTrue($client->getResponse()->isSuccessful()); $content = $client->getResponse()->getContent(); - $this->assertStringContainsString('Congratulations example, your account is now activated.', $content); + self::assertStringContainsString('Congratulations example, your account is now activated.', $content); $user = $this->loadUserFromDatabase('example'); self::assertTrue($user->isEnabled()); @@ -160,7 +160,7 @@ class SelfRegistrationControllerTest extends ControllerBaseTest // AccessDeniedException redirects to login $this->assertIsRedirect($client, $this->createUrl('/login')); $client->followRedirect(); - $this->assertTrue($client->getResponse()->isSuccessful()); + self::assertTrue($client->getResponse()->isSuccessful()); } /** @@ -174,7 +174,7 @@ class SelfRegistrationControllerTest extends ControllerBaseTest $this->assertHasValidationError($client, '/register/', 'form[name=user_registration_form]', $formData, $validationFields); } - public function getValidationTestData(): array // @phpstan-ignore missingType.iterableValue + public static function getValidationTestData(): array // @phpstan-ignore missingType.iterableValue { return [ [ diff --git a/tests/Controller/SystemConfigurationControllerTest.php b/tests/Controller/SystemConfigurationControllerTest.php index 485965f0..007978dc 100644 --- a/tests/Controller/SystemConfigurationControllerTest.php +++ b/tests/Controller/SystemConfigurationControllerTest.php @@ -15,7 +15,7 @@ use App\Entity\User; /** * @group integration */ -class SystemConfigurationControllerTest extends ControllerBaseTest +class SystemConfigurationControllerTest extends AbstractControllerBaseTestCase { public function testIsSecure(): void { @@ -41,17 +41,17 @@ class SystemConfigurationControllerTest extends ControllerBaseTest $expectedCount = \count($expectedForms) + 1; // the menu is another card $result = $client->getCrawler()->filter('section.content div.card'); - $this->assertEquals($expectedCount, \count($result)); + self::assertEquals($expectedCount, \count($result)); $result = $client->getCrawler()->filter('section.content div.card form'); - $this->assertEquals(\count($expectedForms), \count($result)); + self::assertEquals(\count($expectedForms), \count($result)); foreach ($expectedForms as $formConfig) { $result = $client->getCrawler()->filter($formConfig[0]); - $this->assertEquals(1, \count($result)); + self::assertEquals(1, \count($result)); $form = $result->form(); - $this->assertStringEndsWith($formConfig[1], $form->getUri()); - $this->assertEquals('POST', $form->getMethod()); + self::assertStringEndsWith($formConfig[1], $form->getUri()); + self::assertEquals('POST', $form->getMethod()); } } @@ -61,19 +61,19 @@ class SystemConfigurationControllerTest extends ControllerBaseTest $this->assertAccessIsGranted($client, '/admin/system-config/edit/timesheet'); $result = $client->getCrawler()->filter('section.content div.card'); - $this->assertEquals(1, \count($result)); + self::assertEquals(1, \count($result)); $result = $client->getCrawler()->filter('section.content div.card form'); - $this->assertEquals(1, \count($result)); + self::assertEquals(1, \count($result)); $result = $client->getCrawler()->filter('form[name=system_configuration_form_timesheet]'); - $this->assertEquals(1, \count($result)); + self::assertEquals(1, \count($result)); $form = $result->form(); - $this->assertEquals('POST', $form->getMethod()); + self::assertEquals('POST', $form->getMethod()); } /** - * @return array> + * @return array> */ public function getTestDataForms(): array { @@ -100,10 +100,10 @@ class SystemConfigurationControllerTest extends ControllerBaseTest $this->assertAccessIsGranted($client, '/admin/system-config/'); $configService = $this->getSystemConfiguration(); - $this->assertEquals('default', $configService->find('timesheet.mode')); - $this->assertTrue($configService->find('timesheet.rules.allow_future_times')); - $this->assertTrue($configService->find('timesheet.rules.allow_zero_duration')); - $this->assertEquals(1, $configService->find('timesheet.active_entries.hard_limit')); + self::assertEquals('default', $configService->find('timesheet.mode')); + self::assertTrue($configService->find('timesheet.rules.allow_future_times')); + self::assertTrue($configService->find('timesheet.rules.allow_zero_duration')); + self::assertEquals(1, $configService->find('timesheet.active_entries.hard_limit')); $form = $client->getCrawler()->filter('form[name=system_configuration_form_timesheet]')->form(); $client->submit($form, [ @@ -122,14 +122,14 @@ class SystemConfigurationControllerTest extends ControllerBaseTest $this->assertIsRedirect($client, $this->createUrl('/admin/system-config/')); $client->followRedirect(); - $this->assertTrue($client->getResponse()->isSuccessful()); + self::assertTrue($client->getResponse()->isSuccessful()); $this->assertHasFlashSaveSuccess($client); $configService = $this->getSystemConfiguration(); - $this->assertEquals('punch', $configService->find('timesheet.mode')); - $this->assertFalse($configService->find('timesheet.rules.allow_future_times')); - $this->assertFalse($configService->find('timesheet.rules.allow_overlapping_records')); - $this->assertEquals(99, $configService->find('timesheet.active_entries.hard_limit')); + self::assertEquals('punch', $configService->find('timesheet.mode')); + self::assertFalse($configService->find('timesheet.rules.allow_future_times')); + self::assertFalse($configService->find('timesheet.rules.allow_overlapping_records')); + self::assertEquals(99, $configService->find('timesheet.active_entries.hard_limit')); } public function testUpdateLockdownPeriodConfig(): void @@ -138,10 +138,10 @@ class SystemConfigurationControllerTest extends ControllerBaseTest $this->assertAccessIsGranted($client, '/admin/system-config/'); $configService = $this->getSystemConfiguration(); - $this->assertNull($configService->find('timesheet.rules.lockdown_period_start')); - $this->assertNull($configService->find('timesheet.rules.lockdown_period_end')); - $this->assertNull($configService->find('timesheet.rules.lockdown_period_timezone')); - $this->assertNull($configService->find('timesheet.rules.lockdown_grace_period')); + self::assertNull($configService->find('timesheet.rules.lockdown_period_start')); + self::assertNull($configService->find('timesheet.rules.lockdown_period_end')); + self::assertNull($configService->find('timesheet.rules.lockdown_period_timezone')); + self::assertNull($configService->find('timesheet.rules.lockdown_grace_period')); $form = $client->getCrawler()->filter('form[name=system_configuration_form_lockdown_period]')->form(); $client->submit($form, [ @@ -157,14 +157,14 @@ class SystemConfigurationControllerTest extends ControllerBaseTest $this->assertIsRedirect($client, $this->createUrl('/admin/system-config/')); $client->followRedirect(); - $this->assertTrue($client->getResponse()->isSuccessful()); + self::assertTrue($client->getResponse()->isSuccessful()); $this->assertHasFlashSaveSuccess($client); $configService = $this->getSystemConfiguration(); - $this->assertEquals('first day of last month 01:23:45', $configService->find('timesheet.rules.lockdown_period_start')); - $this->assertEquals('last day of last month 23:01:45', $configService->find('timesheet.rules.lockdown_period_end')); - $this->assertEquals('Africa/Bangui', $configService->find('timesheet.rules.lockdown_period_timezone')); - $this->assertEquals('+ 12 hours', $configService->find('timesheet.rules.lockdown_grace_period')); + self::assertEquals('first day of last month 01:23:45', $configService->find('timesheet.rules.lockdown_period_start')); + self::assertEquals('last day of last month 23:01:45', $configService->find('timesheet.rules.lockdown_period_end')); + self::assertEquals('Africa/Bangui', $configService->find('timesheet.rules.lockdown_period_timezone')); + self::assertEquals('+ 12 hours', $configService->find('timesheet.rules.lockdown_grace_period')); } public function testUpdateTimesheetConfigValidation(): void @@ -199,9 +199,9 @@ class SystemConfigurationControllerTest extends ControllerBaseTest $this->assertAccessIsGranted($client, '/admin/system-config/'); $configService = $this->getSystemConfiguration(); - $this->assertNull($configService->find('defaults.customer.timezone')); - $this->assertEquals('DE', $configService->find('defaults.customer.country')); - $this->assertEquals('EUR', $configService->find('defaults.customer.currency')); + self::assertNull($configService->find('defaults.customer.timezone')); + self::assertEquals('DE', $configService->find('defaults.customer.country')); + self::assertEquals('EUR', $configService->find('defaults.customer.currency')); $form = $client->getCrawler()->filter('form[name=system_configuration_form_customer]')->form(); $client->submit($form, [ @@ -216,13 +216,13 @@ class SystemConfigurationControllerTest extends ControllerBaseTest $this->assertIsRedirect($client, $this->createUrl('/admin/system-config/')); $client->followRedirect(); - $this->assertTrue($client->getResponse()->isSuccessful()); + self::assertTrue($client->getResponse()->isSuccessful()); $this->assertHasFlashSaveSuccess($client); $configService = $this->getSystemConfiguration(); - $this->assertEquals('Atlantic/Canary', $configService->find('defaults.customer.timezone')); - $this->assertEquals('BB', $configService->find('defaults.customer.country')); - $this->assertEquals('GBP', $configService->find('defaults.customer.currency')); + self::assertEquals('Atlantic/Canary', $configService->find('defaults.customer.timezone')); + self::assertEquals('BB', $configService->find('defaults.customer.country')); + self::assertEquals('GBP', $configService->find('defaults.customer.currency')); } public function testUpdateCustomerConfigWithSingleParam(): void @@ -244,7 +244,7 @@ class SystemConfigurationControllerTest extends ControllerBaseTest $this->assertIsRedirect($client, $this->createUrl('/admin/system-config/edit/customer')); $client->followRedirect(); - $this->assertTrue($client->getResponse()->isSuccessful()); + self::assertTrue($client->getResponse()->isSuccessful()); $this->assertHasFlashSaveSuccess($client); } @@ -254,9 +254,9 @@ class SystemConfigurationControllerTest extends ControllerBaseTest $this->assertAccessIsGranted($client, '/admin/system-config/edit/user'); $configService = $this->getSystemConfiguration(); - $this->assertNull($configService->find('defaults.user.timezone')); - $this->assertEquals('default', $configService->find('defaults.user.theme')); - $this->assertEquals('en', $configService->find('defaults.user.language')); + self::assertNull($configService->find('defaults.user.timezone')); + self::assertEquals('default', $configService->find('defaults.user.theme')); + self::assertEquals('en', $configService->find('defaults.user.language')); $form = $client->getCrawler()->filter('form[name=system_configuration_form_user]')->form(); $client->submit($form, [ @@ -271,13 +271,13 @@ class SystemConfigurationControllerTest extends ControllerBaseTest $this->assertIsRedirect($client, $this->createUrl('/admin/system-config/edit/user')); $client->followRedirect(); - $this->assertTrue($client->getResponse()->isSuccessful()); + self::assertTrue($client->getResponse()->isSuccessful()); $this->assertHasFlashSaveSuccess($client); $configService = $this->getSystemConfiguration(); - $this->assertEquals('Pacific/Tahiti', $configService->find('defaults.user.timezone')); - $this->assertEquals('dark', $configService->find('defaults.user.theme')); - $this->assertEquals('ru', $configService->find('defaults.user.language')); + self::assertEquals('Pacific/Tahiti', $configService->find('defaults.user.timezone')); + self::assertEquals('dark', $configService->find('defaults.user.theme')); + self::assertEquals('ru', $configService->find('defaults.user.language')); } public function testUpdateCustomerConfigValidation(): void @@ -309,7 +309,7 @@ class SystemConfigurationControllerTest extends ControllerBaseTest $this->assertAccessIsGranted($client, '/admin/system-config/'); $configService = $this->getSystemConfiguration(); - $this->assertFalse($configService->find('timesheet.markdown_content')); + self::assertFalse($configService->find('timesheet.markdown_content')); $form = $client->getCrawler()->filter('form[name=system_configuration_form_theme]')->form(); $client->submit($form, [ @@ -322,11 +322,11 @@ class SystemConfigurationControllerTest extends ControllerBaseTest $this->assertIsRedirect($client, $this->createUrl('/admin/system-config/')); $client->followRedirect(); - $this->assertTrue($client->getResponse()->isSuccessful()); + self::assertTrue($client->getResponse()->isSuccessful()); $this->assertHasFlashSaveSuccess($client); $configService = $this->getSystemConfiguration(); - $this->assertTrue($configService->find('timesheet.markdown_content')); + self::assertTrue($configService->find('timesheet.markdown_content')); } public function testUpdateThemeConfigValidation(): void @@ -355,12 +355,12 @@ class SystemConfigurationControllerTest extends ControllerBaseTest $this->assertAccessIsGranted($client, '/admin/system-config/'); $configService = $this->getSystemConfiguration(); - $this->assertTrue($configService->find('calendar.week_numbers')); - $this->assertTrue($configService->find('calendar.weekends')); - $this->assertEquals('08:00', $configService->find('calendar.businessHours.begin')); - $this->assertEquals('20:00', $configService->find('calendar.businessHours.end')); - $this->assertEquals('00:00', $configService->find('calendar.visibleHours.begin')); - $this->assertEquals('23:59', $configService->find('calendar.visibleHours.end')); + self::assertTrue($configService->find('calendar.week_numbers')); + self::assertTrue($configService->find('calendar.weekends')); + self::assertEquals('08:00', $configService->find('calendar.businessHours.begin')); + self::assertEquals('20:00', $configService->find('calendar.businessHours.end')); + self::assertEquals('00:00', $configService->find('calendar.visibleHours.begin')); + self::assertEquals('23:59', $configService->find('calendar.visibleHours.end')); $form = $client->getCrawler()->filter('form[name=system_configuration_form_calendar]')->form(); $client->submit($form, [ @@ -378,16 +378,16 @@ class SystemConfigurationControllerTest extends ControllerBaseTest $this->assertIsRedirect($client, $this->createUrl('/admin/system-config/')); $client->followRedirect(); - $this->assertTrue($client->getResponse()->isSuccessful()); + self::assertTrue($client->getResponse()->isSuccessful()); $this->assertHasFlashSaveSuccess($client); $configService = $this->getSystemConfiguration(); - $this->assertFalse($configService->find('calendar.week_numbers')); - $this->assertFalse($configService->find('calendar.weekends')); - $this->assertEquals('10:00', $configService->find('calendar.businessHours.begin')); - $this->assertEquals('16:00', $configService->find('calendar.businessHours.end')); - $this->assertEquals('05:17', $configService->find('calendar.visibleHours.begin')); - $this->assertEquals('21:43', $configService->find('calendar.visibleHours.end')); + self::assertFalse($configService->find('calendar.week_numbers')); + self::assertFalse($configService->find('calendar.weekends')); + self::assertEquals('10:00', $configService->find('calendar.businessHours.begin')); + self::assertEquals('16:00', $configService->find('calendar.businessHours.end')); + self::assertEquals('05:17', $configService->find('calendar.visibleHours.begin')); + self::assertEquals('21:43', $configService->find('calendar.visibleHours.end')); } public function testUpdateCalendarConfigValidation(): void diff --git a/tests/Controller/TagControllerTest.php b/tests/Controller/TagControllerTest.php index b112ac96..15d30806 100644 --- a/tests/Controller/TagControllerTest.php +++ b/tests/Controller/TagControllerTest.php @@ -16,7 +16,7 @@ use App\Tests\DataFixtures\TagFixtures; /** * @group integration */ -class TagControllerTest extends ControllerBaseTest +class TagControllerTest extends AbstractControllerBaseTestCase { /** * @return Tag[] @@ -53,14 +53,14 @@ class TagControllerTest extends ControllerBaseTest $this->importTags(); $this->request($client, '/admin/tags/'); - $this->assertTrue($client->getResponse()->isSuccessful()); + self::assertTrue($client->getResponse()->isSuccessful()); $form = $client->getCrawler()->filter('form.searchform')->form(); $client->submit($form, [ 'searchTerm' => 'Support', ]); - $this->assertTrue($client->getResponse()->isSuccessful()); + self::assertTrue($client->getResponse()->isSuccessful()); $this->assertHasDataTable($client); $this->assertDataTableRowCount($client, 'datatable_admin_tags', 2); } @@ -83,7 +83,7 @@ class TagControllerTest extends ControllerBaseTest $this->request($client, '/admin/tags/' . $id . '/edit'); $editForm = $client->getCrawler()->filter('form[name=tag_edit_form]')->form(); - $this->assertEquals('A tAG Name!', $editForm->get('tag_edit_form[name]')->getValue()); + self::assertEquals('A tAG Name!', $editForm->get('tag_edit_form[name]')->getValue()); } public function testEditAction(): void @@ -102,7 +102,7 @@ class TagControllerTest extends ControllerBaseTest $this->assertHasDataTable($client); $this->request($client, '/admin/tags/' . $id . '/edit'); $editForm = $client->getCrawler()->filter('form[name=tag_edit_form]')->form(); - $this->assertEquals('Test 2 updated', $editForm->get('tag_edit_form[name]')->getValue()); + self::assertEquals('Test 2 updated', $editForm->get('tag_edit_form[name]')->getValue()); } public function testMultiDeleteAction(): void diff --git a/tests/Controller/TeamControllerTest.php b/tests/Controller/TeamControllerTest.php index 120cd35f..8900bd9a 100644 --- a/tests/Controller/TeamControllerTest.php +++ b/tests/Controller/TeamControllerTest.php @@ -17,7 +17,7 @@ use Symfony\Component\HttpKernel\HttpKernelBrowser; /** * @group integration */ -class TeamControllerTest extends ControllerBaseTest +class TeamControllerTest extends AbstractControllerBaseTestCase { public function testIsSecure(): void { @@ -62,7 +62,7 @@ class TeamControllerTest extends ControllerBaseTest 'searchTerm' => 'foo', ]); - $this->assertTrue($client->getResponse()->isSuccessful()); + self::assertTrue($client->getResponse()->isSuccessful()); $this->assertHasDataTable($client); $this->assertDataTableRowCount($client, 'datatable_admin_teams', 5); } @@ -73,7 +73,7 @@ class TeamControllerTest extends ControllerBaseTest $this->assertAccessIsGranted($client, '/admin/teams/create'); $form = $client->getCrawler()->filter('form[name=team_edit_form]')->form(); - $this->assertEquals('', $form->get('team_edit_form[name]')->getValue()); + self::assertEquals('', $form->get('team_edit_form[name]')->getValue()); $values = $form->getPhpValues(); $values['team_edit_form']['name'] = 'Test Team' . uniqid(); @@ -91,10 +91,10 @@ class TeamControllerTest extends ControllerBaseTest protected function assertHasCustomerAndProjectPermissionBoxes(HttpKernelBrowser $client): void { $content = $client->getResponse()->getContent(); - $this->assertStringContainsString('Grant access to customers', $content); - $this->assertStringContainsString('Grant access to projects', $content); - $this->assertEquals(1, $client->getCrawler()->filter('form[name=team_customer_form]')->count()); - $this->assertEquals(1, $client->getCrawler()->filter('form[name=team_project_form]')->count()); + self::assertStringContainsString('Grant access to customers', $content); + self::assertStringContainsString('Grant access to projects', $content); + self::assertEquals(1, $client->getCrawler()->filter('form[name=team_customer_form]')->count()); + self::assertEquals(1, $client->getCrawler()->filter('form[name=team_project_form]')->count()); } public function testEditAction(): void @@ -116,7 +116,7 @@ class TeamControllerTest extends ControllerBaseTest $this->assertIsRedirect($client, $this->createUrl('/admin/teams/1/edit')); $client->followRedirect(); $editForm = $client->getCrawler()->filter('form[name=team_edit_form]')->form(); - $this->assertEquals('Test Team 2', $editForm->get('team_edit_form[name]')->getValue()); + self::assertEquals('Test Team 2', $editForm->get('team_edit_form[name]')->getValue()); } public function testEditMemberAction(): void @@ -137,7 +137,7 @@ class TeamControllerTest extends ControllerBaseTest $this->assertIsRedirect($client, $this->createUrl('/admin/teams/1/edit')); $client->followRedirect(); $editForm = $client->getCrawler()->filter('form[name=team_edit_form]')->form(); - $this->assertEquals('Test Team 2', $editForm->get('team_edit_form[name]')->getValue()); + self::assertEquals('Test Team 2', $editForm->get('team_edit_form[name]')->getValue()); } public function testDuplicateAction(): void @@ -153,6 +153,6 @@ class TeamControllerTest extends ControllerBaseTest $this->requestPure($client, $location); $editForm = $client->getCrawler()->filter('form[name=team_edit_form]')->form(); - $this->assertEquals('Test team (1)', $editForm->get('team_edit_form[name]')->getValue()); + self::assertEquals('Test team (1)', $editForm->get('team_edit_form[name]')->getValue()); } } diff --git a/tests/Controller/TimesheetControllerTest.php b/tests/Controller/TimesheetControllerTest.php index f957a7f3..377ce861 100644 --- a/tests/Controller/TimesheetControllerTest.php +++ b/tests/Controller/TimesheetControllerTest.php @@ -25,7 +25,7 @@ use Symfony\Component\EventDispatcher\EventDispatcher; /** * @group integration */ -class TimesheetControllerTest extends ControllerBaseTest +class TimesheetControllerTest extends AbstractControllerBaseTestCase { public function testIsSecure(): void { @@ -36,7 +36,7 @@ class TimesheetControllerTest extends ControllerBaseTest { $client = $this->getClientForAuthenticatedUser(); $this->request($client, '/timesheet/'); - $this->assertTrue($client->getResponse()->isSuccessful()); + self::assertTrue($client->getResponse()->isSuccessful()); // there are no records by default in the test database $this->assertHasNoEntriesWithFilter($client); @@ -68,7 +68,7 @@ class TimesheetControllerTest extends ControllerBaseTest $this->importFixture($fixture); $this->request($client, '/timesheet/'); - $this->assertTrue($client->getResponse()->isSuccessful()); + self::assertTrue($client->getResponse()->isSuccessful()); $dateRange = $this->formatDateRange($start, new \DateTime('last day of this month')); @@ -83,7 +83,7 @@ class TimesheetControllerTest extends ControllerBaseTest 'tags' => 'foo', ]); - $this->assertTrue($client->getResponse()->isSuccessful()); + self::assertTrue($client->getResponse()->isSuccessful()); $this->assertHasDataTable($client); $this->assertDataTableRowCount($client, 'datatable_timesheet', 7); @@ -122,7 +122,7 @@ class TimesheetControllerTest extends ControllerBaseTest $this->importFixture($fixture); $this->request($client, '/timesheet/'); - $this->assertTrue($client->getResponse()->isSuccessful()); + self::assertTrue($client->getResponse()->isSuccessful()); $form = $client->getCrawler()->filter('form.searchform')->form(); $client->submit($form, [ @@ -130,7 +130,7 @@ class TimesheetControllerTest extends ControllerBaseTest 'tags' => [$id], ]); - $this->assertTrue($client->getResponse()->isSuccessful()); + self::assertTrue($client->getResponse()->isSuccessful()); $this->assertHasDataTable($client); $this->assertDataTableRowCount($client, 'datatable_timesheet', 5); } @@ -159,7 +159,7 @@ class TimesheetControllerTest extends ControllerBaseTest $this->importFixture($fixture); $this->request($client, '/timesheet/'); - $this->assertTrue($client->getResponse()->isSuccessful()); + self::assertTrue($client->getResponse()->isSuccessful()); $dateRange = $this->formatDateRange(new \DateTime('-10 days'), new \DateTime()); @@ -171,15 +171,15 @@ class TimesheetControllerTest extends ControllerBaseTest 'customers' => [], ]); - $this->assertTrue($client->getResponse()->isSuccessful()); + self::assertTrue($client->getResponse()->isSuccessful()); $node = $client->getCrawler()->filter('body'); /** @var \DOMElement $body */ $body = $node->getNode(0); - $this->assertEquals('invoice_print', $body->getAttribute('class')); + self::assertEquals('invoice_print', $body->getAttribute('class')); $result = $node->filter('section.invoice table.table tbody tr'); - $this->assertEquals(5, \count($result)); + self::assertEquals(5, \count($result)); } public function testExporterNotFoundAction(): void @@ -193,7 +193,7 @@ class TimesheetControllerTest extends ControllerBaseTest { $client = $this->getClientForAuthenticatedUser(); $this->request($client, '/timesheet/create'); - $this->assertTrue($client->getResponse()->isSuccessful()); + self::assertTrue($client->getResponse()->isSuccessful()); $form = $client->getCrawler()->filter('form[name=timesheet_edit_form]')->form(); $client->submit($form, [ @@ -211,18 +211,18 @@ class TimesheetControllerTest extends ControllerBaseTest $this->assertIsRedirect($client, $this->createUrl('/timesheet/')); $client->followRedirect(); - $this->assertTrue($client->getResponse()->isSuccessful()); + self::assertTrue($client->getResponse()->isSuccessful()); $this->assertHasFlashSuccess($client); $em = $this->getEntityManager(); /** @var Timesheet $timesheet */ $timesheet = $em->getRepository(Timesheet::class)->findAll()[0]; - $this->assertInstanceOf(\DateTime::class, $timesheet->getBegin()); - $this->assertNull($timesheet->getEnd()); - $this->assertEquals('Testing is fun!', $timesheet->getDescription()); - $this->assertEquals(0, $timesheet->getRate()); - $this->assertNull($timesheet->getHourlyRate()); - $this->assertNull($timesheet->getFixedRate()); + self::assertInstanceOf(\DateTime::class, $timesheet->getBegin()); + self::assertNull($timesheet->getEnd()); + self::assertEquals('Testing is fun!', $timesheet->getDescription()); + self::assertEquals(0, $timesheet->getRate()); + self::assertNull($timesheet->getHourlyRate()); + self::assertNull($timesheet->getFixedRate()); } /** @@ -232,7 +232,7 @@ class TimesheetControllerTest extends ControllerBaseTest { $client = $this->getClientForAuthenticatedUser(); $this->request($client, '/timesheet/create'); - $this->assertTrue($client->getResponse()->isSuccessful()); + self::assertTrue($client->getResponse()->isSuccessful()); $form = $client->getCrawler()->filter('form[name=timesheet_edit_form]')->form(); $client->submit($form, [ @@ -249,20 +249,20 @@ class TimesheetControllerTest extends ControllerBaseTest $this->assertIsRedirect($client, $this->createUrl('/timesheet/')); $client->followRedirect(); - $this->assertTrue($client->getResponse()->isSuccessful()); + self::assertTrue($client->getResponse()->isSuccessful()); $this->assertHasFlashSuccess($client); $em = $this->getEntityManager(); /** @var Timesheet $timesheet */ $timesheet = $em->getRepository(Timesheet::class)->findAll()[0]; - $this->assertInstanceOf(\DateTime::class, $timesheet->getBegin()); - $this->assertInstanceOf(\DateTime::class, $timesheet->getEnd()); - $this->assertEquals($expectedDuration, $timesheet->getDuration()); - $this->assertEquals($expectedEnd, $timesheet->getEnd()->format('Y-m-d H:i:s')); - $this->assertEquals('Testing is fun!', $timesheet->getDescription()); + self::assertInstanceOf(\DateTime::class, $timesheet->getBegin()); + self::assertInstanceOf(\DateTime::class, $timesheet->getEnd()); + self::assertEquals($expectedDuration, $timesheet->getDuration()); + self::assertEquals($expectedEnd, $timesheet->getEnd()->format('Y-m-d H:i:s')); + self::assertEquals('Testing is fun!', $timesheet->getDescription()); } - public function getTestDataForDurationValues(): \Generator + public static function getTestDataForDurationValues(): \Generator { // duration is ignored, because end is set and the duration might come from a rounding rule (by default seconds are rounded down with 1) yield ['12/31/2018', '12:00 AM', '02:10 AM', '01:00', 7800, '2018-12-31 02:10:00']; @@ -291,26 +291,26 @@ class TimesheetControllerTest extends ControllerBaseTest $dispatcher = self::getContainer()->get('event_dispatcher'); $dispatcher->addSubscriber(new TimesheetTestMetaFieldSubscriberMock()); $this->request($client, '/timesheet/create'); - $this->assertTrue($client->getResponse()->isSuccessful()); + self::assertTrue($client->getResponse()->isSuccessful()); $form = $client->getCrawler()->filter('form[name=timesheet_edit_form]')->form(); - $this->assertTrue($form->has('timesheet_edit_form[metaFields][metatestmock][value]')); - $this->assertTrue($form->has('timesheet_edit_form[metaFields][foobar][value]')); - $this->assertFalse($form->has('timesheet_edit_form[metaFields][0][value]')); + self::assertTrue($form->has('timesheet_edit_form[metaFields][metatestmock][value]')); + self::assertTrue($form->has('timesheet_edit_form[metaFields][foobar][value]')); + self::assertFalse($form->has('timesheet_edit_form[metaFields][0][value]')); } public function testCreateActionDoesNotShowRateFieldsForUser(): void { $client = $this->getClientForAuthenticatedUser(); $this->request($client, '/timesheet/create'); - $this->assertTrue($client->getResponse()->isSuccessful()); + self::assertTrue($client->getResponse()->isSuccessful()); $form = $client->getCrawler()->filter('form[name=timesheet_edit_form]')->form(); - $this->assertFalse($form->has('timesheet_edit_form[hourlyRate]')); - $this->assertFalse($form->has('timesheet_edit_form[fixedRate]')); + self::assertFalse($form->has('timesheet_edit_form[hourlyRate]')); + self::assertFalse($form->has('timesheet_edit_form[fixedRate]')); } - public function getTrackingModeTestData(): array + public static function getTrackingModeTestData(): array { return [ ['duration_fixed_begin', User::ROLE_USER, false, false], @@ -330,18 +330,18 @@ class TimesheetControllerTest extends ControllerBaseTest $client = $this->getClientForAuthenticatedUser($user); $this->setSystemConfiguration('timesheet.mode', $trackingMode); $this->request($client, '/timesheet/create'); - $this->assertTrue($client->getResponse()->isSuccessful()); + self::assertTrue($client->getResponse()->isSuccessful()); $form = $client->getCrawler()->filter('form[name=timesheet_edit_form]')->form(); - $this->assertEquals($showBeginTime, $form->has('timesheet_edit_form[begin_time]')); - $this->assertEquals($showEndTime, $form->has('timesheet_edit_form[end_time]')); + self::assertEquals($showBeginTime, $form->has('timesheet_edit_form[begin_time]')); + self::assertEquals($showEndTime, $form->has('timesheet_edit_form[end_time]')); } public function testCreateActionWithFromAndToValues(): void { $client = $this->getClientForAuthenticatedUser(User::ROLE_ADMIN); $this->request($client, '/timesheet/create?from=2018-08-02T20%3A00%3A00&to=2018-08-02T20%3A30%3A00'); - $this->assertTrue($client->getResponse()->isSuccessful()); + self::assertTrue($client->getResponse()->isSuccessful()); $form = $client->getCrawler()->filter('form[name=timesheet_edit_form]')->form(); $client->submit($form, [ @@ -354,28 +354,28 @@ class TimesheetControllerTest extends ControllerBaseTest $this->assertIsRedirect($client, $this->createUrl('/timesheet/')); $client->followRedirect(); - $this->assertTrue($client->getResponse()->isSuccessful()); + self::assertTrue($client->getResponse()->isSuccessful()); $this->assertHasFlashSuccess($client); $em = $this->getEntityManager(); /** @var Timesheet $timesheet */ $timesheet = $em->getRepository(Timesheet::class)->findAll()[0]; - $this->assertInstanceOf(\DateTime::class, $timesheet->getBegin()); - $this->assertInstanceOf(\DateTime::class, $timesheet->getEnd()); - $this->assertEquals(50, $timesheet->getRate()); + self::assertInstanceOf(\DateTime::class, $timesheet->getBegin()); + self::assertInstanceOf(\DateTime::class, $timesheet->getEnd()); + self::assertEquals(50, $timesheet->getRate()); $expected = new \DateTime('2018-08-02T20:00:00'); - $this->assertEquals($expected->format(\DateTimeInterface::ATOM), $timesheet->getBegin()->format(\DateTimeInterface::ATOM)); + self::assertEquals($expected->format(\DateTimeInterface::ATOM), $timesheet->getBegin()->format(\DateTimeInterface::ATOM)); $expected = new \DateTime('2018-08-02T20:30:00'); - $this->assertEquals($expected->format(\DateTimeInterface::ATOM), $timesheet->getEnd()->format(\DateTimeInterface::ATOM)); + self::assertEquals($expected->format(\DateTimeInterface::ATOM), $timesheet->getEnd()->format(\DateTimeInterface::ATOM)); } public function testCreateActionWithFromAndToValuesTwice(): void { $client = $this->getClientForAuthenticatedUser(User::ROLE_ADMIN); $this->request($client, '/timesheet/create?from=2018-08-02T20%3A00%3A00&to=2018-08-02T20%3A30%3A00'); - $this->assertTrue($client->getResponse()->isSuccessful()); + self::assertTrue($client->getResponse()->isSuccessful()); $form = $client->getCrawler()->filter('form[name=timesheet_edit_form]')->form(); $client->submit($form, [ @@ -388,25 +388,25 @@ class TimesheetControllerTest extends ControllerBaseTest $this->assertIsRedirect($client, $this->createUrl('/timesheet/')); $client->followRedirect(); - $this->assertTrue($client->getResponse()->isSuccessful()); + self::assertTrue($client->getResponse()->isSuccessful()); $this->assertHasFlashSuccess($client); $em = $this->getEntityManager(); /** @var Timesheet $timesheet */ $timesheet = $em->getRepository(Timesheet::class)->findAll()[0]; - $this->assertInstanceOf(\DateTime::class, $timesheet->getBegin()); - $this->assertInstanceOf(\DateTime::class, $timesheet->getEnd()); - $this->assertEquals(50, $timesheet->getRate()); + self::assertInstanceOf(\DateTime::class, $timesheet->getBegin()); + self::assertInstanceOf(\DateTime::class, $timesheet->getEnd()); + self::assertEquals(50, $timesheet->getRate()); $expected = new \DateTime('2018-08-02T20:00:00'); - $this->assertEquals($expected->format(\DateTimeInterface::ATOM), $timesheet->getBegin()->format(\DateTimeInterface::ATOM)); + self::assertEquals($expected->format(\DateTimeInterface::ATOM), $timesheet->getBegin()->format(\DateTimeInterface::ATOM)); $expected = new \DateTime('2018-08-02T20:30:00'); - $this->assertEquals($expected->format(\DateTimeInterface::ATOM), $timesheet->getEnd()->format(\DateTimeInterface::ATOM)); + self::assertEquals($expected->format(\DateTimeInterface::ATOM), $timesheet->getEnd()->format(\DateTimeInterface::ATOM)); // create a second entry that is overlapping $this->request($client, '/timesheet/create?from=2018-08-02T20%3A02%3A00&to=2018-08-02T20%3A20%3A00'); - $this->assertTrue($client->getResponse()->isSuccessful()); + self::assertTrue($client->getResponse()->isSuccessful()); $form = $client->getCrawler()->filter('form[name=timesheet_edit_form]')->form(); $client->submit($form, [ @@ -418,7 +418,7 @@ class TimesheetControllerTest extends ControllerBaseTest ]); $this->assertIsRedirect($client, $this->createUrl('/timesheet/')); $client->followRedirect(); - $this->assertTrue($client->getResponse()->isSuccessful()); + self::assertTrue($client->getResponse()->isSuccessful()); $this->assertHasFlashSuccess($client); } @@ -496,7 +496,7 @@ class TimesheetControllerTest extends ControllerBaseTest $this->request($client, '/timesheet/' . $id . '/edit'); $response = $client->getResponse(); - $this->assertTrue($response->isSuccessful()); + self::assertTrue($response->isSuccessful()); $this->setSystemConfiguration('timesheet.rules.allow_overbooking_budget', false); @@ -545,7 +545,7 @@ class TimesheetControllerTest extends ControllerBaseTest $this->request($client, '/timesheet/' . $id . '/edit'); $response = $client->getResponse(); - $this->assertTrue($response->isSuccessful()); + self::assertTrue($response->isSuccessful()); $this->setSystemConfiguration('timesheet.rules.allow_zero_duration', false); @@ -578,7 +578,7 @@ class TimesheetControllerTest extends ControllerBaseTest $this->importFixture($fixture); $this->request($client, '/timesheet/create?begin=2018-08-02&end=2018-08-02&tags=one,two,three'); - $this->assertTrue($client->getResponse()->isSuccessful()); + self::assertTrue($client->getResponse()->isSuccessful()); $form = $client->getCrawler()->filter('form[name=timesheet_edit_form]')->form(); $client->submit($form, [ @@ -591,23 +591,23 @@ class TimesheetControllerTest extends ControllerBaseTest $this->assertIsRedirect($client, $this->createUrl('/timesheet/')); $client->followRedirect(); - $this->assertTrue($client->getResponse()->isSuccessful()); + self::assertTrue($client->getResponse()->isSuccessful()); $this->assertHasFlashSuccess($client); $em = $this->getEntityManager(); /** @var Timesheet $timesheet */ $timesheet = $em->getRepository(Timesheet::class)->findAll()[0]; - $this->assertInstanceOf(\DateTime::class, $timesheet->getBegin()); - $this->assertInstanceOf(\DateTime::class, $timesheet->getEnd()); - $this->assertEquals(800, $timesheet->getRate()); + self::assertInstanceOf(\DateTime::class, $timesheet->getBegin()); + self::assertInstanceOf(\DateTime::class, $timesheet->getEnd()); + self::assertEquals(800, $timesheet->getRate()); $expected = new \DateTime('2018-08-02T10:00:00'); - $this->assertEquals($expected->format(\DateTimeInterface::ATOM), $timesheet->getBegin()->format(\DateTimeInterface::ATOM)); + self::assertEquals($expected->format(\DateTimeInterface::ATOM), $timesheet->getBegin()->format(\DateTimeInterface::ATOM)); $expected = new \DateTime('2018-08-02T18:00:00'); - $this->assertEquals($expected->format(\DateTimeInterface::ATOM), $timesheet->getEnd()->format(\DateTimeInterface::ATOM)); + self::assertEquals($expected->format(\DateTimeInterface::ATOM), $timesheet->getEnd()->format(\DateTimeInterface::ATOM)); - $this->assertEquals(['two'], $timesheet->getTagsAsArray()); + self::assertEquals(['two'], $timesheet->getTagsAsArray()); } public function testCreateActionWithDescription(): void @@ -615,7 +615,7 @@ class TimesheetControllerTest extends ControllerBaseTest $client = $this->getClientForAuthenticatedUser(User::ROLE_ADMIN); $this->request($client, '/timesheet/create?description=Lorem%20Ipsum'); - $this->assertTrue($client->getResponse()->isSuccessful()); + self::assertTrue($client->getResponse()->isSuccessful()); $form = $client->getCrawler()->filter('form[name=timesheet_edit_form]')->form(); $client->submit($form, [ @@ -628,13 +628,13 @@ class TimesheetControllerTest extends ControllerBaseTest $this->assertIsRedirect($client, $this->createUrl('/timesheet/')); $client->followRedirect(); - $this->assertTrue($client->getResponse()->isSuccessful()); + self::assertTrue($client->getResponse()->isSuccessful()); $this->assertHasFlashSuccess($client); $em = $this->getEntityManager(); /** @var Timesheet $timesheet */ $timesheet = $em->getRepository(Timesheet::class)->findAll()[0]; - $this->assertEquals('Lorem Ipsum', $timesheet->getDescription()); + self::assertEquals('Lorem Ipsum', $timesheet->getDescription()); } public function testCreateActionWithDescriptionHtmlInjection(): void @@ -642,7 +642,7 @@ class TimesheetControllerTest extends ControllerBaseTest $client = $this->getClientForAuthenticatedUser(User::ROLE_ADMIN); $this->request($client, '/timesheet/create?description=Some text">HelloWorld<%2Fbold>'); - $this->assertTrue($client->getResponse()->isSuccessful()); + self::assertTrue($client->getResponse()->isSuccessful()); $form = $client->getCrawler()->filter('form[name=timesheet_edit_form]')->form(); $client->submit($form, [ @@ -655,13 +655,13 @@ class TimesheetControllerTest extends ControllerBaseTest $this->assertIsRedirect($client, $this->createUrl('/timesheet/')); $client->followRedirect(); - $this->assertTrue($client->getResponse()->isSuccessful()); + self::assertTrue($client->getResponse()->isSuccessful()); $this->assertHasFlashSuccess($client); $em = $this->getEntityManager(); /** @var Timesheet $timesheet */ $timesheet = $em->getRepository(Timesheet::class)->findAll()[0]; - $this->assertEquals('Some text">HelloWorld', $timesheet->getDescription()); + self::assertEquals('Some text">HelloWorld', $timesheet->getDescription()); } public function testEditAction(): void @@ -684,9 +684,9 @@ class TimesheetControllerTest extends ControllerBaseTest $this->request($client, '/timesheet/' . $id . '/edit'); $response = $client->getResponse(); - $this->assertTrue($response->isSuccessful()); + self::assertTrue($response->isSuccessful()); - $this->assertStringContainsString( + self::assertStringContainsString( 'href="https://www.kimai.org/documentation/timesheet.html"', $response->getContent(), 'Could not find link to documentation' @@ -702,13 +702,13 @@ class TimesheetControllerTest extends ControllerBaseTest $this->assertIsRedirect($client, $this->createUrl('/timesheet/')); $client->followRedirect(); - $this->assertTrue($client->getResponse()->isSuccessful()); + self::assertTrue($client->getResponse()->isSuccessful()); $this->assertHasFlashSaveSuccess($client); $em = $this->getEntityManager(); /** @var Timesheet $timesheet */ $timesheet = $em->getRepository(Timesheet::class)->find($id); - $this->assertEquals('foo-bar', $timesheet->getDescription()); + self::assertEquals('foo-bar', $timesheet->getDescription()); } public function testMultiDeleteAction(): void @@ -784,7 +784,7 @@ class TimesheetControllerTest extends ControllerBaseTest 'entities' => implode(',', $ids) ] ]); - $this->assertTrue($client->getResponse()->isSuccessful()); + self::assertTrue($client->getResponse()->isSuccessful()); $form = $client->getCrawler()->filter('form[name=timesheet_multi_update]')->form(); $client->submit($form, [ @@ -834,25 +834,25 @@ class TimesheetControllerTest extends ControllerBaseTest $newId = $ids[0]->getId(); $this->request($client, '/timesheet/' . $newId . '/duplicate'); - $this->assertTrue($client->getResponse()->isSuccessful()); + self::assertTrue($client->getResponse()->isSuccessful()); $form = $client->getCrawler()->filter('form[name=timesheet_edit_form]')->form(); $client->submit($form, $form->getPhpValues()); $this->assertIsRedirect($client, $this->createUrl('/timesheet/')); $client->followRedirect(); - $this->assertTrue($client->getResponse()->isSuccessful()); + self::assertTrue($client->getResponse()->isSuccessful()); $this->assertHasFlashSuccess($client); $em = $this->getEntityManager(); /** @var Timesheet $timesheet */ $timesheet = $em->getRepository(Timesheet::class)->find($newId++); - $this->assertInstanceOf(\DateTime::class, $timesheet->getBegin()); - $this->assertEquals('Europe/London', $timesheet->getBegin()->getTimezone()->getName()); - $this->assertEquals('Testing is fun!', $timesheet->getDescription()); - $this->assertEquals(2016, $timesheet->getRate()); - $this->assertEquals(127, $timesheet->getHourlyRate()); - $this->assertEquals(2016, $timesheet->getFixedRate()); - $this->assertEquals(2016, $timesheet->getRate()); + self::assertInstanceOf(\DateTime::class, $timesheet->getBegin()); + self::assertEquals('Europe/London', $timesheet->getBegin()->getTimezone()->getName()); + self::assertEquals('Testing is fun!', $timesheet->getDescription()); + self::assertEquals(2016, $timesheet->getRate()); + self::assertEquals(127, $timesheet->getHourlyRate()); + self::assertEquals(2016, $timesheet->getFixedRate()); + self::assertEquals(2016, $timesheet->getRate()); } } diff --git a/tests/Controller/TimesheetTeamControllerTest.php b/tests/Controller/TimesheetTeamControllerTest.php index 00be7741..f0d9490d 100644 --- a/tests/Controller/TimesheetTeamControllerTest.php +++ b/tests/Controller/TimesheetTeamControllerTest.php @@ -21,7 +21,7 @@ use App\Timesheet\Util; /** * @group integration */ -class TimesheetTeamControllerTest extends ControllerBaseTest +class TimesheetTeamControllerTest extends AbstractControllerBaseTestCase { public function testIsSecure(): void { @@ -37,7 +37,7 @@ class TimesheetTeamControllerTest extends ControllerBaseTest { $client = $this->getClientForAuthenticatedUser(User::ROLE_TEAMLEAD); $this->assertAccessIsGranted($client, '/team/timesheet/'); - $this->assertTrue($client->getResponse()->isSuccessful()); + self::assertTrue($client->getResponse()->isSuccessful()); // there are no records by default in the test database $this->assertHasNoEntriesWithFilter($client); @@ -67,7 +67,7 @@ class TimesheetTeamControllerTest extends ControllerBaseTest $this->importFixture($fixture); $this->request($client, '/team/timesheet/'); - $this->assertTrue($client->getResponse()->isSuccessful()); + self::assertTrue($client->getResponse()->isSuccessful()); $dateRange = $this->formatDateRange($start, new \DateTime('last day of this month')); @@ -80,7 +80,7 @@ class TimesheetTeamControllerTest extends ControllerBaseTest 'customers' => [], ]); - $this->assertTrue($client->getResponse()->isSuccessful()); + self::assertTrue($client->getResponse()->isSuccessful()); $this->assertHasDataTable($client); $this->assertDataTableRowCount($client, 'datatable_timesheet_admin', 13); @@ -112,14 +112,14 @@ class TimesheetTeamControllerTest extends ControllerBaseTest $this->importFixture($fixture); $this->request($client, '/team/timesheet/'); - $this->assertTrue($client->getResponse()->isSuccessful()); + self::assertTrue($client->getResponse()->isSuccessful()); $form = $client->getCrawler()->filter('form.searchform')->form(); $client->submit($form, [ 'searchTerm' => 'location:homeoffice foobar', ]); - $this->assertTrue($client->getResponse()->isSuccessful()); + self::assertTrue($client->getResponse()->isSuccessful()); $this->assertHasDataTable($client); $this->assertDataTableRowCount($client, 'datatable_timesheet_admin', 5); } @@ -140,7 +140,7 @@ class TimesheetTeamControllerTest extends ControllerBaseTest $this->importFixture($fixture); $this->request($client, '/team/timesheet/'); - $this->assertTrue($client->getResponse()->isSuccessful()); + self::assertTrue($client->getResponse()->isSuccessful()); $dateRange = $this->formatDateRange(new \DateTime('-10 days'), new \DateTime()); @@ -152,15 +152,15 @@ class TimesheetTeamControllerTest extends ControllerBaseTest 'customers' => [], ]); - $this->assertTrue($client->getResponse()->isSuccessful()); + self::assertTrue($client->getResponse()->isSuccessful()); $node = $client->getCrawler()->filter('body'); /** @var \DOMElement $body */ $body = $node->getNode(0); - $this->assertEquals('invoice_print', $body->getAttribute('class')); + self::assertEquals('invoice_print', $body->getAttribute('class')); $result = $node->filter('section.invoice table.table tbody tr'); - $this->assertEquals(10, \count($result)); + self::assertEquals(10, \count($result)); } public function testExporterNotFoundAction(): void @@ -174,7 +174,7 @@ class TimesheetTeamControllerTest extends ControllerBaseTest { $client = $this->getClientForAuthenticatedUser(User::ROLE_ADMIN); $this->request($client, '/team/timesheet/create'); - $this->assertTrue($client->getResponse()->isSuccessful()); + self::assertTrue($client->getResponse()->isSuccessful()); $form = $client->getCrawler()->filter('form[name=timesheet_admin_edit_form]')->form(); $client->submit($form, [ @@ -187,18 +187,18 @@ class TimesheetTeamControllerTest extends ControllerBaseTest $this->assertIsRedirect($client, $this->createUrl('/team/timesheet/')); $client->followRedirect(); - $this->assertTrue($client->getResponse()->isSuccessful()); + self::assertTrue($client->getResponse()->isSuccessful()); $this->assertHasFlashSuccess($client); $em = $this->getEntityManager(); /** @var Timesheet $timesheet */ $timesheet = $em->getRepository(Timesheet::class)->findAll()[0]; - $this->assertInstanceOf(\DateTime::class, $timesheet->getBegin()); - $this->assertNull($timesheet->getEnd()); - $this->assertEquals('Testing is fun!', $timesheet->getDescription()); - $this->assertEquals(0, $timesheet->getRate()); - $this->assertNull($timesheet->getHourlyRate()); - $this->assertNull($timesheet->getFixedRate()); + self::assertInstanceOf(\DateTime::class, $timesheet->getBegin()); + self::assertNull($timesheet->getEnd()); + self::assertEquals('Testing is fun!', $timesheet->getDescription()); + self::assertEquals(0, $timesheet->getRate()); + self::assertNull($timesheet->getHourlyRate()); + self::assertNull($timesheet->getFixedRate()); } public function testCreateForMultipleUsersAction(): void @@ -210,7 +210,7 @@ class TimesheetTeamControllerTest extends ControllerBaseTest $this->importFixture($fixture); $this->request($client, '/team/timesheet/create_mu'); - $this->assertTrue($client->getResponse()->isSuccessful()); + self::assertTrue($client->getResponse()->isSuccessful()); $form = $client->getCrawler()->filter('form[name=timesheet_multi_user_edit_form]')->form(); $client->submit($form, [ @@ -225,21 +225,21 @@ class TimesheetTeamControllerTest extends ControllerBaseTest $this->assertIsRedirect($client, $this->createUrl('/team/timesheet/')); $client->followRedirect(); - $this->assertTrue($client->getResponse()->isSuccessful()); + self::assertTrue($client->getResponse()->isSuccessful()); $this->assertHasFlashSuccess($client); $em = $this->getEntityManager(); /** @var Timesheet[] $timesheets */ $timesheets = $em->getRepository(Timesheet::class)->findAll(); - $this->assertCount(2, $timesheets); + self::assertCount(2, $timesheets); foreach ($timesheets as $timesheet) { - $this->assertInstanceOf(\DateTime::class, $timesheet->getBegin()); - $this->assertNull($timesheet->getEnd()); - $this->assertEquals('Testing is more fun!', $timesheet->getDescription()); - $this->assertEquals(0, $timesheet->getRate()); - $this->assertNull($timesheet->getHourlyRate()); - $this->assertNull($timesheet->getFixedRate()); - $this->assertEquals(['test', '1234', 'foo-bar'], $timesheet->getTagsAsArray()); + self::assertInstanceOf(\DateTime::class, $timesheet->getBegin()); + self::assertNull($timesheet->getEnd()); + self::assertEquals('Testing is more fun!', $timesheet->getDescription()); + self::assertEquals(0, $timesheet->getRate()); + self::assertNull($timesheet->getHourlyRate()); + self::assertNull($timesheet->getFixedRate()); + self::assertEquals(['test', '1234', 'foo-bar'], $timesheet->getTagsAsArray()); } } @@ -290,9 +290,9 @@ class TimesheetTeamControllerTest extends ControllerBaseTest $this->request($client, '/team/timesheet/' . $id . '/edit'); $response = $client->getResponse(); - $this->assertTrue($response->isSuccessful()); + self::assertTrue($response->isSuccessful()); - $this->assertStringContainsString( + self::assertStringContainsString( 'href="https://www.kimai.org/documentation/timesheet.html"', $response->getContent(), 'Could not find link to documentation' @@ -309,14 +309,14 @@ class TimesheetTeamControllerTest extends ControllerBaseTest $this->assertIsRedirect($client, $this->createUrl('/team/timesheet/')); $client->followRedirect(); - $this->assertTrue($client->getResponse()->isSuccessful()); + self::assertTrue($client->getResponse()->isSuccessful()); $this->assertHasFlashSaveSuccess($client); $em = $this->getEntityManager(); /** @var Timesheet $timesheet */ $timesheet = $em->getRepository(Timesheet::class)->find($id); - $this->assertEquals('foo-bar', $timesheet->getDescription()); - $this->assertEquals($teamlead->getId(), $timesheet->getUser()->getId()); + self::assertEquals('foo-bar', $timesheet->getDescription()); + self::assertEquals($teamlead->getId(), $timesheet->getUser()->getId()); } public function testMultiDeleteAction(): void @@ -392,7 +392,7 @@ class TimesheetTeamControllerTest extends ControllerBaseTest 'entities' => implode(',', $ids) ] ]); - $this->assertTrue($client->getResponse()->isSuccessful()); + self::assertTrue($client->getResponse()->isSuccessful()); $newUser = $this->getUserByRole(User::ROLE_USER); $form = $client->getCrawler()->filter('form[name=timesheet_multi_update]')->form(); @@ -446,25 +446,25 @@ class TimesheetTeamControllerTest extends ControllerBaseTest $newId = $ids[0]->getId(); $this->request($client, '/team/timesheet/' . $newId . '/duplicate'); - $this->assertTrue($client->getResponse()->isSuccessful()); + self::assertTrue($client->getResponse()->isSuccessful()); $form = $client->getCrawler()->filter('form[name=timesheet_admin_edit_form]')->form(); $client->submit($form, $form->getPhpValues()); $this->assertIsRedirect($client, $this->createUrl('/team/timesheet/')); $client->followRedirect(); - $this->assertTrue($client->getResponse()->isSuccessful()); + self::assertTrue($client->getResponse()->isSuccessful()); $this->assertHasFlashSuccess($client); $em = $this->getEntityManager(); /** @var Timesheet $timesheet */ $timesheet = $em->getRepository(Timesheet::class)->find($newId++); - $this->assertInstanceOf(\DateTime::class, $timesheet->getBegin()); - $this->assertEquals('Europe/London', $timesheet->getBegin()->getTimezone()->getName()); - $this->assertEquals('Testing is fun!', $timesheet->getDescription()); - $this->assertEquals(2016, $timesheet->getRate()); - $this->assertEquals(127, $timesheet->getHourlyRate()); - $this->assertEquals(2016, $timesheet->getFixedRate()); - $this->assertEquals(2016, $timesheet->getRate()); + self::assertInstanceOf(\DateTime::class, $timesheet->getBegin()); + self::assertEquals('Europe/London', $timesheet->getBegin()->getTimezone()->getName()); + self::assertEquals('Testing is fun!', $timesheet->getDescription()); + self::assertEquals(2016, $timesheet->getRate()); + self::assertEquals(127, $timesheet->getHourlyRate()); + self::assertEquals(2016, $timesheet->getFixedRate()); + self::assertEquals(2016, $timesheet->getRate()); } } diff --git a/tests/Controller/UserControllerTest.php b/tests/Controller/UserControllerTest.php index f0abdf6f..cf3824c1 100644 --- a/tests/Controller/UserControllerTest.php +++ b/tests/Controller/UserControllerTest.php @@ -16,7 +16,7 @@ use App\Tests\DataFixtures\TimesheetFixtures; /** * @group integration */ -class UserControllerTest extends ControllerBaseTest +class UserControllerTest extends AbstractControllerBaseTestCase { public function testIsSecure(): void { @@ -48,7 +48,7 @@ class UserControllerTest extends ControllerBaseTest $client = $this->getClientForAuthenticatedUser(User::ROLE_SUPER_ADMIN); $this->request($client, '/admin/user/'); - $this->assertTrue($client->getResponse()->isSuccessful()); + self::assertTrue($client->getResponse()->isSuccessful()); $form = $client->getCrawler()->filter('form.searchform')->form(); $client->submit($form, [ @@ -59,7 +59,7 @@ class UserControllerTest extends ControllerBaseTest 'page' => 1, ]); - $this->assertTrue($client->getResponse()->isSuccessful()); + self::assertTrue($client->getResponse()->isSuccessful()); $this->assertHasDataTable($client); $this->assertDataTableRowCount($client, 'datatable_user_admin', 1); } @@ -81,7 +81,7 @@ class UserControllerTest extends ControllerBaseTest $client = $this->getClientForAuthenticatedUser(User::ROLE_SUPER_ADMIN); $this->request($client, '/admin/user/'); - $this->assertTrue($client->getResponse()->isSuccessful()); + self::assertTrue($client->getResponse()->isSuccessful()); $form = $client->getCrawler()->filter('form.searchform')->form(); $form->getFormNode()->setAttribute('action', $this->createUrl('/admin/user/export')); @@ -116,7 +116,7 @@ class UserControllerTest extends ControllerBaseTest $this->requestPure($client, $location); $form = $client->getCrawler()->filter('form[name=user_edit]')->form(); - $this->assertEquals($username, $form->get('user_edit[alias]')->getValue()); + self::assertEquals($username, $form->get('user_edit[alias]')->getValue()); } public function testDeleteAction(): void @@ -124,10 +124,10 @@ class UserControllerTest extends ControllerBaseTest $client = $this->getClientForAuthenticatedUser(User::ROLE_SUPER_ADMIN); $this->request($client, '/admin/user/4/delete'); - $this->assertTrue($client->getResponse()->isSuccessful()); + self::assertTrue($client->getResponse()->isSuccessful()); $form = $client->getCrawler()->filter('form[name=form]')->form(); - $this->assertStringEndsWith($this->createUrl('/admin/user/4/delete'), $form->getUri()); + self::assertStringEndsWith($this->createUrl('/admin/user/4/delete'), $form->getUri()); $client->submit($form); $client->followRedirect(); @@ -135,7 +135,7 @@ class UserControllerTest extends ControllerBaseTest $this->assertHasFlashSuccess($client); $this->request($client, '/admin/user/4/edit'); - $this->assertFalse($client->getResponse()->isSuccessful()); + self::assertFalse($client->getResponse()->isSuccessful()); } public function testDeleteActionWithTimesheetEntries(): void @@ -151,13 +151,13 @@ class UserControllerTest extends ControllerBaseTest $this->importFixture($fixture); $timesheets = $em->getRepository(Timesheet::class)->findAll(); - $this->assertEquals(10, \count($timesheets)); + self::assertEquals(10, \count($timesheets)); $this->request($client, '/admin/user/' . $user->getId() . '/delete'); - $this->assertTrue($client->getResponse()->isSuccessful()); + self::assertTrue($client->getResponse()->isSuccessful()); $form = $client->getCrawler()->filter('form[name=form]')->form(); - $this->assertStringEndsWith($this->createUrl('/admin/user/' . $user->getId() . '/delete'), $form->getUri()); + self::assertStringEndsWith($this->createUrl('/admin/user/' . $user->getId() . '/delete'), $form->getUri()); $client->submit($form); $this->assertIsRedirect($client, $this->createUrl('/admin/user/')); @@ -166,10 +166,10 @@ class UserControllerTest extends ControllerBaseTest $em->clear(); $timesheets = $em->getRepository(Timesheet::class)->count([]); - $this->assertEquals(0, $timesheets); + self::assertEquals(0, $timesheets); $this->request($client, '/admin/user/' . $user->getId() . '/edit'); - $this->assertFalse($client->getResponse()->isSuccessful()); + self::assertFalse($client->getResponse()->isSuccessful()); } public function testDeleteActionWithUserReplacementAndTimesheetEntries(): void @@ -188,16 +188,16 @@ class UserControllerTest extends ControllerBaseTest $this->importFixture($fixture); $timesheets = $em->getRepository(Timesheet::class)->findAll(); - $this->assertEquals(10, \count($timesheets)); + self::assertEquals(10, \count($timesheets)); foreach ($timesheets as $timesheet) { - $this->assertEquals($user->getId(), $timesheet->getUser()->getId()); + self::assertEquals($user->getId(), $timesheet->getUser()->getId()); } $this->request($client, '/admin/user/' . $user->getId() . '/delete'); - $this->assertTrue($client->getResponse()->isSuccessful()); + self::assertTrue($client->getResponse()->isSuccessful()); $form = $client->getCrawler()->filter('form[name=form]')->form(); - $this->assertStringEndsWith($this->createUrl('/admin/user/' . $user->getId() . '/delete'), $form->getUri()); + self::assertStringEndsWith($this->createUrl('/admin/user/' . $user->getId() . '/delete'), $form->getUri()); $client->submit($form, [ 'form' => [ 'user' => $userNew->getId() @@ -210,13 +210,13 @@ class UserControllerTest extends ControllerBaseTest $em->clear(); $timesheets = $em->getRepository(Timesheet::class)->findAll(); - $this->assertEquals(10, \count($timesheets)); + self::assertEquals(10, \count($timesheets)); foreach ($timesheets as $timesheet) { - $this->assertEquals($userNew->getId(), $timesheet->getUser()->getId()); + self::assertEquals($userNew->getId(), $timesheet->getUser()->getId()); } $this->request($client, '/admin/user/' . $user->getId() . '/edit'); - $this->assertFalse($client->getResponse()->isSuccessful()); + self::assertFalse($client->getResponse()->isSuccessful()); } /** @@ -233,7 +233,7 @@ class UserControllerTest extends ControllerBaseTest ); } - public function getValidationTestData() + public static function getValidationTestData() { return [ [ diff --git a/tests/Controller/WidgetControllerTest.php b/tests/Controller/WidgetControllerTest.php index f2c6b37f..f5863167 100644 --- a/tests/Controller/WidgetControllerTest.php +++ b/tests/Controller/WidgetControllerTest.php @@ -14,7 +14,7 @@ use App\Entity\User; /** * @group integration */ -class WidgetControllerTest extends ControllerBaseTest +class WidgetControllerTest extends AbstractControllerBaseTestCase { public function testIsSecure(): void { diff --git a/tests/Controller/WizardControllerTest.php b/tests/Controller/WizardControllerTest.php index dba3d790..68a1368a 100644 --- a/tests/Controller/WizardControllerTest.php +++ b/tests/Controller/WizardControllerTest.php @@ -14,7 +14,7 @@ use App\Entity\User; /** * @group integration */ -class WizardControllerTest extends ControllerBaseTest +class WizardControllerTest extends AbstractControllerBaseTestCase { public function testUnknownWizard(): void { diff --git a/tests/DependencyInjection/AppExtensionTest.php b/tests/DependencyInjection/AppExtensionTest.php index 3281a6c5..feb919da 100644 --- a/tests/DependencyInjection/AppExtensionTest.php +++ b/tests/DependencyInjection/AppExtensionTest.php @@ -149,19 +149,19 @@ class AppExtensionTest extends TestCase ], ]; - $this->assertTrue($container->hasParameter('kimai.config')); + self::assertTrue($container->hasParameter('kimai.config')); /** @var array $config */ $config = $container->getParameter('kimai.config'); foreach (SystemConfigurationFactory::flatten($kimaiLdap) as $key => $value) { - $this->assertArrayHasKey($key, $config); - $this->assertEquals($value, $config[$key]); + self::assertArrayHasKey($key, $config); + self::assertEquals($value, $config[$key]); } foreach ($expected as $key => $value) { - $this->assertTrue($container->hasParameter($key), 'Could not find config: ' . $key); - $this->assertEquals($value, $container->getParameter($key), 'Invalid config: ' . $key); + self::assertTrue($container->hasParameter($key), 'Could not find config: ' . $key); + self::assertEquals($value, $container->getParameter($key), 'Invalid config: ' . $key); } } @@ -185,17 +185,17 @@ class AppExtensionTest extends TestCase $config = $container->getParameter('kimai.config'); - $this->assertIsArray($config); - $this->assertArrayHasKey('ldap.user.baseDn', $config); - $this->assertArrayHasKey('ldap.user.filter', $config); - $this->assertArrayHasKey('ldap.user.usernameAttribute', $config); - $this->assertArrayHasKey('ldap.connection.baseDn', $config); - $this->assertArrayHasKey('ldap.connection.accountFilterFormat', $config); - $this->assertEquals('123123123', $config['ldap.user.baseDn']); - $this->assertEquals('(..........)', $config['ldap.user.filter']); - $this->assertEquals('xxx', $config['ldap.user.usernameAttribute']); - $this->assertEquals('lkhiuzhkj', $config['ldap.connection.baseDn']); - $this->assertEquals('(uid=%s)', $config['ldap.connection.accountFilterFormat']); + self::assertIsArray($config); + self::assertArrayHasKey('ldap.user.baseDn', $config); + self::assertArrayHasKey('ldap.user.filter', $config); + self::assertArrayHasKey('ldap.user.usernameAttribute', $config); + self::assertArrayHasKey('ldap.connection.baseDn', $config); + self::assertArrayHasKey('ldap.connection.accountFilterFormat', $config); + self::assertEquals('123123123', $config['ldap.user.baseDn']); + self::assertEquals('(..........)', $config['ldap.user.filter']); + self::assertEquals('xxx', $config['ldap.user.usernameAttribute']); + self::assertEquals('lkhiuzhkj', $config['ldap.connection.baseDn']); + self::assertEquals('(uid=%s)', $config['ldap.connection.accountFilterFormat']); } public function testLdapFallbackValue(): void @@ -215,12 +215,12 @@ class AppExtensionTest extends TestCase $config = $container->getParameter('kimai.config'); - $this->assertIsArray($config); - $this->assertEquals('123123123', $config['ldap.user.baseDn']); - $this->assertEquals('xxx', $config['ldap.user.usernameAttribute']); - $this->assertEquals('123123123', $config['ldap.connection.baseDn']); - $this->assertEquals('(&(xxx=%s))', $config['ldap.connection.accountFilterFormat']); - $this->assertEquals('', $config['ldap.user.filter']); + self::assertIsArray($config); + self::assertEquals('123123123', $config['ldap.user.baseDn']); + self::assertEquals('xxx', $config['ldap.user.usernameAttribute']); + self::assertEquals('123123123', $config['ldap.connection.baseDn']); + self::assertEquals('(&(xxx=%s))', $config['ldap.connection.accountFilterFormat']); + self::assertEquals('', $config['ldap.user.filter']); } public function testLdapMoreFallbackValue(): void @@ -241,13 +241,13 @@ class AppExtensionTest extends TestCase $this->extension->load($minConfig, $container = $this->getContainer()); $config = $container->getParameter('kimai.config'); - $this->assertIsArray($config); + self::assertIsArray($config); - $this->assertEquals('123123123', $config['ldap.user.baseDn']); - $this->assertEquals('zzzz', $config['ldap.user.usernameAttribute']); - $this->assertEquals('7658765', $config['ldap.connection.baseDn']); - $this->assertEquals('(&(&(objectClass=inetOrgPerson))(zzzz=%s))', $config['ldap.connection.accountFilterFormat']); - $this->assertEquals('(&(objectClass=inetOrgPerson))', $config['ldap.user.filter']); + self::assertEquals('123123123', $config['ldap.user.baseDn']); + self::assertEquals('zzzz', $config['ldap.user.usernameAttribute']); + self::assertEquals('7658765', $config['ldap.connection.baseDn']); + self::assertEquals('(&(&(objectClass=inetOrgPerson))(zzzz=%s))', $config['ldap.connection.accountFilterFormat']); + self::assertEquals('(&(objectClass=inetOrgPerson))', $config['ldap.user.filter']); } public function testWithBundleConfiguration(): void diff --git a/tests/Doctrine/TimesheetSubscriberTest.php b/tests/Doctrine/TimesheetSubscriberTest.php index ea641028..3d435780 100644 --- a/tests/Doctrine/TimesheetSubscriberTest.php +++ b/tests/Doctrine/TimesheetSubscriberTest.php @@ -22,6 +22,6 @@ class TimesheetSubscriberTest extends TestCase { $sut = new TimesheetSubscriber([]); $events = $sut->getSubscribedEvents(); - $this->assertTrue(\in_array(Events::onFlush, $events)); + self::assertTrue(\in_array(Events::onFlush, $events)); } } diff --git a/tests/Doctrine/UTCDateTimeImmutableTypeTest.php b/tests/Doctrine/UTCDateTimeImmutableTypeTest.php index 5a64f0fc..f918d02d 100644 --- a/tests/Doctrine/UTCDateTimeImmutableTypeTest.php +++ b/tests/Doctrine/UTCDateTimeImmutableTypeTest.php @@ -27,10 +27,10 @@ class UTCDateTimeImmutableTypeTest extends TestCase Type::overrideType(Types::DATETIME_MUTABLE, UTCDateTimeImmutableType::class); $type = Type::getType(Types::DATETIME_MUTABLE); - $this->assertInstanceOf(UTCDateTimeImmutableType::class, $type); + self::assertInstanceOf(UTCDateTimeImmutableType::class, $type); $utc = $type::getUtc(); - $this->assertSame($utc, $type::getUtc()); - $this->assertEquals('UTC', $type::getUtc()->getName()); + self::assertSame($utc, $type::getUtc()); + self::assertEquals('UTC', $type::getUtc()->getName()); } /** @@ -43,13 +43,13 @@ class UTCDateTimeImmutableTypeTest extends TestCase $type = Type::getType(Types::DATETIME_MUTABLE); $result = $type->convertToDatabaseValue(null, $platform); - $this->assertNull($result); + self::assertNull($result); $berlinTz = new \DateTimeZone('Europe/Berlin'); $date = new \DateTimeImmutable('2019-01-17 13:30:00'); $date = $date->setTimezone($berlinTz); - $this->assertEquals('Europe/Berlin', $date->getTimezone()->getName()); + self::assertEquals('Europe/Berlin', $date->getTimezone()->getName()); $expected = clone $date; $expected = $expected->setTimezone($type::getUtc()); @@ -58,7 +58,7 @@ class UTCDateTimeImmutableTypeTest extends TestCase /** @var \DateTime $result */ $result = $type->convertToDatabaseValue($date, $platform); - $this->assertEquals($bla, $result); + self::assertEquals($bla, $result); } /** @@ -71,14 +71,14 @@ class UTCDateTimeImmutableTypeTest extends TestCase $type = Type::getType(Types::DATETIME_MUTABLE); $result = $type->convertToPHPValue(null, $platform); - $this->assertNull($result); + self::assertNull($result); $result = $type->convertToPHPValue('2019-01-17 13:30:00', $platform); - $this->assertInstanceOf(\DateTimeImmutable::class, $result); - $this->assertEquals('UTC', $result->getTimezone()->getName()); + self::assertInstanceOf(\DateTimeImmutable::class, $result); + self::assertEquals('UTC', $result->getTimezone()->getName()); $result = $result->format($platform->getDateTimeFormatString()); - $this->assertEquals('2019-01-17 13:30:00', $result); + self::assertEquals('2019-01-17 13:30:00', $result); } /** @@ -98,7 +98,7 @@ class UTCDateTimeImmutableTypeTest extends TestCase /** * @return \Doctrine\DBAL\Platforms\MySQLPlatform[][] */ - public function getPlatforms(): array + public static function getPlatforms(): array { return [ [new MySQLPlatform()], diff --git a/tests/Doctrine/UTCDateTimeTypeTest.php b/tests/Doctrine/UTCDateTimeTypeTest.php index 48719775..519c84ea 100644 --- a/tests/Doctrine/UTCDateTimeTypeTest.php +++ b/tests/Doctrine/UTCDateTimeTypeTest.php @@ -27,10 +27,10 @@ class UTCDateTimeTypeTest extends TestCase Type::overrideType(Types::DATETIME_MUTABLE, UTCDateTimeType::class); $type = Type::getType(Types::DATETIME_MUTABLE); - $this->assertInstanceOf(UTCDateTimeType::class, $type); + self::assertInstanceOf(UTCDateTimeType::class, $type); $utc = $type::getUtc(); - $this->assertSame($utc, $type::getUtc()); - $this->assertEquals('UTC', $type::getUtc()->getName()); + self::assertSame($utc, $type::getUtc()); + self::assertEquals('UTC', $type::getUtc()->getName()); } /** @@ -43,13 +43,13 @@ class UTCDateTimeTypeTest extends TestCase $type = Type::getType(Types::DATETIME_MUTABLE); $result = $type->convertToDatabaseValue(null, $platform); - $this->assertNull($result); + self::assertNull($result); $berlinTz = new \DateTimeZone('Europe/Berlin'); $date = new \DateTime('2019-01-17 13:30:00'); $date->setTimezone($berlinTz); - $this->assertEquals('Europe/Berlin', $date->getTimezone()->getName()); + self::assertEquals('Europe/Berlin', $date->getTimezone()->getName()); $expected = clone $date; $expected->setTimezone($type::getUtc()); @@ -58,7 +58,7 @@ class UTCDateTimeTypeTest extends TestCase /** @var \DateTime $result */ $result = $type->convertToDatabaseValue($date, $platform); - $this->assertEquals($bla, $result); + self::assertEquals($bla, $result); } /** @@ -71,14 +71,14 @@ class UTCDateTimeTypeTest extends TestCase $type = Type::getType(Types::DATETIME_MUTABLE); $result = $type->convertToPHPValue(null, $platform); - $this->assertNull($result); + self::assertNull($result); $result = $type->convertToPHPValue('2019-01-17 13:30:00', $platform); - $this->assertInstanceOf(\DateTime::class, $result); - $this->assertEquals('UTC', $result->getTimezone()->getName()); + self::assertInstanceOf(\DateTime::class, $result); + self::assertEquals('UTC', $result->getTimezone()->getName()); $result = $result->format($platform->getDateTimeFormatString()); - $this->assertEquals('2019-01-17 13:30:00', $result); + self::assertEquals('2019-01-17 13:30:00', $result); } /** @@ -98,7 +98,7 @@ class UTCDateTimeTypeTest extends TestCase /** * @return \Doctrine\DBAL\Platforms\MySQLPlatform[][] */ - public function getPlatforms(): array + public static function getPlatforms(): array { return [ [new MySQLPlatform()], diff --git a/tests/Entity/AbstractCommentEntityTest.php b/tests/Entity/AbstractCommentEntityTestCase.php similarity index 95% rename from tests/Entity/AbstractCommentEntityTest.php rename to tests/Entity/AbstractCommentEntityTestCase.php index 62dca412..8f8b8126 100644 --- a/tests/Entity/AbstractCommentEntityTest.php +++ b/tests/Entity/AbstractCommentEntityTestCase.php @@ -13,7 +13,7 @@ use App\Entity\CommentInterface; use App\Entity\User; use PHPUnit\Framework\TestCase; -abstract class AbstractCommentEntityTest extends TestCase +abstract class AbstractCommentEntityTestCase extends TestCase { abstract protected function getEntity(): CommentInterface; diff --git a/tests/Entity/AbstractEntityTest.php b/tests/Entity/AbstractEntityTestCase.php similarity index 66% rename from tests/Entity/AbstractEntityTest.php rename to tests/Entity/AbstractEntityTestCase.php index f07760d4..17eb16bb 100644 --- a/tests/Entity/AbstractEntityTest.php +++ b/tests/Entity/AbstractEntityTestCase.php @@ -12,31 +12,31 @@ namespace App\Tests\Entity; use App\Entity\EntityWithBudget; use PHPUnit\Framework\TestCase; -abstract class AbstractEntityTest extends TestCase +abstract class AbstractEntityTestCase extends TestCase { public function assertBudget(EntityWithBudget $entityWithBudget): void { - $this->assertEquals(0.0, $entityWithBudget->getBudget()); - $this->assertEquals(0, $entityWithBudget->getTimeBudget()); - $this->assertNull($entityWithBudget->getBudgetType()); - $this->assertFalse($entityWithBudget->isMonthlyBudget()); + self::assertEquals(0.0, $entityWithBudget->getBudget()); + self::assertEquals(0, $entityWithBudget->getTimeBudget()); + self::assertNull($entityWithBudget->getBudgetType()); + self::assertFalse($entityWithBudget->isMonthlyBudget()); self::assertFalse($entityWithBudget->hasBudget()); self::assertFalse($entityWithBudget->hasTimeBudget()); $entityWithBudget->setBudget(12345.67); - $this->assertEquals(12345.67, $entityWithBudget->getBudget()); + self::assertEquals(12345.67, $entityWithBudget->getBudget()); self::assertTrue($entityWithBudget->hasBudget()); self::assertFalse($entityWithBudget->hasTimeBudget()); $entityWithBudget->setTimeBudget(937321); - $this->assertEquals(937321, $entityWithBudget->getTimeBudget()); + self::assertEquals(937321, $entityWithBudget->getTimeBudget()); self::assertTrue($entityWithBudget->hasTimeBudget()); $entityWithBudget->setBudgetType('month'); - $this->assertTrue($entityWithBudget->isMonthlyBudget()); + self::assertTrue($entityWithBudget->isMonthlyBudget()); $entityWithBudget->setBudgetType(null); - $this->assertFalse($entityWithBudget->isMonthlyBudget()); + self::assertFalse($entityWithBudget->isMonthlyBudget()); try { $entityWithBudget->setBudgetType('foo'); diff --git a/tests/Entity/AbstractMetaEntityTest.php b/tests/Entity/AbstractMetaEntityTestCase.php similarity index 98% rename from tests/Entity/AbstractMetaEntityTest.php rename to tests/Entity/AbstractMetaEntityTestCase.php index aafa1797..75d0c502 100644 --- a/tests/Entity/AbstractMetaEntityTest.php +++ b/tests/Entity/AbstractMetaEntityTestCase.php @@ -17,7 +17,7 @@ use Symfony\Component\Validator\Constraints\Length; use Symfony\Component\Validator\Constraints\NotBlank; use Symfony\Component\Validator\Constraints\NotNull; -abstract class AbstractMetaEntityTest extends TestCase +abstract class AbstractMetaEntityTestCase extends TestCase { abstract protected function getEntity(): EntityWithMetaFields; diff --git a/tests/Entity/AccessTokenTest.php b/tests/Entity/AccessTokenTest.php index e226856c..9f56c7e5 100644 --- a/tests/Entity/AccessTokenTest.php +++ b/tests/Entity/AccessTokenTest.php @@ -15,31 +15,31 @@ use App\Entity\User; /** * @covers \App\Entity\AccessToken */ -class AccessTokenTest extends AbstractEntityTest +class AccessTokenTest extends AbstractEntityTestCase { public function testDefaultValues(): void { $user = new User(); $sut = new AccessToken($user, 'foo'); - $this->assertNull($sut->getId()); - $this->assertNull($sut->getName()); - $this->assertNull($sut->getExpiresAt()); - $this->assertNull($sut->getLastUsage()); - $this->assertSame('foo', $sut->getToken()); - $this->assertSame($user, $sut->getUser()); - $this->assertTrue($sut->isValid()); + self::assertNull($sut->getId()); + self::assertNull($sut->getName()); + self::assertNull($sut->getExpiresAt()); + self::assertNull($sut->getLastUsage()); + self::assertSame('foo', $sut->getToken()); + self::assertSame($user, $sut->getUser()); + self::assertTrue($sut->isValid()); $sut->setName('bar'); - $this->assertSame('bar', $sut->getName()); + self::assertSame('bar', $sut->getName()); $dateTime = new \DateTimeImmutable('-1 year'); $sut->setLastUsage($dateTime); - $this->assertSame($dateTime, $sut->getLastUsage()); + self::assertSame($dateTime, $sut->getLastUsage()); $dateTime = new \DateTimeImmutable('-1 month'); $sut->setExpiresAt($dateTime); - $this->assertSame($dateTime, $sut->getExpiresAt()); + self::assertSame($dateTime, $sut->getExpiresAt()); } public function testIsValid(): void @@ -47,6 +47,6 @@ class AccessTokenTest extends AbstractEntityTest $user = new User(); $sut = new AccessToken($user, 'foo'); $sut->setExpiresAt(new \DateTimeImmutable('-1 day')); - $this->assertFalse($sut->isValid()); + self::assertFalse($sut->isValid()); } } diff --git a/tests/Entity/ActivityMetaTest.php b/tests/Entity/ActivityMetaTest.php index d34cd7fc..9d8134ae 100644 --- a/tests/Entity/ActivityMetaTest.php +++ b/tests/Entity/ActivityMetaTest.php @@ -18,7 +18,7 @@ use App\Entity\Timesheet; /** * @covers \App\Entity\ActivityMeta */ -class ActivityMetaTest extends AbstractMetaEntityTest +class ActivityMetaTest extends AbstractMetaEntityTestCase { protected function getEntity(): EntityWithMetaFields { diff --git a/tests/Entity/ActivityTest.php b/tests/Entity/ActivityTest.php index ea1c3113..e491540a 100644 --- a/tests/Entity/ActivityTest.php +++ b/tests/Entity/ActivityTest.php @@ -21,25 +21,25 @@ use Doctrine\Common\Collections\Collection; /** * @covers \App\Entity\Activity */ -class ActivityTest extends AbstractEntityTest +class ActivityTest extends AbstractEntityTestCase { public function testDefaultValues(): void { $sut = new Activity(); - $this->assertNull($sut->getId()); - $this->assertNull($sut->getProject()); - $this->assertNull($sut->getName()); - $this->assertNull($sut->getComment()); - $this->assertNull($sut->getInvoiceText()); - $this->assertTrue($sut->isVisible()); - $this->assertTrue($sut->isBillable()); - $this->assertTrue($sut->isGlobal()); - $this->assertNull($sut->getColor()); + self::assertNull($sut->getId()); + self::assertNull($sut->getProject()); + self::assertNull($sut->getName()); + self::assertNull($sut->getComment()); + self::assertNull($sut->getInvoiceText()); + self::assertTrue($sut->isVisible()); + self::assertTrue($sut->isBillable()); + self::assertTrue($sut->isGlobal()); + self::assertNull($sut->getColor()); self::assertFalse($sut->hasColor()); - $this->assertInstanceOf(Collection::class, $sut->getMetaFields()); - $this->assertEquals(0, $sut->getMetaFields()->count()); - $this->assertNull($sut->getMetaField('foo')); - $this->assertInstanceOf(Collection::class, $sut->getTeams()); + self::assertInstanceOf(Collection::class, $sut->getMetaFields()); + self::assertEquals(0, $sut->getMetaFields()->count()); + self::assertNull($sut->getMetaField('foo')); + self::assertInstanceOf(Collection::class, $sut->getTeams()); } public function testBudgets(): void @@ -50,36 +50,36 @@ class ActivityTest extends AbstractEntityTest public function testSetterAndGetter(): void { $sut = new Activity(); - $this->assertInstanceOf(Activity::class, $sut->setName('foo-bar')); - $this->assertEquals('foo-bar', $sut->getName()); - $this->assertEquals('foo-bar', (string) $sut); + self::assertInstanceOf(Activity::class, $sut->setName('foo-bar')); + self::assertEquals('foo-bar', $sut->getName()); + self::assertEquals('foo-bar', (string) $sut); - $this->assertInstanceOf(Activity::class, $sut->setVisible(false)); - $this->assertFalse($sut->isVisible()); + self::assertInstanceOf(Activity::class, $sut->setVisible(false)); + self::assertFalse($sut->isVisible()); $sut->setVisible(false); self::assertFalse($sut->isVisible()); $sut->setVisible(true); self::assertTrue($sut->isVisible()); - $this->assertInstanceOf(Activity::class, $sut->setComment('hello world')); - $this->assertEquals('hello world', $sut->getComment()); + self::assertInstanceOf(Activity::class, $sut->setComment('hello world')); + self::assertEquals('hello world', $sut->getComment()); $sut->setInvoiceText('very long invoice text comment 12324'); self::assertEquals('very long invoice text comment 12324', $sut->getInvoiceText()); self::assertFalse($sut->hasColor()); $sut->setColor('#fffccc'); - $this->assertEquals('#fffccc', $sut->getColor()); + self::assertEquals('#fffccc', $sut->getColor()); self::assertTrue($sut->hasColor()); $sut->setColor(Constants::DEFAULT_COLOR); - $this->assertNull($sut->getColor()); + self::assertNull($sut->getColor()); self::assertFalse($sut->hasColor()); - $this->assertTrue($sut->isGlobal()); - $this->assertInstanceOf(Activity::class, $sut->setProject(new Project())); - $this->assertFalse($sut->isGlobal()); + self::assertTrue($sut->isGlobal()); + self::assertInstanceOf(Activity::class, $sut->setProject(new Project())); + self::assertFalse($sut->isGlobal()); } public function testMetaFields(): void @@ -87,7 +87,7 @@ class ActivityTest extends AbstractEntityTest $sut = new Activity(); $meta = new ActivityMeta(); $meta->setName('foo')->setValue('bar2')->setType('test'); - $this->assertInstanceOf(Activity::class, $sut->setMetaField($meta)); + self::assertInstanceOf(Activity::class, $sut->setMetaField($meta)); self::assertEquals(1, $sut->getMetaFields()->count()); $result = $sut->getMetaField('foo'); self::assertSame($result, $meta); @@ -96,7 +96,7 @@ class ActivityTest extends AbstractEntityTest $meta2 = new ActivityMeta(); $meta2->setName('foo')->setValue('bar')->setType('test2'); - $this->assertInstanceOf(Activity::class, $sut->setMetaField($meta2)); + self::assertInstanceOf(Activity::class, $sut->setMetaField($meta2)); self::assertEquals(1, $sut->getMetaFields()->count()); self::assertCount(0, $sut->getVisibleMetaFields()); diff --git a/tests/Entity/BookmarkTest.php b/tests/Entity/BookmarkTest.php index ba2c70fd..22ca273d 100644 --- a/tests/Entity/BookmarkTest.php +++ b/tests/Entity/BookmarkTest.php @@ -21,32 +21,32 @@ class BookmarkTest extends TestCase public function testDefaultValues(): void { $sut = new Bookmark(); - $this->assertNull($sut->getId()); - $this->assertNull($sut->getName()); - $this->assertIsArray($sut->getContent()); - $this->assertEquals([], $sut->getContent()); - $this->assertNull($sut->getType()); - $this->assertNull($sut->getUser()); + self::assertNull($sut->getId()); + self::assertNull($sut->getName()); + self::assertIsArray($sut->getContent()); + self::assertEquals([], $sut->getContent()); + self::assertNull($sut->getType()); + self::assertNull($sut->getUser()); } public function testSetterAndGetter(): void { $sut = new Bookmark(); $sut->setName('foo-bar'); - $this->assertEquals('foo-bar', $sut->getName()); + self::assertEquals('foo-bar', $sut->getName()); $sut->setContent(['test' => 'foo-bar', 'hello' => 'world']); - $this->assertEquals(['test' => 'foo-bar', 'hello' => 'world'], $sut->getContent()); + self::assertEquals(['test' => 'foo-bar', 'hello' => 'world'], $sut->getContent()); $sut->setType('sdsdsd'); - $this->assertEquals('sdsdsd', $sut->getType()); + self::assertEquals('sdsdsd', $sut->getType()); $user = new User(); $sut->setUser($user); - $this->assertEquals($user, $sut->getUser()); + self::assertEquals($user, $sut->getUser()); $sut2 = clone $sut; - $this->assertEquals('sdsdsd', $sut2->getType()); - $this->assertEquals('foo-bar', $sut2->getName()); + self::assertEquals('sdsdsd', $sut2->getType()); + self::assertEquals('foo-bar', $sut2->getName()); } } diff --git a/tests/Entity/ConfigurationTest.php b/tests/Entity/ConfigurationTest.php index 2721571f..265a4eb7 100644 --- a/tests/Entity/ConfigurationTest.php +++ b/tests/Entity/ConfigurationTest.php @@ -20,17 +20,17 @@ class ConfigurationTest extends TestCase public function testDefaultValues(): void { $sut = new Configuration(); - $this->assertNull($sut->getId()); - $this->assertNull($sut->getName()); - $this->assertNull($sut->getValue()); + self::assertNull($sut->getId()); + self::assertNull($sut->getName()); + self::assertNull($sut->getValue()); } public function testSetterAndGetter(): void { $sut = new Configuration(); - $this->assertInstanceOf(Configuration::class, $sut->setName('foo-bar')); - $this->assertEquals('foo-bar', $sut->getName()); - $this->assertInstanceOf(Configuration::class, $sut->setValue('hello world')); - $this->assertEquals('hello world', $sut->getValue()); + self::assertInstanceOf(Configuration::class, $sut->setName('foo-bar')); + self::assertEquals('foo-bar', $sut->getName()); + self::assertInstanceOf(Configuration::class, $sut->setValue('hello world')); + self::assertEquals('hello world', $sut->getValue()); } } diff --git a/tests/Entity/CustomerCommentTest.php b/tests/Entity/CustomerCommentTest.php index cd087a29..fd56a574 100644 --- a/tests/Entity/CustomerCommentTest.php +++ b/tests/Entity/CustomerCommentTest.php @@ -16,7 +16,7 @@ use App\Entity\CustomerComment; * @covers \App\Entity\CustomerComment * @covers \App\Entity\CommentTableTypeTrait */ -class CustomerCommentTest extends AbstractCommentEntityTest +class CustomerCommentTest extends AbstractCommentEntityTestCase { protected function getEntity(): CustomerComment { diff --git a/tests/Entity/CustomerMetaTest.php b/tests/Entity/CustomerMetaTest.php index 5e412606..51d61916 100644 --- a/tests/Entity/CustomerMetaTest.php +++ b/tests/Entity/CustomerMetaTest.php @@ -18,7 +18,7 @@ use App\Entity\MetaTableTypeInterface; /** * @covers \App\Entity\CustomerMeta */ -class CustomerMetaTest extends AbstractMetaEntityTest +class CustomerMetaTest extends AbstractMetaEntityTestCase { protected function getEntity(): EntityWithMetaFields { diff --git a/tests/Entity/CustomerTest.php b/tests/Entity/CustomerTest.php index bc25ad9d..0764bcfc 100644 --- a/tests/Entity/CustomerTest.php +++ b/tests/Entity/CustomerTest.php @@ -20,7 +20,7 @@ use Doctrine\Common\Collections\Collection; /** * @covers \App\Entity\Customer */ -class CustomerTest extends AbstractEntityTest +class CustomerTest extends AbstractEntityTestCase { public function testDefaultValues(): void { diff --git a/tests/Entity/EntityValidationTestTrait.php b/tests/Entity/EntityValidationTestTrait.php index e179adad..acc8f69a 100644 --- a/tests/Entity/EntityValidationTestTrait.php +++ b/tests/Entity/EntityValidationTestTrait.php @@ -49,11 +49,11 @@ trait EntityValidationTestTrait unset($violatedFields[$propertyPath]); } - $this->assertTrue($foundField, 'Failed finding violation for field: ' . $propertyPath); + self::assertTrue($foundField, 'Failed finding violation for field: ' . $propertyPath); } - $this->assertEmpty($violatedFields, \sprintf('Unexpected violations found: %s', implode(', ', $violatedFields))); - $this->assertEquals($expected, $countViolations, \sprintf('Expected %s violations, found %s in %s.', $expected, $actual, implode(', ', array_keys($violatedFields)))); + self::assertEmpty($violatedFields, \sprintf('Unexpected violations found: %s', implode(', ', $violatedFields))); + self::assertEquals($expected, $countViolations, \sprintf('Expected %s violations, found %s in %s.', $expected, $actual, implode(', ', array_keys($violatedFields)))); } public function assertHasNoViolations($entity, $groups = null): void @@ -65,6 +65,6 @@ trait EntityValidationTestTrait $violations = $validator->validate($entity, null, $groups); $actual = $violations->count(); - $this->assertEquals(0, $actual, \sprintf('Expected 0 violations, found %s.', $actual)); + self::assertEquals(0, $actual, \sprintf('Expected 0 violations, found %s.', $actual)); } } diff --git a/tests/Entity/InvoiceMetaTest.php b/tests/Entity/InvoiceMetaTest.php index c9c4f5c4..ef5aaabd 100644 --- a/tests/Entity/InvoiceMetaTest.php +++ b/tests/Entity/InvoiceMetaTest.php @@ -18,7 +18,7 @@ use App\Entity\MetaTableTypeInterface; /** * @covers \App\Entity\InvoiceMeta */ -class InvoiceMetaTest extends AbstractMetaEntityTest +class InvoiceMetaTest extends AbstractMetaEntityTestCase { protected function getEntity(): EntityWithMetaFields { diff --git a/tests/Entity/ProjectCommentTest.php b/tests/Entity/ProjectCommentTest.php index bc0acc46..18565db4 100644 --- a/tests/Entity/ProjectCommentTest.php +++ b/tests/Entity/ProjectCommentTest.php @@ -16,7 +16,7 @@ use App\Entity\ProjectComment; * @covers \App\Entity\ProjectComment * @covers \App\Entity\CommentTableTypeTrait */ -class ProjectCommentTest extends AbstractCommentEntityTest +class ProjectCommentTest extends AbstractCommentEntityTestCase { protected function getEntity(): ProjectComment { diff --git a/tests/Entity/ProjectMetaTest.php b/tests/Entity/ProjectMetaTest.php index 5a6c5ad5..27ee8709 100644 --- a/tests/Entity/ProjectMetaTest.php +++ b/tests/Entity/ProjectMetaTest.php @@ -18,7 +18,7 @@ use App\Entity\ProjectMeta; /** * @covers \App\Entity\ProjectMeta */ -class ProjectMetaTest extends AbstractMetaEntityTest +class ProjectMetaTest extends AbstractMetaEntityTestCase { protected function getEntity(): EntityWithMetaFields { diff --git a/tests/Entity/ProjectTest.php b/tests/Entity/ProjectTest.php index 17d66532..340a10cd 100644 --- a/tests/Entity/ProjectTest.php +++ b/tests/Entity/ProjectTest.php @@ -21,7 +21,7 @@ use Doctrine\Common\Collections\Collection; /** * @covers \App\Entity\Project */ -class ProjectTest extends AbstractEntityTest +class ProjectTest extends AbstractEntityTestCase { public function testDefaultValues(): void { diff --git a/tests/Entity/TagTest.php b/tests/Entity/TagTest.php index 1f139539..96a93407 100644 --- a/tests/Entity/TagTest.php +++ b/tests/Entity/TagTest.php @@ -20,26 +20,26 @@ class TagTest extends TestCase public function testDefaultValues(): void { $sut = new Tag(); - $this->assertNull($sut->getId()); - $this->assertNull($sut->getName()); - $this->assertNull($sut->getColor()); + self::assertNull($sut->getId()); + self::assertNull($sut->getName()); + self::assertNull($sut->getColor()); } public function testSetterAndGetter(): void { $sut = new Tag(); - $this->assertInstanceOf(Tag::class, $sut->setName('foo')); - $this->assertEquals('foo', $sut->getName()); - $this->assertEquals('foo', (string) $sut); + self::assertInstanceOf(Tag::class, $sut->setName('foo')); + self::assertEquals('foo', $sut->getName()); + self::assertEquals('foo', (string) $sut); $sut->setName(null); - $this->assertNull($sut->getName()); - $this->assertNull($sut->getColor()); - $this->assertIsString($sut->getColorSafe()); + self::assertNull($sut->getName()); + self::assertNull($sut->getColor()); + self::assertIsString($sut->getColorSafe()); $sut->setColor('#fffccc'); - $this->assertEquals('#fffccc', $sut->getColor()); - $this->assertEquals('#fffccc', $sut->getColorSafe()); + self::assertEquals('#fffccc', $sut->getColor()); + self::assertEquals('#fffccc', $sut->getColorSafe()); } } diff --git a/tests/Entity/TimesheetMetaTest.php b/tests/Entity/TimesheetMetaTest.php index f70125d1..f3c25c4a 100644 --- a/tests/Entity/TimesheetMetaTest.php +++ b/tests/Entity/TimesheetMetaTest.php @@ -18,7 +18,7 @@ use App\Entity\TimesheetMeta; /** * @covers \App\Entity\TimesheetMeta */ -class TimesheetMetaTest extends AbstractMetaEntityTest +class TimesheetMetaTest extends AbstractMetaEntityTestCase { protected function getEntity(): EntityWithMetaFields { diff --git a/tests/Entity/TimesheetTest.php b/tests/Entity/TimesheetTest.php index a2d4dc43..0f07a3d3 100644 --- a/tests/Entity/TimesheetTest.php +++ b/tests/Entity/TimesheetTest.php @@ -103,7 +103,7 @@ class TimesheetTest extends TestCase $tag1 = new Tag(); $tag1->setName('foo'); - $this->assertEmpty($sut->getTags()); + self::assertEmpty($sut->getTags()); $sut->addTag($tag); $sut->addTag($tag1); @@ -115,7 +115,7 @@ class TimesheetTest extends TestCase self::assertEquals([1 => 'foo'], $sut->getTagsAsArray()); $sut->removeTag($tag1); - $this->assertEmpty($sut->getTags()); + self::assertEmpty($sut->getTags()); } public function testMetaFields(): void diff --git a/tests/Entity/UserTest.php b/tests/Entity/UserTest.php index aa2aa1eb..2fe4ba61 100644 --- a/tests/Entity/UserTest.php +++ b/tests/Entity/UserTest.php @@ -33,7 +33,7 @@ class UserTest extends TestCase $user = new User(); self::assertInstanceOf(EquatableInterface::class, $user); self::assertInstanceOf(UserInterface::class, $user); - $this->assertInstanceOf(ArrayCollection::class, $user->getPreferences()); + self::assertInstanceOf(ArrayCollection::class, $user->getPreferences()); self::assertNull($user->getTitle()); self::assertNull($user->getAvatar()); self::assertNull($user->getAlias()); diff --git a/tests/Entity/UserValidationTest.php b/tests/Entity/UserValidationTest.php index b8d14e9f..e3ff81aa 100644 --- a/tests/Entity/UserValidationTest.php +++ b/tests/Entity/UserValidationTest.php @@ -20,7 +20,7 @@ class UserValidationTest extends KernelTestCase { use EntityValidationTestTrait; - public function getInvalidTestData() + public static function getInvalidTestData() { return [ ['', ''], @@ -69,7 +69,7 @@ class UserValidationTest extends KernelTestCase $this->assertHasNoViolations($user, ['RolesUpdate']); } - public function getValidTestData() + public static function getValidTestData() { return [ [str_pad('#', 8, '-'), 'test@x.x'], // shortest possible username diff --git a/tests/Event/AbstractActivityEventTest.php b/tests/Event/AbstractActivityEventTestCase.php similarity index 92% rename from tests/Event/AbstractActivityEventTest.php rename to tests/Event/AbstractActivityEventTestCase.php index 75a36925..5796cc71 100644 --- a/tests/Event/AbstractActivityEventTest.php +++ b/tests/Event/AbstractActivityEventTestCase.php @@ -14,7 +14,7 @@ use App\Event\AbstractActivityEvent; use PHPUnit\Framework\TestCase; use Symfony\Contracts\EventDispatcher\Event; -abstract class AbstractActivityEventTest extends TestCase +abstract class AbstractActivityEventTestCase extends TestCase { abstract protected function createActivityEvent(Activity $activity): AbstractActivityEvent; diff --git a/tests/Event/AbstractCustomerEventTest.php b/tests/Event/AbstractCustomerEventTestCase.php similarity index 92% rename from tests/Event/AbstractCustomerEventTest.php rename to tests/Event/AbstractCustomerEventTestCase.php index e025360c..ce599dba 100644 --- a/tests/Event/AbstractCustomerEventTest.php +++ b/tests/Event/AbstractCustomerEventTestCase.php @@ -14,7 +14,7 @@ use App\Event\AbstractCustomerEvent; use PHPUnit\Framework\TestCase; use Symfony\Contracts\EventDispatcher\Event; -abstract class AbstractCustomerEventTest extends TestCase +abstract class AbstractCustomerEventTestCase extends TestCase { abstract protected function createCustomerEvent(Customer $customer): AbstractCustomerEvent; diff --git a/tests/Event/AbstractProjectEventTest.php b/tests/Event/AbstractProjectEventTestCase.php similarity index 92% rename from tests/Event/AbstractProjectEventTest.php rename to tests/Event/AbstractProjectEventTestCase.php index 64bac9f4..e1e8956e 100644 --- a/tests/Event/AbstractProjectEventTest.php +++ b/tests/Event/AbstractProjectEventTestCase.php @@ -14,7 +14,7 @@ use App\Event\AbstractProjectEvent; use PHPUnit\Framework\TestCase; use Symfony\Contracts\EventDispatcher\Event; -abstract class AbstractProjectEventTest extends TestCase +abstract class AbstractProjectEventTestCase extends TestCase { abstract protected function createProjectEvent(Project $project): AbstractProjectEvent; diff --git a/tests/Event/AbstractTimesheetEventTest.php b/tests/Event/AbstractTimesheetEventTestCase.php similarity index 92% rename from tests/Event/AbstractTimesheetEventTest.php rename to tests/Event/AbstractTimesheetEventTestCase.php index 9f56d9cc..12caee70 100644 --- a/tests/Event/AbstractTimesheetEventTest.php +++ b/tests/Event/AbstractTimesheetEventTestCase.php @@ -14,7 +14,7 @@ use App\Event\AbstractTimesheetEvent; use PHPUnit\Framework\TestCase; use Symfony\Contracts\EventDispatcher\Event; -abstract class AbstractTimesheetEventTest extends TestCase +abstract class AbstractTimesheetEventTestCase extends TestCase { abstract protected function createTimesheetEvent(Timesheet $timesheet): AbstractTimesheetEvent; diff --git a/tests/Event/AbstractTimesheetMultipleEventTest.php b/tests/Event/AbstractTimesheetMultipleEventTestCase.php similarity index 91% rename from tests/Event/AbstractTimesheetMultipleEventTest.php rename to tests/Event/AbstractTimesheetMultipleEventTestCase.php index c4c3b572..ae55ccf2 100644 --- a/tests/Event/AbstractTimesheetMultipleEventTest.php +++ b/tests/Event/AbstractTimesheetMultipleEventTestCase.php @@ -14,7 +14,7 @@ use App\Event\AbstractTimesheetMultipleEvent; use PHPUnit\Framework\TestCase; use Symfony\Contracts\EventDispatcher\Event; -abstract class AbstractTimesheetMultipleEventTest extends TestCase +abstract class AbstractTimesheetMultipleEventTestCase extends TestCase { abstract protected function createTimesheetMultipleEvent(array $timesheets): AbstractTimesheetMultipleEvent; diff --git a/tests/Event/ActivityCreateEventTest.php b/tests/Event/ActivityCreateEventTest.php index 3d712928..555a4e56 100644 --- a/tests/Event/ActivityCreateEventTest.php +++ b/tests/Event/ActivityCreateEventTest.php @@ -17,7 +17,7 @@ use App\Event\ActivityCreateEvent; * @covers \App\Event\AbstractActivityEvent * @covers \App\Event\ActivityCreateEvent */ -class ActivityCreateEventTest extends AbstractActivityEventTest +class ActivityCreateEventTest extends AbstractActivityEventTestCase { protected function createActivityEvent(Activity $activity): AbstractActivityEvent { diff --git a/tests/Event/ActivityCreatePostEventTest.php b/tests/Event/ActivityCreatePostEventTest.php index 5edf9df6..63a751f0 100644 --- a/tests/Event/ActivityCreatePostEventTest.php +++ b/tests/Event/ActivityCreatePostEventTest.php @@ -17,7 +17,7 @@ use App\Event\ActivityCreatePostEvent; * @covers \App\Event\AbstractActivityEvent * @covers \App\Event\ActivityCreatePostEvent */ -class ActivityCreatePostEventTest extends AbstractActivityEventTest +class ActivityCreatePostEventTest extends AbstractActivityEventTestCase { protected function createActivityEvent(Activity $activity): AbstractActivityEvent { diff --git a/tests/Event/ActivityCreatePreEventTest.php b/tests/Event/ActivityCreatePreEventTest.php index b92bbbc0..4271ef1c 100644 --- a/tests/Event/ActivityCreatePreEventTest.php +++ b/tests/Event/ActivityCreatePreEventTest.php @@ -17,7 +17,7 @@ use App\Event\ActivityCreatePreEvent; * @covers \App\Event\AbstractActivityEvent * @covers \App\Event\ActivityCreatePreEvent */ -class ActivityCreatePreEventTest extends AbstractActivityEventTest +class ActivityCreatePreEventTest extends AbstractActivityEventTestCase { protected function createActivityEvent(Activity $activity): AbstractActivityEvent { diff --git a/tests/Event/ActivityDetailControllerEventTest.php b/tests/Event/ActivityDetailControllerEventTest.php index 8f6770b7..96b61096 100644 --- a/tests/Event/ActivityDetailControllerEventTest.php +++ b/tests/Event/ActivityDetailControllerEventTest.php @@ -17,7 +17,7 @@ use App\Event\ActivityDetailControllerEvent; * @covers \App\Event\AbstractActivityEvent * @covers \App\Event\ActivityDetailControllerEvent */ -class ActivityDetailControllerEventTest extends AbstractActivityEventTest +class ActivityDetailControllerEventTest extends AbstractActivityEventTestCase { protected function createActivityEvent(Activity $activity): AbstractActivityEvent { @@ -29,6 +29,6 @@ class ActivityDetailControllerEventTest extends AbstractActivityEventTest /** @var ActivityDetailControllerEvent $event */ $event = $this->createActivityEvent(new Activity()); $event->addController('Foo\\Bar::helloWorld'); - $this->assertEquals(['Foo\\Bar::helloWorld'], $event->getController()); + self::assertEquals(['Foo\\Bar::helloWorld'], $event->getController()); } } diff --git a/tests/Event/ActivityMetaDefinitionEventTest.php b/tests/Event/ActivityMetaDefinitionEventTest.php index cbc77a6a..204d7370 100644 --- a/tests/Event/ActivityMetaDefinitionEventTest.php +++ b/tests/Event/ActivityMetaDefinitionEventTest.php @@ -22,6 +22,6 @@ class ActivityMetaDefinitionEventTest extends TestCase { $activity = new Activity(); $sut = new ActivityMetaDefinitionEvent($activity); - $this->assertSame($activity, $sut->getEntity()); + self::assertSame($activity, $sut->getEntity()); } } diff --git a/tests/Event/ActivityStatisticEventTest.php b/tests/Event/ActivityStatisticEventTest.php index 2222b1ea..c4cafc79 100644 --- a/tests/Event/ActivityStatisticEventTest.php +++ b/tests/Event/ActivityStatisticEventTest.php @@ -18,7 +18,7 @@ use App\Model\ActivityStatistic; * @covers \App\Event\AbstractActivityEvent * @covers \App\Event\ActivityStatisticEvent */ -class ActivityStatisticEventTest extends AbstractActivityEventTest +class ActivityStatisticEventTest extends AbstractActivityEventTestCase { protected function createActivityEvent(Activity $activity): AbstractActivityEvent { diff --git a/tests/Event/ActivityUpdatePostEventTest.php b/tests/Event/ActivityUpdatePostEventTest.php index dc728e13..59cab996 100644 --- a/tests/Event/ActivityUpdatePostEventTest.php +++ b/tests/Event/ActivityUpdatePostEventTest.php @@ -17,7 +17,7 @@ use App\Event\ActivityUpdatePostEvent; * @covers \App\Event\AbstractActivityEvent * @covers \App\Event\ActivityUpdatePostEvent */ -class ActivityUpdatePostEventTest extends AbstractActivityEventTest +class ActivityUpdatePostEventTest extends AbstractActivityEventTestCase { protected function createActivityEvent(Activity $activity): AbstractActivityEvent { diff --git a/tests/Event/ActivityUpdatePreEventTest.php b/tests/Event/ActivityUpdatePreEventTest.php index e576d439..439c8312 100644 --- a/tests/Event/ActivityUpdatePreEventTest.php +++ b/tests/Event/ActivityUpdatePreEventTest.php @@ -17,7 +17,7 @@ use App\Event\ActivityUpdatePreEvent; * @covers \App\Event\AbstractActivityEvent * @covers \App\Event\ActivityUpdatePreEvent */ -class ActivityUpdatePreEventTest extends AbstractActivityEventTest +class ActivityUpdatePreEventTest extends AbstractActivityEventTestCase { protected function createActivityEvent(Activity $activity): AbstractActivityEvent { diff --git a/tests/Event/CustomerCreateEventTest.php b/tests/Event/CustomerCreateEventTest.php index ca704224..a5ea5e8d 100644 --- a/tests/Event/CustomerCreateEventTest.php +++ b/tests/Event/CustomerCreateEventTest.php @@ -17,7 +17,7 @@ use App\Event\CustomerCreateEvent; * @covers \App\Event\AbstractCustomerEvent * @covers \App\Event\CustomerCreateEvent */ -class CustomerCreateEventTest extends AbstractCustomerEventTest +class CustomerCreateEventTest extends AbstractCustomerEventTestCase { protected function createCustomerEvent(Customer $customer): AbstractCustomerEvent { diff --git a/tests/Event/CustomerCreatePostEventTest.php b/tests/Event/CustomerCreatePostEventTest.php index b454c50f..7b4c0159 100644 --- a/tests/Event/CustomerCreatePostEventTest.php +++ b/tests/Event/CustomerCreatePostEventTest.php @@ -17,7 +17,7 @@ use App\Event\CustomerCreatePostEvent; * @covers \App\Event\AbstractCustomerEvent * @covers \App\Event\CustomerCreatePostEvent */ -class CustomerCreatePostEventTest extends AbstractCustomerEventTest +class CustomerCreatePostEventTest extends AbstractCustomerEventTestCase { protected function createCustomerEvent(Customer $customer): AbstractCustomerEvent { diff --git a/tests/Event/CustomerCreatePreEventTest.php b/tests/Event/CustomerCreatePreEventTest.php index d50726ed..99e60af8 100644 --- a/tests/Event/CustomerCreatePreEventTest.php +++ b/tests/Event/CustomerCreatePreEventTest.php @@ -17,7 +17,7 @@ use App\Event\CustomerCreatePreEvent; * @covers \App\Event\AbstractCustomerEvent * @covers \App\Event\CustomerCreatePreEvent */ -class CustomerCreatePreEventTest extends AbstractCustomerEventTest +class CustomerCreatePreEventTest extends AbstractCustomerEventTestCase { protected function createCustomerEvent(Customer $customer): AbstractCustomerEvent { diff --git a/tests/Event/CustomerDetailControllerEventTest.php b/tests/Event/CustomerDetailControllerEventTest.php index 14b9bc96..a53f4f65 100644 --- a/tests/Event/CustomerDetailControllerEventTest.php +++ b/tests/Event/CustomerDetailControllerEventTest.php @@ -17,7 +17,7 @@ use App\Event\CustomerDetailControllerEvent; * @covers \App\Event\AbstractCustomerEvent * @covers \App\Event\CustomerDetailControllerEvent */ -class CustomerDetailControllerEventTest extends AbstractCustomerEventTest +class CustomerDetailControllerEventTest extends AbstractCustomerEventTestCase { protected function createCustomerEvent(Customer $customer): AbstractCustomerEvent { @@ -29,6 +29,6 @@ class CustomerDetailControllerEventTest extends AbstractCustomerEventTest /** @var CustomerDetailControllerEvent $event */ $event = $this->createCustomerEvent(new Customer('foo')); $event->addController('Foo\\Bar::helloWorld'); - $this->assertEquals(['Foo\\Bar::helloWorld'], $event->getController()); + self::assertEquals(['Foo\\Bar::helloWorld'], $event->getController()); } } diff --git a/tests/Event/CustomerMetaDefinitionEventTest.php b/tests/Event/CustomerMetaDefinitionEventTest.php index 07e961df..3df261c1 100644 --- a/tests/Event/CustomerMetaDefinitionEventTest.php +++ b/tests/Event/CustomerMetaDefinitionEventTest.php @@ -22,6 +22,6 @@ class CustomerMetaDefinitionEventTest extends TestCase { $customer = new Customer('foo'); $sut = new CustomerMetaDefinitionEvent($customer); - $this->assertSame($customer, $sut->getEntity()); + self::assertSame($customer, $sut->getEntity()); } } diff --git a/tests/Event/CustomerStatisticEventTest.php b/tests/Event/CustomerStatisticEventTest.php index 76dc778a..df16075d 100644 --- a/tests/Event/CustomerStatisticEventTest.php +++ b/tests/Event/CustomerStatisticEventTest.php @@ -18,7 +18,7 @@ use App\Model\CustomerStatistic; * @covers \App\Event\AbstractCustomerEvent * @covers \App\Event\CustomerStatisticEvent */ -class CustomerStatisticEventTest extends AbstractCustomerEventTest +class CustomerStatisticEventTest extends AbstractCustomerEventTestCase { protected function createCustomerEvent(Customer $customer): AbstractCustomerEvent { diff --git a/tests/Event/CustomerUpdatePostEventTest.php b/tests/Event/CustomerUpdatePostEventTest.php index b9490984..67b3db4b 100644 --- a/tests/Event/CustomerUpdatePostEventTest.php +++ b/tests/Event/CustomerUpdatePostEventTest.php @@ -17,7 +17,7 @@ use App\Event\CustomerUpdatePostEvent; * @covers \App\Event\AbstractCustomerEvent * @covers \App\Event\CustomerUpdatePostEvent */ -class CustomerUpdatePostEventTest extends AbstractCustomerEventTest +class CustomerUpdatePostEventTest extends AbstractCustomerEventTestCase { protected function createCustomerEvent(Customer $customer): AbstractCustomerEvent { diff --git a/tests/Event/CustomerUpdatePreEventTest.php b/tests/Event/CustomerUpdatePreEventTest.php index 7d7c1064..9c252fce 100644 --- a/tests/Event/CustomerUpdatePreEventTest.php +++ b/tests/Event/CustomerUpdatePreEventTest.php @@ -17,7 +17,7 @@ use App\Event\CustomerUpdatePreEvent; * @covers \App\Event\AbstractCustomerEvent * @covers \App\Event\CustomerUpdatePreEvent */ -class CustomerUpdatePreEventTest extends AbstractCustomerEventTest +class CustomerUpdatePreEventTest extends AbstractCustomerEventTestCase { protected function createCustomerEvent(Customer $customer): AbstractCustomerEvent { diff --git a/tests/Event/DashboardEventTest.php b/tests/Event/DashboardEventTest.php index 074932f3..81a9a04b 100644 --- a/tests/Event/DashboardEventTest.php +++ b/tests/Event/DashboardEventTest.php @@ -25,7 +25,7 @@ class DashboardEventTest extends TestCase $sut = new DashboardEvent($user); - $this->assertEquals($user, $sut->getUser()); + self::assertEquals($user, $sut->getUser()); $sut->addWidget('test'); $sut->addWidget('test2', 5); @@ -33,6 +33,6 @@ class DashboardEventTest extends TestCase $sut->addWidget('test4', 10); $sut->addWidget('test5', 5); - $this->assertSame([0 => 'test', 5 => 'test2', 6 => 'test5', 10 => 'test4', 45 => 'test3'], $sut->getWidgets()); + self::assertSame([0 => 'test', 5 => 'test2', 6 => 'test5', 10 => 'test4', 45 => 'test3'], $sut->getWidgets()); } } diff --git a/tests/Event/EmailEventTest.php b/tests/Event/EmailEventTest.php index 407ff8a4..76ade176 100644 --- a/tests/Event/EmailEventTest.php +++ b/tests/Event/EmailEventTest.php @@ -25,6 +25,6 @@ class EmailEventTest extends TestCase $sut = new EmailEvent($email); - $this->assertEquals($email, $sut->getEmail()); + self::assertEquals($email, $sut->getEmail()); } } diff --git a/tests/Event/PageActionsEventTest.php b/tests/Event/PageActionsEventTest.php index 361e9c08..6acc9d3a 100644 --- a/tests/Event/PageActionsEventTest.php +++ b/tests/Event/PageActionsEventTest.php @@ -24,66 +24,66 @@ class PageActionsEventTest extends TestCase $user->setAlias('foo'); $sut = new PageActionsEvent($user, [], 'foo', 'bar'); - $this->assertEquals('bar', $sut->getView()); - $this->assertEquals('foo', $sut->getActionName()); - $this->assertEquals('actions.foo', $sut->getEventName()); - $this->assertTrue($sut->isView('bar')); - $this->assertFalse($sut->isView('foo')); - $this->assertFalse($sut->isIndexView()); - $this->assertSame($user, $sut->getUser()); - $this->assertEquals([], $sut->getActions()); - $this->assertEquals(['actions' => [], 'view' => 'bar'], $sut->getPayload()); - $this->assertNull($sut->getLocale()); + self::assertEquals('bar', $sut->getView()); + self::assertEquals('foo', $sut->getActionName()); + self::assertEquals('actions.foo', $sut->getEventName()); + self::assertTrue($sut->isView('bar')); + self::assertFalse($sut->isView('foo')); + self::assertFalse($sut->isIndexView()); + self::assertSame($user, $sut->getUser()); + self::assertEquals([], $sut->getActions()); + self::assertEquals(['actions' => [], 'view' => 'bar'], $sut->getPayload()); + self::assertNull($sut->getLocale()); $sut = new PageActionsEvent($user, ['hello' => 'world'], 'foo', 'bar'); - $this->assertSame($user, $sut->getUser()); - $this->assertEquals([], $sut->getActions()); - $this->assertEquals(['hello' => 'world', 'actions' => [], 'view' => 'bar'], $sut->getPayload()); + self::assertSame($user, $sut->getUser()); + self::assertEquals([], $sut->getActions()); + self::assertEquals(['hello' => 'world', 'actions' => [], 'view' => 'bar'], $sut->getPayload()); } public function testSetActions(): void { $sut = new PageActionsEvent(new User(), ['hello' => 'world'], 'foo', 'xxx'); $sut->addAction('foo', ['url' => 'bar']); - $this->assertEquals(['foo' => ['url' => 'bar']], $sut->getActions()); - $this->assertEquals(['hello' => 'world', 'actions' => ['foo' => ['url' => 'bar']], 'view' => 'xxx'], $sut->getPayload()); + self::assertEquals(['foo' => ['url' => 'bar']], $sut->getActions()); + self::assertEquals(['hello' => 'world', 'actions' => ['foo' => ['url' => 'bar']], 'view' => 'xxx'], $sut->getPayload()); - $this->assertEquals(1, $sut->countActions()); + self::assertEquals(1, $sut->countActions()); // make sure an action with tzhe same name cannot be added $sut->addAction('foo', ['url' => 'bar']); - $this->assertEquals(1, $sut->countActions()); + self::assertEquals(1, $sut->countActions()); - $this->assertEquals(0, $sut->countActions('foo')); - $this->assertTrue($sut->hasAction('foo')); - $this->assertFalse($sut->hasAction('sdsd')); + self::assertEquals(0, $sut->countActions('foo')); + self::assertTrue($sut->hasAction('foo')); + self::assertFalse($sut->hasAction('sdsd')); $sut->removeAction('xxx'); - $this->assertEquals(1, $sut->countActions()); + self::assertEquals(1, $sut->countActions()); $sut->removeAction('foo'); - $this->assertEquals(0, $sut->countActions()); + self::assertEquals(0, $sut->countActions()); $sut->addAction('foo', ['url' => 'bar']); - $this->assertEquals(['foo' => ['url' => 'bar']], $sut->getActions()); + self::assertEquals(['foo' => ['url' => 'bar']], $sut->getActions()); $sut->replaceAction('foo', ['url' => 'xyz']); - $this->assertEquals(['foo' => ['url' => 'xyz']], $sut->getActions()); + self::assertEquals(['foo' => ['url' => 'xyz']], $sut->getActions()); $sut->setLocale('de'); - $this->assertEquals('de', $sut->getLocale()); + self::assertEquals('de', $sut->getLocale()); $sut->setLocale(null); - $this->assertNull($sut->getLocale()); + self::assertNull($sut->getLocale()); } public function testSubmenu(): void { $sut = new PageActionsEvent(new User(), ['hello' => 'world'], 'foo', 'xxx'); - $this->assertFalse($sut->hasSubmenu('test')); + self::assertFalse($sut->hasSubmenu('test')); $sut->addActionToSubmenu('test', 'blub', ['url' => 'hello-world']); - $this->assertTrue($sut->hasSubmenu('test')); - $this->assertEquals(['test' => ['children' => ['blub' => ['url' => 'hello-world']]]], $sut->getActions()); + self::assertTrue($sut->hasSubmenu('test')); + self::assertEquals(['test' => ['children' => ['blub' => ['url' => 'hello-world']]]], $sut->getActions()); $sut->addActionToSubmenu('test', 'blub1', ['url' => 'hello-world']); - $this->assertEquals(2, $sut->countActions('test')); + self::assertEquals(2, $sut->countActions('test')); } public function testAddHelper(): void @@ -106,9 +106,9 @@ class PageActionsEventTest extends TestCase 'edit' => ['url' => 'trölölö', 'class' => 'modal-ajax-form', 'title' => 'edit'], 'trash' => ['url' => 'foo3', 'class' => 'modal-ajax-form text-red', 'title' => 'trash'], ]; - $this->assertEquals(\count($expected), $sut->countActions()); + self::assertEquals(\count($expected), $sut->countActions()); - $this->assertEquals($expected, $sut->getActions()); + self::assertEquals($expected, $sut->getActions()); } public function testAddOthers(): void @@ -117,13 +117,13 @@ class PageActionsEventTest extends TestCase // make sure that modal always start with #, no matter what was given $sut->addColumnToggle('#fooX'); - $this->assertEquals(['columns' => ['modal' => '#fooX', 'title' => 'modal.columns.title']], $sut->getActions()); + self::assertEquals(['columns' => ['modal' => '#fooX', 'title' => 'modal.columns.title']], $sut->getActions()); // make sure that a second toggle cannot be added $sut->addColumnToggle('fooY'); - $this->assertEquals(['columns' => ['modal' => '#fooX', 'title' => 'modal.columns.title']], $sut->getActions()); + self::assertEquals(['columns' => ['modal' => '#fooX', 'title' => 'modal.columns.title']], $sut->getActions()); $sut->removeAction('columns'); $sut->addColumnToggle('fooY'); - $this->assertEquals(['columns' => ['modal' => '#fooY', 'title' => 'modal.columns.title']], $sut->getActions()); + self::assertEquals(['columns' => ['modal' => '#fooY', 'title' => 'modal.columns.title']], $sut->getActions()); } } diff --git a/tests/Event/PrepareUserEventTest.php b/tests/Event/PrepareUserEventTest.php index f09abb80..008223de 100644 --- a/tests/Event/PrepareUserEventTest.php +++ b/tests/Event/PrepareUserEventTest.php @@ -22,11 +22,11 @@ class PrepareUserEventTest extends TestCase { $user = new User(); $sut = new PrepareUserEvent($user); - $this->assertSame($user, $sut->getUser()); - $this->assertTrue($sut->isBooting()); + self::assertSame($user, $sut->getUser()); + self::assertTrue($sut->isBooting()); $sut = new PrepareUserEvent($user, false); - $this->assertSame($user, $sut->getUser()); - $this->assertFalse($sut->isBooting()); + self::assertSame($user, $sut->getUser()); + self::assertFalse($sut->isBooting()); } } diff --git a/tests/Event/ProjectCreateEventTest.php b/tests/Event/ProjectCreateEventTest.php index 3b5b07b2..7dd282a0 100644 --- a/tests/Event/ProjectCreateEventTest.php +++ b/tests/Event/ProjectCreateEventTest.php @@ -17,7 +17,7 @@ use App\Event\ProjectCreateEvent; * @covers \App\Event\AbstractProjectEvent * @covers \App\Event\ProjectCreateEvent */ -class ProjectCreateEventTest extends AbstractProjectEventTest +class ProjectCreateEventTest extends AbstractProjectEventTestCase { protected function createProjectEvent(Project $project): AbstractProjectEvent { diff --git a/tests/Event/ProjectCreatePostEventTest.php b/tests/Event/ProjectCreatePostEventTest.php index 315b749e..de432a7f 100644 --- a/tests/Event/ProjectCreatePostEventTest.php +++ b/tests/Event/ProjectCreatePostEventTest.php @@ -17,7 +17,7 @@ use App\Event\ProjectCreatePostEvent; * @covers \App\Event\AbstractProjectEvent * @covers \App\Event\ProjectCreatePostEvent */ -class ProjectCreatePostEventTest extends AbstractProjectEventTest +class ProjectCreatePostEventTest extends AbstractProjectEventTestCase { protected function createProjectEvent(Project $project): AbstractProjectEvent { diff --git a/tests/Event/ProjectCreatePreEventTest.php b/tests/Event/ProjectCreatePreEventTest.php index 22ea7869..2be0a299 100644 --- a/tests/Event/ProjectCreatePreEventTest.php +++ b/tests/Event/ProjectCreatePreEventTest.php @@ -17,7 +17,7 @@ use App\Event\ProjectCreatePreEvent; * @covers \App\Event\AbstractProjectEvent * @covers \App\Event\ProjectCreatePreEvent */ -class ProjectCreatePreEventTest extends AbstractProjectEventTest +class ProjectCreatePreEventTest extends AbstractProjectEventTestCase { protected function createProjectEvent(Project $project): AbstractProjectEvent { diff --git a/tests/Event/ProjectDetailControllerEventTest.php b/tests/Event/ProjectDetailControllerEventTest.php index dcab2812..aae60665 100644 --- a/tests/Event/ProjectDetailControllerEventTest.php +++ b/tests/Event/ProjectDetailControllerEventTest.php @@ -17,7 +17,7 @@ use App\Event\ProjectDetailControllerEvent; * @covers \App\Event\AbstractProjectEvent * @covers \App\Event\ProjectDetailControllerEvent */ -class ProjectDetailControllerEventTest extends AbstractProjectEventTest +class ProjectDetailControllerEventTest extends AbstractProjectEventTestCase { protected function createProjectEvent(Project $project): AbstractProjectEvent { @@ -29,6 +29,6 @@ class ProjectDetailControllerEventTest extends AbstractProjectEventTest /** @var ProjectDetailControllerEvent $event */ $event = $this->createProjectEvent(new Project()); $event->addController('Foo\\Bar::helloWorld'); - $this->assertEquals(['Foo\\Bar::helloWorld'], $event->getController()); + self::assertEquals(['Foo\\Bar::helloWorld'], $event->getController()); } } diff --git a/tests/Event/ProjectMetaDefinitionEventTest.php b/tests/Event/ProjectMetaDefinitionEventTest.php index 6f173497..96a13e17 100644 --- a/tests/Event/ProjectMetaDefinitionEventTest.php +++ b/tests/Event/ProjectMetaDefinitionEventTest.php @@ -22,6 +22,6 @@ class ProjectMetaDefinitionEventTest extends TestCase { $project = new Project(); $sut = new ProjectMetaDefinitionEvent($project); - $this->assertSame($project, $sut->getEntity()); + self::assertSame($project, $sut->getEntity()); } } diff --git a/tests/Event/ProjectStatisticEventTest.php b/tests/Event/ProjectStatisticEventTest.php index b22d4e66..88ccdc2c 100644 --- a/tests/Event/ProjectStatisticEventTest.php +++ b/tests/Event/ProjectStatisticEventTest.php @@ -18,7 +18,7 @@ use App\Model\ProjectStatistic; * @covers \App\Event\AbstractProjectEvent * @covers \App\Event\ProjectStatisticEvent */ -class ProjectStatisticEventTest extends AbstractProjectEventTest +class ProjectStatisticEventTest extends AbstractProjectEventTestCase { protected function createProjectEvent(Project $project): AbstractProjectEvent { diff --git a/tests/Event/ProjectUpdatePostEventTest.php b/tests/Event/ProjectUpdatePostEventTest.php index 82e9aa95..439f3e2d 100644 --- a/tests/Event/ProjectUpdatePostEventTest.php +++ b/tests/Event/ProjectUpdatePostEventTest.php @@ -17,7 +17,7 @@ use App\Event\ProjectUpdatePostEvent; * @covers \App\Event\AbstractProjectEvent * @covers \App\Event\ProjectUpdatePostEvent */ -class ProjectUpdatePostEventTest extends AbstractProjectEventTest +class ProjectUpdatePostEventTest extends AbstractProjectEventTestCase { protected function createProjectEvent(Project $project): AbstractProjectEvent { diff --git a/tests/Event/ProjectUpdatePreEventTest.php b/tests/Event/ProjectUpdatePreEventTest.php index 5d7d40fb..02d33a6a 100644 --- a/tests/Event/ProjectUpdatePreEventTest.php +++ b/tests/Event/ProjectUpdatePreEventTest.php @@ -17,7 +17,7 @@ use App\Event\ProjectUpdatePreEvent; * @covers \App\Event\AbstractProjectEvent * @covers \App\Event\ProjectUpdatePreEvent */ -class ProjectUpdatePreEventTest extends AbstractProjectEventTest +class ProjectUpdatePreEventTest extends AbstractProjectEventTestCase { protected function createProjectEvent(Project $project): AbstractProjectEvent { diff --git a/tests/Event/ThemeEventTest.php b/tests/Event/ThemeEventTest.php index 7cfaca3a..568c1962 100644 --- a/tests/Event/ThemeEventTest.php +++ b/tests/Event/ThemeEventTest.php @@ -21,9 +21,9 @@ class ThemeEventTest extends TestCase public function testEmpty(): void { $sut = new ThemeEvent(); - $this->assertNull($sut->getUser()); - $this->assertIsArray($sut->getPayload()); - $this->assertEquals('', $sut->getContent()); + self::assertNull($sut->getUser()); + self::assertIsArray($sut->getPayload()); + self::assertEquals('', $sut->getContent()); } public function testDefaultValues(): void @@ -33,7 +33,7 @@ class ThemeEventTest extends TestCase $sut = new ThemeEvent($user); - $this->assertSame($user, $sut->getUser()); + self::assertSame($user, $sut->getUser()); } public function testGetterAndSetter(): void @@ -44,14 +44,14 @@ class ThemeEventTest extends TestCase $payload = ['foo' => null, '' => '', 'test' => 'test', 'class' => new \stdClass()]; $sut = new ThemeEvent($user, $payload); - $this->assertEquals($payload, $sut->getPayload()); + self::assertEquals($payload, $sut->getPayload()); $sut = new ThemeEvent($user); $sut->addContent('foo'); - $this->assertEquals('foo', $sut->getContent()); + self::assertEquals('foo', $sut->getContent()); $sut->addContent('