From e73b6030aeb69d50117f8b10afceb928a5439329 Mon Sep 17 00:00:00 2001 From: DumbergerL Date: Tue, 20 Jun 2023 09:20:20 +0200 Subject: [PATCH] refactor(namespace): reorganize imports and make psr-4 conform --- composer.json | 12 ++++++++---- docs/Docs.md | 2 +- docs/out/AbsenceAPI.md | 4 ++++ docs/out/CTConfig.md | 1 + docs/out/CalendarAPI.md | 3 +++ docs/out/DBFields.md | 17 +++++++++++++---- docs/out/EventAPI.md | 3 +++ docs/out/FileAPI.md | 7 +++++++ docs/out/GroupAPI.md | 7 ++++++- docs/out/Models.md | 2 ++ docs/out/PermissionAPI.md | 3 +++ docs/out/PersonAPI.md | 9 +++++++++ docs/out/PublicGroupAPI.md | 2 ++ docs/out/Requests.md | 2 ++ docs/out/ResourceAPI.md | 3 +++ docs/out/SearchAPI.md | 2 ++ docs/out/ServiceAPI.md | 1 + docs/out/SongAPI.md | 8 ++++++++ docs/out/WikiAPI.md | 1 + docs/src/DocGenerator.php | 2 +- docs/src/ressources/AbsenceAPI.md | 8 ++++---- docs/src/ressources/CTConfig.md | 2 +- docs/src/ressources/CalendarAPI.md | 6 +++--- docs/src/ressources/DBFields.md | 8 ++++---- docs/src/ressources/EventAPI.md | 6 +++--- docs/src/ressources/FileAPI.md | 14 +++++++------- docs/src/ressources/GroupAPI.md | 10 +++++----- docs/src/ressources/Models.md | 14 +++++++------- docs/src/ressources/PermissionAPI.md | 6 +++--- docs/src/ressources/PersonAPI.md | 18 +++++++++--------- docs/src/ressources/PublicGroupAPI.md | 4 ++-- docs/src/ressources/Requests.md | 4 ++-- docs/src/ressources/ResourceAPI.md | 6 +++--- docs/src/ressources/SearchAPI.md | 4 ++-- docs/src/ressources/ServiceAPI.md | 2 +- docs/src/ressources/SongAPI.md | 16 ++++++++-------- docs/src/ressources/WikiAPI.md | 2 +- src/Models/DBField.php | 2 +- src/Models/DBFieldCategory.php | 2 +- src/Models/DBFieldContainer.php | 2 +- src/Models/DBFieldType.php | 2 +- src/Models/DBFieldValueContainer.php | 2 +- src/Models/GroupInformation.php | 2 +- src/Models/GroupMemberField.php | 2 +- src/Models/GroupMemberFieldContainer.php | 2 +- src/Models/Person.php | 2 +- src/Models/Traits/FillWithData.php | 2 +- src/Models/Traits/HasDBFields.php | 4 ++-- src/Requests/DBFieldForKeysRequestBuilder.php | 6 +++--- src/Requests/DBFieldRequest.php | 4 ++-- src/Requests/GroupMemberFieldsRequest.php | 2 +- .../GroupMemberFieldsRequestBuilder.php | 4 ++-- .../CacheTest.php | 2 +- .../Config/AuthWithLoginTokenTest.php | 6 ++++-- .../Config/CTConfigIntegrationTest.php | 6 ++++-- .../Config/TwoFactorAuthenticationTest.php | 6 ++++-- .../Exceptions/AuthExceptionTest.php | 6 ++++-- .../Exceptions/ConfigExceptionTest.php | 1 + .../Exceptions/ConnectExceptionTest.php | 2 ++ .../Exceptions/ModelExceptionTest.php | 2 ++ .../Exceptions/RequestExceptionTest.php | 4 +++- .../IntegrationTestCase.php | 2 +- .../IntegrationTestData.php | 2 +- .../Models/FileTest.php | 4 ++-- .../Models/MetaTest.php | 8 +++++--- .../Requests/APIVersionTest.php | 6 ++++-- .../Requests/AbsenceRequestTest.php | 8 +++++--- .../Requests/AuthRequestTest.php | 4 ++-- .../Requests/BookingsRequestTest.php | 8 +++++--- .../Requests/CalendarRequestTest.php | 8 +++++--- .../Requests/CcliRequestTest.php | 4 ++-- .../Requests/DBFieldRequestTest.php | 14 ++++++++------ .../Requests/EventAgendaTest.php | 8 +++++--- .../Requests/EventRequestTest.php | 8 +++++--- .../Requests/FileRequestAvatarTest.php | 4 ++-- .../Requests/FileRequestMultipleFilesTest.php | 8 +++++--- .../Requests/GroupHierarchieRequestTest.php | 8 +++++--- .../Requests/GroupMeetingRequestTest.php | 8 +++++--- .../Requests/GroupMemberFieldsTest.php | 10 +++++----- .../Requests/GroupMemberRequestTest.php | 8 +++++--- .../Requests/GroupRequestTest.php | 8 +++++--- .../Requests/GroupUpdateRequestTest.php | 8 +++++--- .../Requests/PermissionRequestTest.php | 8 +++++--- .../Requests/PersonBirthdayRequestTest.php | 8 +++++--- .../Requests/PersonRequestTest.php | 8 +++++--- .../Requests/PersonTagRequestTest.php | 8 +++++--- .../Requests/PersonUpdateRequestTest.php | 4 ++-- .../Requests/PublicGroupRequestTest.php | 8 +++++--- .../Requests/SearchRequestTest.php | 8 +++++--- .../Requests/ServiceRequestTest.php | 8 +++++--- .../SongArrangementUpdateRequestTest.php | 8 +++++--- .../Requests/SongRequestTest.php | 8 +++++--- .../Requests/SongStatisticRequestTest.php | 8 +++++--- .../Requests/SongUpdateRequestTest.php | 8 +++++--- .../Requests/WikiRequestTest.php | 8 +++++--- .../Requests/resources/avatar-1.png | Bin .../Requests/resources/fileA.txt | 0 .../Requests/resources/fileB.md | 0 .../TestCaseAuthenticated.php | 2 +- .../integration-test-data.json | 0 .../integration.example.ini | 0 tests/{unit => Unit}/CTConfigUnitTest.php | 2 +- .../Cache/CTCacheMiddlewareTest.php | 2 +- .../Cache/CacheProviderMock.php | 2 +- .../Docs/AbsenceRequestTest.php | 4 ++-- .../Docs/CSRFTokenRequestTest.php | 4 ++-- .../Docs/CalendarRequestTest.php | 4 ++-- tests/{unit => Unit}/Docs/CcliRequestTest.php | 4 ++-- .../Docs/DBFieldRequestTest.php | 8 +++++--- .../{unit => Unit}/Docs/EventRequestTest.php | 4 ++-- tests/{unit => Unit}/Docs/FileRequestTest.php | 4 ++-- .../Docs/GroupMeetingRequestTest.php | 4 ++-- .../Docs/GroupMemberFieldsTest.php | 6 +++--- .../Docs/GroupMemberUpdateRequestTest.php | 4 ++-- .../{unit => Unit}/Docs/GroupRequestTest.php | 4 ++-- tests/{unit => Unit}/Docs/ModelEventTest.php | 4 ++-- tests/{unit => Unit}/Docs/ModelTest.php | 2 +- tests/{unit => Unit}/Docs/PaginationTest.php | 4 ++-- .../Docs/PermissionRequestTest.php | 4 ++-- .../{unit => Unit}/Docs/PersonRequestTest.php | 4 ++-- .../Docs/PublicGroupRequestTest.php | 4 ++-- .../Docs/ResourceRequestTest.php | 4 ++-- .../{unit => Unit}/Docs/SearchRequestTest.php | 4 ++-- .../Docs/ServiceRequestTest.php | 4 ++-- tests/{unit => Unit}/Docs/SongRequestTest.php | 4 ++-- .../Docs/SongStatisticRequestTest.php | 4 ++-- tests/{unit => Unit}/Docs/WikiRequestTest.php | 4 ++-- .../{unit => Unit}/HttpMock/CTClientMock.php | 2 +- .../HttpMock/HttpMockDataResolver.php | 2 +- .../data/POST_api_files_avatar_22.json | 0 .../data/POST_api_persons_118_absences.json | 0 ...chservice_ajax_func=getcclichordsfile.json | 0 ...churchservice_ajax_func=getcclilyrics.json | 0 ...rchservice_ajax_func=getsongstatistic.json | 0 .../data/PUT_api_groups_21_members_221.json | 0 .../PUT_api_persons_118_absences_211.json | 0 .../HttpMock/data/api_bookings.json | 0 .../HttpMock/data/api_calendars.json | 0 .../data/api_calendars_appointments.json | 0 .../HttpMock/data/api_csrftoken.json | 0 .../HttpMock/data/api_dbfields.json | 0 .../HttpMock/data/api_dbfields_141.json | 0 .../HttpMock/data/api_events.json | 0 .../HttpMock/data/api_events_21.json | 0 .../HttpMock/data/api_events_21_agenda.json | 0 .../HttpMock/data/api_events_page_2.json | 0 .../HttpMock/data/api_events_page_3.json | 0 .../HttpMock/data/api_files_avatar_21.json | 0 .../HttpMock/data/api_files_avatar_22.json | 0 .../data/api_files_groupimage_21.json | 0 ...mepages_wryawbh318glhasgm27awb0c241aj.json | 0 .../HttpMock/data/api_groups_21.json | 0 .../HttpMock/data/api_groups_21_meetings.json | 0 .../api_groups_21_meetings_2652_members.json | 0 .../HttpMock/data/api_groups_21_members.json | 0 .../HttpMock/data/api_groups_9.json | 0 .../data/api_groups_9_memberfields.json | 0 .../HttpMock/data/api_login.json | 0 .../HttpMock/data/api_permissions_global.json | 0 .../api_permissions_internal_groups_21.json | 0 .../api_permissions_internal_persons_23.json | 0 .../HttpMock/data/api_persons.json | 0 .../data/api_persons_118_absences.json | 0 .../data/api_persons_118_absences_211.json | 0 .../HttpMock/data/api_persons_12.json | 0 .../HttpMock/data/api_persons_21.json | 0 .../data/api_persons_21_logintoken.json | 0 .../HttpMock/data/api_persons_21_tags.json | 0 .../HttpMock/data/api_persons_22.json | 0 .../HttpMock/data/api_persons_birthdays.json | 0 .../data/api_resource_masterdata.json | 0 .../HttpMock/data/api_search.json | 0 .../HttpMock/data/api_services_21.json | 0 .../HttpMock/data/api_songs_21.json | 0 .../HttpMock/data/api_whoami.json | 0 .../HttpMock/data/api_wiki_categories.json | 0 .../data/api_wiki_categories_21_pages.json | 0 .../Models/AbstractModelTest.php | 2 +- .../Models/DBFieldsTraitTest.php | 2 +- .../Models/FillWithDataTraitTest.php | 2 +- .../Models/FillWithDataTraitToData.php | 4 ++-- .../FillWithDataTraitTypeMissmatchTest.php | 2 +- .../Models/GroupInformationTest.php | 2 +- tests/{unit => Unit}/Models/PersonTest.php | 2 +- .../{unit => Unit}/Models/PublicGroupTest.php | 2 +- .../Models/SongArrangementTest.php | 2 +- .../Models/SongStatisticTest.php | 2 +- .../Models/Traits/ExtractDataTest.php | 2 +- tests/{unit => Unit}/Models/WikiTreeTest.php | 2 +- .../Requests/EventRequestUnitTest.php | 4 ++-- .../Requests/OrderByConditionTest.php | 2 +- .../Requests/PaginationTest.php | 6 +++--- .../PersonRequestBuilderCreateTest.php | 9 +++++---- .../PersonRequestBuilderDeleteTest.php | 4 ++-- .../PersonRequestBuilderUpdateTest.php | 4 ++-- .../Requests/SongStatisticRequestLazyTest.php | 6 +++--- .../Requests/WhereConditionTest.php | 2 +- tests/{unit => Unit}/TestCaseHttpMocked.php | 4 ++-- tests/{unit => Unit}/Utils/CTUtilTest.php | 2 +- 199 files changed, 429 insertions(+), 290 deletions(-) rename tests/{integration => Integration}/CacheTest.php (98%) rename tests/{integration => Integration}/Config/AuthWithLoginTokenTest.php (95%) rename tests/{integration => Integration}/Config/CTConfigIntegrationTest.php (93%) rename tests/{integration => Integration}/Config/TwoFactorAuthenticationTest.php (94%) rename tests/{integration => Integration}/Exceptions/AuthExceptionTest.php (74%) rename tests/{integration => Integration}/Exceptions/ConfigExceptionTest.php (93%) rename tests/{integration => Integration}/Exceptions/ConnectExceptionTest.php (91%) rename tests/{integration => Integration}/Exceptions/ModelExceptionTest.php (88%) rename tests/{integration => Integration}/Exceptions/RequestExceptionTest.php (75%) rename tests/{integration => Integration}/IntegrationTestCase.php (97%) rename tests/{integration => Integration}/IntegrationTestData.php (99%) rename tests/{integration => Integration}/Models/FileTest.php (97%) rename tests/{integration => Integration}/Models/MetaTest.php (93%) rename tests/{integration => Integration}/Requests/APIVersionTest.php (91%) rename tests/{integration => Integration}/Requests/AbsenceRequestTest.php (97%) rename tests/{integration => Integration}/Requests/AuthRequestTest.php (94%) rename tests/{integration => Integration}/Requests/BookingsRequestTest.php (97%) rename tests/{integration => Integration}/Requests/CalendarRequestTest.php (95%) rename tests/{integration => Integration}/Requests/CcliRequestTest.php (96%) rename tests/{integration => Integration}/Requests/DBFieldRequestTest.php (96%) rename tests/{integration => Integration}/Requests/EventAgendaTest.php (96%) rename tests/{integration => Integration}/Requests/EventRequestTest.php (97%) rename tests/{integration => Integration}/Requests/FileRequestAvatarTest.php (96%) rename tests/{integration => Integration}/Requests/FileRequestMultipleFilesTest.php (95%) rename tests/{integration => Integration}/Requests/GroupHierarchieRequestTest.php (93%) rename tests/{integration => Integration}/Requests/GroupMeetingRequestTest.php (95%) rename tests/{integration => Integration}/Requests/GroupMemberFieldsTest.php (94%) rename tests/{integration => Integration}/Requests/GroupMemberRequestTest.php (90%) rename tests/{integration => Integration}/Requests/GroupRequestTest.php (92%) rename tests/{integration => Integration}/Requests/GroupUpdateRequestTest.php (96%) rename tests/{integration => Integration}/Requests/PermissionRequestTest.php (96%) rename tests/{integration => Integration}/Requests/PersonBirthdayRequestTest.php (92%) rename tests/{integration => Integration}/Requests/PersonRequestTest.php (96%) rename tests/{integration => Integration}/Requests/PersonTagRequestTest.php (87%) rename tests/{integration => Integration}/Requests/PersonUpdateRequestTest.php (93%) rename tests/{integration => Integration}/Requests/PublicGroupRequestTest.php (94%) rename tests/{integration => Integration}/Requests/SearchRequestTest.php (93%) rename tests/{integration => Integration}/Requests/ServiceRequestTest.php (96%) rename tests/{integration => Integration}/Requests/SongArrangementUpdateRequestTest.php (95%) rename tests/{integration => Integration}/Requests/SongRequestTest.php (96%) rename tests/{integration => Integration}/Requests/SongStatisticRequestTest.php (95%) rename tests/{integration => Integration}/Requests/SongUpdateRequestTest.php (95%) rename tests/{integration => Integration}/Requests/WikiRequestTest.php (98%) rename tests/{integration => Integration}/Requests/resources/avatar-1.png (100%) rename tests/{integration => Integration}/Requests/resources/fileA.txt (100%) rename tests/{integration => Integration}/Requests/resources/fileB.md (100%) rename tests/{integration => Integration}/TestCaseAuthenticated.php (97%) rename tests/{integration => Integration}/integration-test-data.json (100%) rename tests/{integration => Integration}/integration.example.ini (100%) rename tests/{unit => Unit}/CTConfigUnitTest.php (98%) rename tests/{unit => Unit}/Cache/CTCacheMiddlewareTest.php (99%) rename tests/{unit => Unit}/Cache/CacheProviderMock.php (96%) rename tests/{unit => Unit}/Docs/AbsenceRequestTest.php (97%) rename tests/{unit => Unit}/Docs/CSRFTokenRequestTest.php (85%) rename tests/{unit => Unit}/Docs/CalendarRequestTest.php (97%) rename tests/{unit => Unit}/Docs/CcliRequestTest.php (96%) rename tests/{unit => Unit}/Docs/DBFieldRequestTest.php (96%) rename tests/{unit => Unit}/Docs/EventRequestTest.php (98%) rename tests/{unit => Unit}/Docs/FileRequestTest.php (98%) rename tests/{unit => Unit}/Docs/GroupMeetingRequestTest.php (96%) rename tests/{unit => Unit}/Docs/GroupMemberFieldsTest.php (96%) rename tests/{unit => Unit}/Docs/GroupMemberUpdateRequestTest.php (92%) rename tests/{unit => Unit}/Docs/GroupRequestTest.php (98%) rename tests/{unit => Unit}/Docs/ModelEventTest.php (90%) rename tests/{unit => Unit}/Docs/ModelTest.php (98%) rename tests/{unit => Unit}/Docs/PaginationTest.php (93%) rename tests/{unit => Unit}/Docs/PermissionRequestTest.php (96%) rename tests/{unit => Unit}/Docs/PersonRequestTest.php (98%) rename tests/{unit => Unit}/Docs/PublicGroupRequestTest.php (97%) rename tests/{unit => Unit}/Docs/ResourceRequestTest.php (96%) rename tests/{unit => Unit}/Docs/SearchRequestTest.php (96%) rename tests/{unit => Unit}/Docs/ServiceRequestTest.php (96%) rename tests/{unit => Unit}/Docs/SongRequestTest.php (98%) rename tests/{unit => Unit}/Docs/SongStatisticRequestTest.php (96%) rename tests/{unit => Unit}/Docs/WikiRequestTest.php (97%) rename tests/{unit => Unit}/HttpMock/CTClientMock.php (99%) rename tests/{unit => Unit}/HttpMock/HttpMockDataResolver.php (98%) rename tests/{unit => Unit}/HttpMock/data/POST_api_files_avatar_22.json (100%) rename tests/{unit => Unit}/HttpMock/data/POST_api_persons_118_absences.json (100%) rename tests/{unit => Unit}/HttpMock/data/POST_index.php_q=churchservice_ajax_func=getcclichordsfile.json (100%) rename tests/{unit => Unit}/HttpMock/data/POST_index.php_q=churchservice_ajax_func=getcclilyrics.json (100%) rename tests/{unit => Unit}/HttpMock/data/POST_index.php_q=churchservice_ajax_func=getsongstatistic.json (100%) rename tests/{unit => Unit}/HttpMock/data/PUT_api_groups_21_members_221.json (100%) rename tests/{unit => Unit}/HttpMock/data/PUT_api_persons_118_absences_211.json (100%) rename tests/{unit => Unit}/HttpMock/data/api_bookings.json (100%) rename tests/{unit => Unit}/HttpMock/data/api_calendars.json (100%) rename tests/{unit => Unit}/HttpMock/data/api_calendars_appointments.json (100%) rename tests/{unit => Unit}/HttpMock/data/api_csrftoken.json (100%) rename tests/{unit => Unit}/HttpMock/data/api_dbfields.json (100%) rename tests/{unit => Unit}/HttpMock/data/api_dbfields_141.json (100%) rename tests/{unit => Unit}/HttpMock/data/api_events.json (100%) rename tests/{unit => Unit}/HttpMock/data/api_events_21.json (100%) rename tests/{unit => Unit}/HttpMock/data/api_events_21_agenda.json (100%) rename tests/{unit => Unit}/HttpMock/data/api_events_page_2.json (100%) rename tests/{unit => Unit}/HttpMock/data/api_events_page_3.json (100%) rename tests/{unit => Unit}/HttpMock/data/api_files_avatar_21.json (100%) rename tests/{unit => Unit}/HttpMock/data/api_files_avatar_22.json (100%) rename tests/{unit => Unit}/HttpMock/data/api_files_groupimage_21.json (100%) rename tests/{unit => Unit}/HttpMock/data/api_grouphomepages_wryawbh318glhasgm27awb0c241aj.json (100%) rename tests/{unit => Unit}/HttpMock/data/api_groups_21.json (100%) rename tests/{unit => Unit}/HttpMock/data/api_groups_21_meetings.json (100%) rename tests/{unit => Unit}/HttpMock/data/api_groups_21_meetings_2652_members.json (100%) rename tests/{unit => Unit}/HttpMock/data/api_groups_21_members.json (100%) rename tests/{unit => Unit}/HttpMock/data/api_groups_9.json (100%) rename tests/{unit => Unit}/HttpMock/data/api_groups_9_memberfields.json (100%) rename tests/{unit => Unit}/HttpMock/data/api_login.json (100%) rename tests/{unit => Unit}/HttpMock/data/api_permissions_global.json (100%) rename tests/{unit => Unit}/HttpMock/data/api_permissions_internal_groups_21.json (100%) rename tests/{unit => Unit}/HttpMock/data/api_permissions_internal_persons_23.json (100%) rename tests/{unit => Unit}/HttpMock/data/api_persons.json (100%) rename tests/{unit => Unit}/HttpMock/data/api_persons_118_absences.json (100%) rename tests/{unit => Unit}/HttpMock/data/api_persons_118_absences_211.json (100%) rename tests/{unit => Unit}/HttpMock/data/api_persons_12.json (100%) rename tests/{unit => Unit}/HttpMock/data/api_persons_21.json (100%) rename tests/{unit => Unit}/HttpMock/data/api_persons_21_logintoken.json (100%) rename tests/{unit => Unit}/HttpMock/data/api_persons_21_tags.json (100%) rename tests/{unit => Unit}/HttpMock/data/api_persons_22.json (100%) rename tests/{unit => Unit}/HttpMock/data/api_persons_birthdays.json (100%) rename tests/{unit => Unit}/HttpMock/data/api_resource_masterdata.json (100%) rename tests/{unit => Unit}/HttpMock/data/api_search.json (100%) rename tests/{unit => Unit}/HttpMock/data/api_services_21.json (100%) rename tests/{unit => Unit}/HttpMock/data/api_songs_21.json (100%) rename tests/{unit => Unit}/HttpMock/data/api_whoami.json (100%) rename tests/{unit => Unit}/HttpMock/data/api_wiki_categories.json (100%) rename tests/{unit => Unit}/HttpMock/data/api_wiki_categories_21_pages.json (100%) rename tests/{unit => Unit}/Models/AbstractModelTest.php (98%) rename tests/{unit => Unit}/Models/DBFieldsTraitTest.php (98%) rename tests/{unit => Unit}/Models/FillWithDataTraitTest.php (98%) rename tests/{unit => Unit}/Models/FillWithDataTraitToData.php (91%) rename tests/{unit => Unit}/Models/FillWithDataTraitTypeMissmatchTest.php (99%) rename tests/{unit => Unit}/Models/GroupInformationTest.php (97%) rename tests/{unit => Unit}/Models/PersonTest.php (98%) rename tests/{unit => Unit}/Models/PublicGroupTest.php (95%) rename tests/{unit => Unit}/Models/SongArrangementTest.php (98%) rename tests/{unit => Unit}/Models/SongStatisticTest.php (98%) rename tests/{unit => Unit}/Models/Traits/ExtractDataTest.php (96%) rename tests/{unit => Unit}/Models/WikiTreeTest.php (98%) rename tests/{unit => Unit}/Requests/EventRequestUnitTest.php (86%) rename tests/{unit => Unit}/Requests/OrderByConditionTest.php (99%) rename tests/{unit => Unit}/Requests/PaginationTest.php (91%) rename tests/{unit => Unit}/Requests/PersonRequestBuilderCreateTest.php (93%) rename tests/{unit => Unit}/Requests/PersonRequestBuilderDeleteTest.php (91%) rename tests/{unit => Unit}/Requests/PersonRequestBuilderUpdateTest.php (97%) rename tests/{unit => Unit}/Requests/SongStatisticRequestLazyTest.php (89%) rename tests/{unit => Unit}/Requests/WhereConditionTest.php (92%) rename tests/{unit => Unit}/TestCaseHttpMocked.php (94%) rename tests/{unit => Unit}/Utils/CTUtilTest.php (98%) diff --git a/composer.json b/composer.json index 8c7c87c3..21a9a6a2 100644 --- a/composer.json +++ b/composer.json @@ -3,10 +3,14 @@ "description": "API-client for churchtools", "type": "library", "autoload": { - "classmap": [ - "src/", - "tests/" - ] + "psr-4": { + "CTApi\\": "src" + } + }, + "autoload-dev": { + "psr-4": { + "CTApi\\Test\\": "tests" + } }, "require": { "guzzlehttp/guzzle": "^7", diff --git a/docs/Docs.md b/docs/Docs.md index 1453b2f4..4afc7f29 100644 --- a/docs/Docs.md +++ b/docs/Docs.md @@ -23,7 +23,7 @@ extends and improves the unit-test suite. The Github CI executes these unit-test code. To include a unit-test code-sample, use this template syntax: ``` -{{ \Tests\Unit\Docs\EventRequestTest.testEventRequestDocExample }} +{{ \CTApi\Test\Unit\Docs\EventRequestTest.testEventRequestDocExample }} ``` The Doc-Generator takes the unit-test code and transforms the assertEquals statements to more readable code. All diff --git a/docs/out/AbsenceAPI.md b/docs/out/AbsenceAPI.md index 5b7d5286..0dccb4dd 100644 --- a/docs/out/AbsenceAPI.md +++ b/docs/out/AbsenceAPI.md @@ -4,6 +4,7 @@ ```php use CTApi\Models\Absence; use CTApi\Requests\AbsenceRequest; + use CTApi\Test\Unit\TestCaseHttpMocked; $absences = AbsenceRequest::forPerson(118) ->where("from_date", "2022-01-01") @@ -47,6 +48,7 @@ ```php use CTApi\Models\Absence; use CTApi\Requests\AbsenceRequest; + use CTApi\Test\Unit\TestCaseHttpMocked; $absence = new Absence(); $absence->setStartDate("2020-09-13")->setEndDate("2020-09-14"); @@ -90,6 +92,7 @@ ```php use CTApi\Models\Absence; use CTApi\Requests\AbsenceRequest; + use CTApi\Test\Unit\TestCaseHttpMocked; $absence = AbsenceRequest::findOrFail(118, 211); // for person with id 118 and absence with id 211 @@ -111,6 +114,7 @@ ```php use CTApi\Models\Absence; use CTApi\Requests\AbsenceRequest; + use CTApi\Test\Unit\TestCaseHttpMocked; $absence = AbsenceRequest::findOrFail(118, 211); // for person with id 118 and absence with id 211 diff --git a/docs/out/CTConfig.md b/docs/out/CTConfig.md index 17763950..5c2e80c6 100644 --- a/docs/out/CTConfig.md +++ b/docs/out/CTConfig.md @@ -152,6 +152,7 @@ CTConfig::setPaginationPageSize(400); ```php use CTApi\Requests\CSRFTokenRequest; + use CTApi\Test\Unit\TestCaseHttpMocked; $nullableToken = CSRFTokenRequest::get(); // can be null|string $notNullToken = CSRFTokenRequest::getOrFail(); // throws exception if null diff --git a/docs/out/CalendarAPI.md b/docs/out/CalendarAPI.md index 8d81febd..648fdc1f 100644 --- a/docs/out/CalendarAPI.md +++ b/docs/out/CalendarAPI.md @@ -5,6 +5,7 @@ Load all calendars: ```php use CTApi\Requests\AppointmentRequest; use CTApi\Requests\CalendarRequest; + use CTApi\Test\Unit\TestCaseHttpMocked; $allCalendars = CalendarRequest::all(); $lastCalendar = end($allCalendars); @@ -38,6 +39,7 @@ Load appointments for calendar: ```php use CTApi\Requests\AppointmentRequest; use CTApi\Requests\CalendarRequest; + use CTApi\Test\Unit\TestCaseHttpMocked; $allCalendars = CalendarRequest::all(); $lastCalendar = end($allCalendars); @@ -124,6 +126,7 @@ Load appointments for multiple calendars: ```php use CTApi\Requests\AppointmentRequest; use CTApi\Requests\CalendarRequest; + use CTApi\Test\Unit\TestCaseHttpMocked; $appointments = AppointmentRequest::forCalendar(21)->get(); $appointments = AppointmentRequest::forCalendars([21, 22]) diff --git a/docs/out/DBFields.md b/docs/out/DBFields.md index 38e7f868..116e6341 100644 --- a/docs/out/DBFields.md +++ b/docs/out/DBFields.md @@ -3,9 +3,11 @@ ## Retrieve all DB-fields: ```php + use CTApi\CTConfig; use CTApi\Requests\GroupRequest; use CTApi\Requests\PersonRequest; - use Requests\DBFieldRequest; + use CTApi\Requests\DBFieldRequest; + use CTApi\Test\Unit\TestCaseHttpMocked; $dbFields = DBFieldRequest::all(); $dbField5pmName = $dbFields[0]; @@ -82,9 +84,11 @@ ## Retrieve single DB-field: ```php + use CTApi\CTConfig; use CTApi\Requests\GroupRequest; use CTApi\Requests\PersonRequest; - use Requests\DBFieldRequest; + use CTApi\Requests\DBFieldRequest; + use CTApi\Test\Unit\TestCaseHttpMocked; $dbField5pmName = DBFieldRequest::find(141); // or @@ -105,10 +109,13 @@ To access the custom DBFields, utilize the `getDBFieldData()` method. This will provide an array where the column name of the DBField serves as the key and holds the corresponding value. Alternatively, you can use the `requestDBFields()->get()` method to retrieve a list of DBFieldValueContainers. Each container includes the key, value, and additional details from the DBField model such as name, content-type, and other relevant information. Example for **GroupInformation**: ```php + use CTApi\CTConfig; use CTApi\Requests\GroupRequest; use CTApi\Requests\PersonRequest; - use Requests\DBFieldRequest; + use CTApi\Requests\DBFieldRequest; + use CTApi\Test\Unit\TestCaseHttpMocked; + CTConfig::enableDebugging(); $group = GroupRequest::findOrFail(9); $groupInformation = $group->getInformation(); @@ -158,9 +165,11 @@ To access the custom DBFields, utilize the `getDBFieldData()` method. This will DBFields are also existing for **Persons**: ```php + use CTApi\CTConfig; use CTApi\Requests\GroupRequest; use CTApi\Requests\PersonRequest; - use Requests\DBFieldRequest; + use CTApi\Requests\DBFieldRequest; + use CTApi\Test\Unit\TestCaseHttpMocked; $person = PersonRequest::findOrFail(12); $dbFieldContainerList = $person->requestDBFields()->get(); diff --git a/docs/out/EventAPI.md b/docs/out/EventAPI.md index a9a935a0..bfd5a635 100644 --- a/docs/out/EventAPI.md +++ b/docs/out/EventAPI.md @@ -4,6 +4,7 @@ ```php use CTApi\Requests\EventAgendaRequest; use CTApi\Requests\EventRequest; + use CTApi\Test\Unit\TestCaseHttpMocked; // Retrieve all events $allEvents = EventRequest::all(); @@ -67,6 +68,7 @@ ```php use CTApi\Requests\EventAgendaRequest; use CTApi\Requests\EventRequest; + use CTApi\Test\Unit\TestCaseHttpMocked; $event = EventRequest::find(21); @@ -113,6 +115,7 @@ ```php use CTApi\Requests\EventAgendaRequest; use CTApi\Requests\EventRequest; + use CTApi\Test\Unit\TestCaseHttpMocked; $event = EventRequest::find(21); $eventServices = $event?->getEventServices() ?? []; diff --git a/docs/out/FileAPI.md b/docs/out/FileAPI.md index 35340ae6..d6e0a437 100644 --- a/docs/out/FileAPI.md +++ b/docs/out/FileAPI.md @@ -7,6 +7,7 @@ The FileRequestBuilder can be accessed via the FileRequest-Facade: ```php use CTApi\Models\File; use CTApi\Requests\FileRequest; + use CTApi\Test\Unit\TestCaseHttpMocked; FileRequest::forAvatar(21); FileRequest::forGroupImage(21); @@ -26,6 +27,7 @@ Or you can call the builder direct in the model. E.q. in the events-model: ```php use CTApi\Models\File; use CTApi\Requests\FileRequest; + use CTApi\Test\Unit\TestCaseHttpMocked; $event = new \CTApi\Models\Event(); $event->requestFiles()?->get(); @@ -43,6 +45,7 @@ Returns an array with all available files. The Avatar-Route only contains one fi ```php use CTApi\Models\File; use CTApi\Requests\FileRequest; + use CTApi\Test\Unit\TestCaseHttpMocked; $files = FileRequest::forAvatar(21)->get(); $avatar = end($files); @@ -93,6 +96,7 @@ Deletes all files that are attached to the domain-model. ```php use CTApi\Models\File; use CTApi\Requests\FileRequest; + use CTApi\Test\Unit\TestCaseHttpMocked; FileRequest::forAvatar(23)->delete(); @@ -110,6 +114,7 @@ If you want to delete one specific file you can use the delete-method: ```php use CTApi\Models\File; use CTApi\Requests\FileRequest; + use CTApi\Test\Unit\TestCaseHttpMocked; $files = FileRequest::forEvent(21)->get(); @@ -126,6 +131,7 @@ If you want to delete one specific file you can use the delete-method: ```php use CTApi\Models\File; use CTApi\Requests\FileRequest; + use CTApi\Test\Unit\TestCaseHttpMocked; $files = FileRequest::forAvatar(22)->get(); $avatarFile = end($files); @@ -146,6 +152,7 @@ uploaded image. The Event-model e.q. also accepts multiple file-attachements. ```php use CTApi\Models\File; use CTApi\Requests\FileRequest; + use CTApi\Test\Unit\TestCaseHttpMocked; $newFile = (new FileRequestBuilder("avatar", 22))->upload(__DIR__ . "/../../integration/Requests/resources/avatar-1.png"); diff --git a/docs/out/GroupAPI.md b/docs/out/GroupAPI.md index caf9d1dc..fd0b2acf 100644 --- a/docs/out/GroupAPI.md +++ b/docs/out/GroupAPI.md @@ -5,6 +5,7 @@ ```php use CTApi\Requests\GroupRequest; use CTApi\Requests\PersonRequest; + use CTApi\Test\Unit\TestCaseHttpMocked; /** * Group-Request @@ -193,6 +194,7 @@ ```php use CTApi\Requests\GroupMemberRequest; + use CTApi\Test\Unit\TestCaseHttpMocked; $groupId = 21; $personId = 221; @@ -222,6 +224,7 @@ use CTApi\Models\Group; use CTApi\Requests\GroupMeetingRequest; use CTApi\Requests\GroupRequest; + use CTApi\Test\Unit\TestCaseHttpMocked; $meetings = $this->group->requestGroupMeetings() ?->where("start_date", "2022-11-01") @@ -275,6 +278,7 @@ use CTApi\Models\Group; use CTApi\Requests\GroupMeetingRequest; use CTApi\Requests\GroupRequest; + use CTApi\Test\Unit\TestCaseHttpMocked; $meetings = GroupMeetingRequest::forGroup(21)->get(); $meeting = $meetings[0]; @@ -297,7 +301,8 @@ ## GroupMemberFields ```php - use Requests\GroupMemberFieldsRequest; + use CTApi\Requests\GroupMemberFieldsRequest; + use CTApi\Test\Unit\TestCaseHttpMocked; $fields = GroupMemberFieldsRequest::forGroup(9)->get(); diff --git a/docs/out/Models.md b/docs/out/Models.md index 23df7cb2..29068dab 100644 --- a/docs/out/Models.md +++ b/docs/out/Models.md @@ -107,6 +107,7 @@ directly: ```php use CTApi\Models\Event; use CTApi\Models\EventAgenda; + use CTApi\Test\Unit\TestCaseHttpMocked; $event = Event::createModelFromData(['id' => 21]); $agenda = $event->requestAgenda(); @@ -125,6 +126,7 @@ the [Requests](Requests.md) methods and type: ```php use CTApi\Models\Event; use CTApi\Models\EventAgenda; + use CTApi\Test\Unit\TestCaseHttpMocked; $eventAgenda = EventAgenda::createModelFromData(['id' => 21]); diff --git a/docs/out/PermissionAPI.md b/docs/out/PermissionAPI.md index 424c052d..f8348706 100644 --- a/docs/out/PermissionAPI.md +++ b/docs/out/PermissionAPI.md @@ -4,6 +4,7 @@ ```php use CTApi\Requests\PermissionRequest; + use CTApi\Test\Unit\TestCaseHttpMocked; $internalGroupPermission = PermissionRequest::forGroup(21)->get(); @@ -24,6 +25,7 @@ ```php use CTApi\Requests\PermissionRequest; + use CTApi\Test\Unit\TestCaseHttpMocked; $internalPersonPermission = PermissionRequest::forPerson(23)->get(); @@ -49,6 +51,7 @@ ```php use CTApi\Requests\PermissionRequest; + use CTApi\Test\Unit\TestCaseHttpMocked; $globalPermission = PermissionRequest::myPermissions()->get(); diff --git a/docs/out/PersonAPI.md b/docs/out/PersonAPI.md index d99431e0..9d4e798d 100644 --- a/docs/out/PersonAPI.md +++ b/docs/out/PersonAPI.md @@ -3,6 +3,7 @@ ```php use CTApi\Models\Person; use CTApi\Requests\PersonRequest; + use CTApi\Test\Unit\TestCaseHttpMocked; // logged in user $myself = PersonRequest::whoami(); @@ -51,6 +52,7 @@ ```php use CTApi\Models\Person; use CTApi\Requests\PersonRequest; + use CTApi\Test\Unit\TestCaseHttpMocked; $person = (new Person())->setId("21"); @@ -95,6 +97,7 @@ ```php use CTApi\Models\Person; use CTApi\Requests\PersonRequest; + use CTApi\Test\Unit\TestCaseHttpMocked; $birthdayPersons = PersonRequest::birthdays() ->where("start_date", "2022-01-01") @@ -131,6 +134,7 @@ ```php use CTApi\Models\Person; use CTApi\Requests\PersonRequest; + use CTApi\Test\Unit\TestCaseHttpMocked; $newPerson = new Person(); $newPerson->setFirstName("John") @@ -151,6 +155,7 @@ Therefore you can add the `force` parameter and set it to `true`. ```php use CTApi\Models\Person; use CTApi\Requests\PersonRequest; + use CTApi\Test\Unit\TestCaseHttpMocked; $newPerson = new Person(); $newPerson->setFirstName("John") @@ -174,6 +179,7 @@ Follow this example: ```php use CTApi\Models\Person; use CTApi\Requests\PersonRequest; + use CTApi\Test\Unit\TestCaseHttpMocked; $person = PersonRequest::findOrFail(21); $person->setEmail('new-mail@example.com'); @@ -190,6 +196,7 @@ data sent to the API, by adding a whitelist of attributes. ```php use CTApi\Models\Person; use CTApi\Requests\PersonRequest; + use CTApi\Test\Unit\TestCaseHttpMocked; $person = PersonRequest::findOrFail(21); $person->setEmail('new-mail@example.com'); @@ -207,6 +214,7 @@ The following attributes can be updated: ```php use CTApi\Models\Person; use CTApi\Requests\PersonRequest; + use CTApi\Test\Unit\TestCaseHttpMocked; $person = PersonRequest::findOrFail(21); @@ -225,6 +233,7 @@ Delete person via PersonRequest: ```php use CTApi\Models\Person; use CTApi\Requests\PersonRequest; + use CTApi\Test\Unit\TestCaseHttpMocked; $person = PersonRequest::findOrFail(21); diff --git a/docs/out/PublicGroupAPI.md b/docs/out/PublicGroupAPI.md index c320db8e..eb2280a2 100644 --- a/docs/out/PublicGroupAPI.md +++ b/docs/out/PublicGroupAPI.md @@ -4,6 +4,7 @@ Load Data of Group Homepage with Hash-String. This route is public, so no authen ```php use CTApi\Requests\PublicGroupRequest; + use CTApi\Test\Unit\TestCaseHttpMocked; $groupHomepage = PublicGroupRequest::get("wryawBH318GLHasgm27awB0c241aj"); @@ -35,6 +36,7 @@ Further the PublicGroup-Model contains the following Methods: ```php use CTApi\Requests\PublicGroupRequest; + use CTApi\Test\Unit\TestCaseHttpMocked; $groupHomepage = PublicGroupRequest::get("wryawBH318GLHasgm27awB0c241aj"); $group = $groupHomepage->getGroups()[0]; diff --git a/docs/out/Requests.md b/docs/out/Requests.md index be928d3f..02280dd5 100644 --- a/docs/out/Requests.md +++ b/docs/out/Requests.md @@ -26,6 +26,7 @@ For example if you like to get only the first 3 events of ChurchTools: ```php use CTApi\Requests\EventRequest; + use CTApi\Test\Unit\TestCaseHttpMocked; $eventsPage1 = EventRequest::where("page", 1) ->where("limit", 3)->get(); @@ -50,6 +51,7 @@ Iterating over all records is quite easy. ```php use CTApi\Requests\EventRequest; + use CTApi\Test\Unit\TestCaseHttpMocked; $page = 1; $limit = 15; diff --git a/docs/out/ResourceAPI.md b/docs/out/ResourceAPI.md index bcaa5a1c..01d367a5 100644 --- a/docs/out/ResourceAPI.md +++ b/docs/out/ResourceAPI.md @@ -5,6 +5,7 @@ Load all Resources that are stored in ChurchTools. ```php use CTApi\Requests\ResourceBookingsRequest; use CTApi\Requests\ResourceRequest; + use CTApi\Test\Unit\TestCaseHttpMocked; $allResources = ResourceRequest::all(); $firstResource = $allResources[0]; @@ -26,6 +27,7 @@ Load bookings for specific resource: ```php use CTApi\Requests\ResourceBookingsRequest; use CTApi\Requests\ResourceRequest; + use CTApi\Test\Unit\TestCaseHttpMocked; $allResources = ResourceRequest::all(); $firstResource = $allResources[0]; @@ -69,6 +71,7 @@ Load bookings for multiple resoures: ```php use CTApi\Requests\ResourceBookingsRequest; use CTApi\Requests\ResourceRequest; + use CTApi\Test\Unit\TestCaseHttpMocked; $bookings = ResourceBookingsRequest::forResources([21, 22, 23]) ->where("from", "2021-02-22") diff --git a/docs/out/SearchAPI.md b/docs/out/SearchAPI.md index c88cb33f..0579016c 100644 --- a/docs/out/SearchAPI.md +++ b/docs/out/SearchAPI.md @@ -3,6 +3,7 @@ ## Search Global ```php use CTApi\Requests\SearchRequest; + use CTApi\Test\Unit\TestCaseHttpMocked; $results = SearchRequest::search("5pm")->get(); $firstResult = $results[0]; @@ -44,6 +45,7 @@ ```php use CTApi\Requests\SearchRequest; + use CTApi\Test\Unit\TestCaseHttpMocked; $results = SearchRequest::search("5pm") ->whereDomainType("wiki_page") diff --git a/docs/out/ServiceAPI.md b/docs/out/ServiceAPI.md index a7d8c2be..1ec97025 100644 --- a/docs/out/ServiceAPI.md +++ b/docs/out/ServiceAPI.md @@ -5,6 +5,7 @@ use CTApi\Models\ServiceGroup; use CTApi\Requests\ServiceGroupRequest; use CTApi\Requests\ServiceRequest; + use CTApi\Test\Unit\TestCaseHttpMocked; $serviceGroups = ServiceGroupRequest::all(); diff --git a/docs/out/SongAPI.md b/docs/out/SongAPI.md index bd5f1592..495ea259 100644 --- a/docs/out/SongAPI.md +++ b/docs/out/SongAPI.md @@ -8,6 +8,7 @@ use CTApi\Models\SongArrangement; use CTApi\Requests\SongArrangementRequest; use CTApi\Requests\SongRequest; + use CTApi\Test\Unit\TestCaseHttpMocked; $allSongs = SongRequest::all(); $practiceSong = SongRequest::where('practice', true)->orderBy('name')->get(); @@ -143,6 +144,7 @@ use CTApi\Models\SongArrangement; use CTApi\Requests\SongArrangementRequest; use CTApi\Requests\SongRequest; + use CTApi\Test\Unit\TestCaseHttpMocked; $song = SongRequest::findOrFail(21); @@ -166,6 +168,7 @@ use CTApi\Models\SongArrangement; use CTApi\Requests\SongArrangementRequest; use CTApi\Requests\SongRequest; + use CTApi\Test\Unit\TestCaseHttpMocked; $song = SongRequest::findOrFail(21); $arrangements = $song->getArrangements(); @@ -187,6 +190,7 @@ ```php use CTApi\Requests\CcliRequest; + use CTApi\Test\Unit\TestCaseHttpMocked; $ccliNumber = 1878670; @@ -244,6 +248,7 @@ The method returns a nullable [File-Model](/../../src/Models/File.php). ```php use CTApi\Requests\CcliRequest; + use CTApi\Test\Unit\TestCaseHttpMocked; $ccliNumber = 1878670; $songArrangementId = 2912; @@ -276,6 +281,7 @@ The method returns a nullable [File-Model](/../../src/Models/File.php). use CTApi\Requests\SongRequest; use CTApi\Requests\SongStatisticRequest; use CTApi\Requests\SongStatisticRequestBuilder; + use CTApi\Test\Unit\TestCaseHttpMocked; $data = SongStatisticRequest::all(); @@ -316,6 +322,7 @@ The method returns a nullable [File-Model](/../../src/Models/File.php). use CTApi\Requests\SongRequest; use CTApi\Requests\SongStatisticRequest; use CTApi\Requests\SongStatisticRequestBuilder; + use CTApi\Test\Unit\TestCaseHttpMocked; $statistics = SongStatisticRequest::findOrFail("21"); @@ -338,6 +345,7 @@ The method returns a nullable [File-Model](/../../src/Models/File.php). use CTApi\Requests\SongRequest; use CTApi\Requests\SongStatisticRequest; use CTApi\Requests\SongStatisticRequestBuilder; + use CTApi\Test\Unit\TestCaseHttpMocked; /** * Lazy-SongStatisticRequestBuilder diff --git a/docs/out/WikiAPI.md b/docs/out/WikiAPI.md index 06f0476e..8c3e33cc 100644 --- a/docs/out/WikiAPI.md +++ b/docs/out/WikiAPI.md @@ -3,6 +3,7 @@ ```php use CTApi\Requests\WikiCategoryRequest; use CTApi\Requests\WikiSearchRequest; + use CTApi\Test\Unit\TestCaseHttpMocked; /** * WikiCategory - Model diff --git a/docs/src/DocGenerator.php b/docs/src/DocGenerator.php index f23a95f9..5fafa718 100644 --- a/docs/src/DocGenerator.php +++ b/docs/src/DocGenerator.php @@ -4,7 +4,7 @@ use CTApi\CTConfig; use CTApi\Exceptions\CTAuthException; use CTApi\Exceptions\CTRequestException; -use Tests\Unit\HttpMock\CTClientMock; +use CTApi\Test\Unit\HttpMock\CTClientMock; require_once __DIR__ . "/../../vendor/autoload.php"; diff --git a/docs/src/ressources/AbsenceAPI.md b/docs/src/ressources/AbsenceAPI.md index 09e55b5b..370cef4f 100644 --- a/docs/src/ressources/AbsenceAPI.md +++ b/docs/src/ressources/AbsenceAPI.md @@ -1,16 +1,16 @@ # AbsenceAPI ## Absence-Request -{{ \Tests\Unit\Docs\AbsenceRequestTest.testRequestAllAbsences }} +{{ \CTApi\Test\Unit\Docs\AbsenceRequestTest.testRequestAllAbsences }} ## Create Absence -{{ \Tests\Unit\Docs\AbsenceRequestTest.testCreateAbsence }} +{{ \CTApi\Test\Unit\Docs\AbsenceRequestTest.testCreateAbsence }} ## Update Absence -{{ \Tests\Unit\Docs\AbsenceRequestTest.testUpdateAbsence }} +{{ \CTApi\Test\Unit\Docs\AbsenceRequestTest.testUpdateAbsence }} ## Delete Absence -{{ \Tests\Unit\Docs\AbsenceRequestTest.testDeleteAbsence }} \ No newline at end of file +{{ \CTApi\Test\Unit\Docs\AbsenceRequestTest.testDeleteAbsence }} \ No newline at end of file diff --git a/docs/src/ressources/CTConfig.md b/docs/src/ressources/CTConfig.md index e064f245..802ae547 100644 --- a/docs/src/ressources/CTConfig.md +++ b/docs/src/ressources/CTConfig.md @@ -140,4 +140,4 @@ CTConfig::setPaginationPageSize(400); ## 5. CSRF-Token -{{ \Tests\Unit\Docs\CSRFTokenRequestTest.testGetCSRFToken }} +{{ \CTApi\Test\Unit\Docs\CSRFTokenRequestTest.testGetCSRFToken }} diff --git a/docs/src/ressources/CalendarAPI.md b/docs/src/ressources/CalendarAPI.md index 22e00b47..4589b14f 100644 --- a/docs/src/ressources/CalendarAPI.md +++ b/docs/src/ressources/CalendarAPI.md @@ -2,12 +2,12 @@ Load all calendars: -{{ \Tests\Unit\Docs\CalendarRequestTest.testGetCalendars }} +{{ \CTApi\Test\Unit\Docs\CalendarRequestTest.testGetCalendars }} Load appointments for calendar: -{{ \Tests\Unit\Docs\CalendarRequestTest.testGetApppointments }} +{{ \CTApi\Test\Unit\Docs\CalendarRequestTest.testGetApppointments }} Load appointments for multiple calendars: -{{ \Tests\Unit\Docs\CalendarRequestTest.testGetAppointmentsViaBuilder }} +{{ \CTApi\Test\Unit\Docs\CalendarRequestTest.testGetAppointmentsViaBuilder }} diff --git a/docs/src/ressources/DBFields.md b/docs/src/ressources/DBFields.md index bf1ab160..dde50316 100644 --- a/docs/src/ressources/DBFields.md +++ b/docs/src/ressources/DBFields.md @@ -2,20 +2,20 @@ ## Retrieve all DB-fields: -{{ \Tests\Unit\Docs\DBFieldRequestTest.testGetAllDBFields }} +{{ \CTApi\Test\Unit\Docs\DBFieldRequestTest.testGetAllDBFields }} ## Retrieve single DB-field: -{{ \Tests\Unit\Docs\DBFieldRequestTest.testGetDBField }} +{{ \CTApi\Test\Unit\Docs\DBFieldRequestTest.testGetDBField }} ## Read DBFields in Model To access the custom DBFields, utilize the `getDBFieldData()` method. This will provide an array where the column name of the DBField serves as the key and holds the corresponding value. Alternatively, you can use the `requestDBFields()->get()` method to retrieve a list of DBFieldValueContainers. Each container includes the key, value, and additional details from the DBField model such as name, content-type, and other relevant information. Example for **GroupInformation**: -{{ \Tests\Unit\Docs\DBFieldRequestTest.testReadGroupDBField }} +{{ \CTApi\Test\Unit\Docs\DBFieldRequestTest.testReadGroupDBField }} DBFields are also existing for **Persons**: -{{ \Tests\Unit\Docs\DBFieldRequestTest.testDBFieldsPerson }} +{{ \CTApi\Test\Unit\Docs\DBFieldRequestTest.testDBFieldsPerson }} Developer Tip: To associate DBFields with a model, you can easily accomplish this by implementing the HasDBFields trait. \ No newline at end of file diff --git a/docs/src/ressources/EventAPI.md b/docs/src/ressources/EventAPI.md index 26ee7106..6d07e3e0 100644 --- a/docs/src/ressources/EventAPI.md +++ b/docs/src/ressources/EventAPI.md @@ -1,12 +1,12 @@ # EventAPI ## Event-Request -{{ \Tests\Unit\Docs\EventRequestTest.testEventRequestDocExample }} +{{ \CTApi\Test\Unit\Docs\EventRequestTest.testEventRequestDocExample }} ## Event-Agenda -{{ \Tests\Unit\Docs\EventRequestTest.testEventAgendaRequestDocExample }} +{{ \CTApi\Test\Unit\Docs\EventRequestTest.testEventAgendaRequestDocExample }} ## Event-Services of Event -{{ \Tests\Unit\Docs\EventRequestTest.testEventServicesRequestDocExample }} \ No newline at end of file +{{ \CTApi\Test\Unit\Docs\EventRequestTest.testEventServicesRequestDocExample }} \ No newline at end of file diff --git a/docs/src/ressources/FileAPI.md b/docs/src/ressources/FileAPI.md index 1399f9b7..0c782591 100644 --- a/docs/src/ressources/FileAPI.md +++ b/docs/src/ressources/FileAPI.md @@ -4,11 +4,11 @@ The FileRequestBuilder can be accessed via the FileRequest-Facade: -{{ \Tests\Unit\Docs\FileRequestTest.testAvailableDomainTypes }} +{{ \CTApi\Test\Unit\Docs\FileRequestTest.testAvailableDomainTypes }} Or you can call the builder direct in the model. E.q. in the events-model: -{{ \Tests\Unit\Docs\FileRequestTest.testRequestBuilderViaModel }} +{{ \CTApi\Test\Unit\Docs\FileRequestTest.testRequestBuilderViaModel }} ## FileRequestBuilder-Methods: @@ -16,27 +16,27 @@ Or you can call the builder direct in the model. E.q. in the events-model: Returns an array with all available files. The Avatar-Route only contains one file: -{{ \Tests\Unit\Docs\FileRequestTest.testShowAvatar }} +{{ \CTApi\Test\Unit\Docs\FileRequestTest.testShowAvatar }} ### Delete all files Deletes all files that are attached to the domain-model. -{{ \Tests\Unit\Docs\FileRequestTest.testDeleteAvatar }} +{{ \CTApi\Test\Unit\Docs\FileRequestTest.testDeleteAvatar }} ### Delete single file If you want to delete one specific file you can use the delete-method: -{{ \Tests\Unit\Docs\FileRequestTest.testDeleteSingleFile }} +{{ \CTApi\Test\Unit\Docs\FileRequestTest.testDeleteSingleFile }} ### Rename file -{{ \Tests\Unit\Docs\FileRequestTest.testRenameAvatar }} +{{ \CTApi\Test\Unit\Docs\FileRequestTest.testRenameAvatar }} ### Upload file The avatar-model only accepts one image. If you upload a image the current used avatare will be replaced with the uploaded image. The Event-model e.q. also accepts multiple file-attachements. -{{ \Tests\Unit\Docs\FileRequestTest.testUploadAvatar }} \ No newline at end of file +{{ \CTApi\Test\Unit\Docs\FileRequestTest.testUploadAvatar }} \ No newline at end of file diff --git a/docs/src/ressources/GroupAPI.md b/docs/src/ressources/GroupAPI.md index 0e21bc87..8100d793 100644 --- a/docs/src/ressources/GroupAPI.md +++ b/docs/src/ressources/GroupAPI.md @@ -2,18 +2,18 @@ ## Group-Request & Group-Data: -{{ \Tests\Unit\Docs\GroupRequestTest.testDocExample }} +{{ \CTApi\Test\Unit\Docs\GroupRequestTest.testDocExample }} ## Add, remove and update group-members: -{{ \Tests\Unit\Docs\GroupMemberUpdateRequestTest.testAddGroupMember }} +{{ \CTApi\Test\Unit\Docs\GroupMemberUpdateRequestTest.testAddGroupMember }} ## Group-Meetings -{{ \Tests\Unit\Docs\GroupMeetingRequestTest.testRetrieveGroupRequest }} +{{ \CTApi\Test\Unit\Docs\GroupMeetingRequestTest.testRetrieveGroupRequest }} -{{ \Tests\Unit\Docs\GroupMeetingRequestTest.testRetrieveGroupMemberRequest }} +{{ \CTApi\Test\Unit\Docs\GroupMeetingRequestTest.testRetrieveGroupMemberRequest }} ## GroupMemberFields -{{ \Tests\Unit\Docs\GroupMemberFieldsTest.testGetFields }} \ No newline at end of file +{{ \CTApi\Test\Unit\Docs\GroupMemberFieldsTest.testGetFields }} \ No newline at end of file diff --git a/docs/src/ressources/Models.md b/docs/src/ressources/Models.md index 65171068..7dc3ae1b 100644 --- a/docs/src/ressources/Models.md +++ b/docs/src/ressources/Models.md @@ -8,42 +8,42 @@ All Models are build similar and share the same structure of methods. Create a single model filled with data: -{{ \Tests\Unit\Docs\ModelTest.testCreateModelFromData }} +{{ \CTApi\Test\Unit\Docs\ModelTest.testCreateModelFromData }} Create a collection of models filled with data: -{{ \Tests\Unit\Docs\ModelTest.testCreateModelsFromArray }} +{{ \CTApi\Test\Unit\Docs\ModelTest.testCreateModelsFromArray }} **Convert Model to data** Convert a model with the `toData`-method (FillWithData-Trait): -{{ \Tests\Unit\Docs\ModelTest.testConvertModelToData }} +{{ \CTApi\Test\Unit\Docs\ModelTest.testConvertModelToData }} **`get` and `set`-methods** The attributes of a model can be used accessed with getters and setter. -{{ \Tests\Unit\Docs\ModelTest.testGetterAndSetter }} +{{ \CTApi\Test\Unit\Docs\ModelTest.testGetterAndSetter }} The model id can be retrieved with the `getId` getter. There is also a null-safe getter (`getIdOrFail`) and a integer casted getter (`getIdAsInteger`): -{{ \Tests\Unit\Docs\ModelTest.testGetId }} +{{ \CTApi\Test\Unit\Docs\ModelTest.testGetId }} **`request`-method (one-to-one - singular)** Any `requestXYZ`-method that requests a single model, will request all information from the api and returns the model directly: -{{ \Tests\Unit\Docs\ModelEventTest.testRequestMethod }} +{{ \CTApi\Test\Unit\Docs\ModelEventTest.testRequestMethod }} **`request`-method (one-to-many - plural)** Any `requestXYZ`-method that returns multiple models, returns a RequestBuilder and allow you to access the [Requests](Requests.md) methods and type: -{{ \Tests\Unit\Docs\ModelEventTest.testRequestMethodPlural }} +{{ \CTApi\Test\Unit\Docs\ModelEventTest.testRequestMethodPlural }} A "one-to-many" relation can be easily identified by check if the `requestXYZ`-method ends with an "s" (e.q.: requestSong**s**, requestFile**s**, ...). diff --git a/docs/src/ressources/PermissionAPI.md b/docs/src/ressources/PermissionAPI.md index 2820f50d..733fd612 100644 --- a/docs/src/ressources/PermissionAPI.md +++ b/docs/src/ressources/PermissionAPI.md @@ -2,12 +2,12 @@ ## Internal Group Permission -{{ \Tests\Unit\Docs\PermissionRequestTest.testGroupPermission }} +{{ \CTApi\Test\Unit\Docs\PermissionRequestTest.testGroupPermission }} ## Internal Person Permission -{{ \Tests\Unit\Docs\PermissionRequestTest.testPersonPermission }} +{{ \CTApi\Test\Unit\Docs\PermissionRequestTest.testPersonPermission }} ## Global Permission (for logged in user) -{{ \Tests\Unit\Docs\PermissionRequestTest.testGlobalPermission }} +{{ \CTApi\Test\Unit\Docs\PermissionRequestTest.testGlobalPermission }} diff --git a/docs/src/ressources/PersonAPI.md b/docs/src/ressources/PersonAPI.md index b79fd6c4..beb63067 100644 --- a/docs/src/ressources/PersonAPI.md +++ b/docs/src/ressources/PersonAPI.md @@ -1,18 +1,18 @@ # PersonAPI -{{ \Tests\Unit\Docs\PersonRequestTest.testExampleCode }} +{{ \CTApi\Test\Unit\Docs\PersonRequestTest.testExampleCode }} ## Request Tags from Person -{{ \Tests\Unit\Docs\PersonRequestTest.testRequestTags }} +{{ \CTApi\Test\Unit\Docs\PersonRequestTest.testRequestTags }} ## Retrieve Birthdays -{{ \Tests\Unit\Docs\PersonRequestTest.testBirthdayRequest }} +{{ \CTApi\Test\Unit\Docs\PersonRequestTest.testBirthdayRequest }} ## Create person -{{ \Tests\Unit\Docs\PersonRequestTest.testCreatePerson }} +{{ \CTApi\Test\Unit\Docs\PersonRequestTest.testCreatePerson }} Sometimes it will happen that you have to add a person with the same name as an existing one. ChurchTools will respond with an error to prevent you from @@ -20,7 +20,7 @@ adding duplicates accidently. Therefore you can add the `force` parameter and set it to `true`. -{{ \Tests\Unit\Docs\PersonRequestTest.testCreatePersonWithEqualName }} +{{ \CTApi\Test\Unit\Docs\PersonRequestTest.testCreatePersonWithEqualName }} This will make ChurchTools to insert the record, even if there is a second John Doe. @@ -31,24 +31,24 @@ Use the setters of the person model to modify its data and utilize the Follow this example: -{{ \Tests\Unit\Docs\PersonRequestTest.testUpdatePerson }} +{{ \CTApi\Test\Unit\Docs\PersonRequestTest.testUpdatePerson }} This will send all data of the person to the API and persists them. If you know that only a specific set of attributes is changed, you can limit the data sent to the API, by adding a whitelist of attributes. -{{ \Tests\Unit\Docs\PersonRequestTest.testUpdatePersonSingleAttrbute }} +{{ \CTApi\Test\Unit\Docs\PersonRequestTest.testUpdatePersonSingleAttrbute }} Now, only the e-mail will be sent to the API. This may be used to reduce unnecessary traffic if you are going to do some bulk updates. The following attributes can be updated: -{{ \Tests\Unit\Docs\PersonRequestTest.testUpdatePersonModifiableAttributes }} +{{ \CTApi\Test\Unit\Docs\PersonRequestTest.testUpdatePersonModifiableAttributes }} ## Delete person Delete person via PersonRequest: -{{ \Tests\Unit\Docs\PersonRequestTest.testDeletePerson }} \ No newline at end of file +{{ \CTApi\Test\Unit\Docs\PersonRequestTest.testDeletePerson }} \ No newline at end of file diff --git a/docs/src/ressources/PublicGroupAPI.md b/docs/src/ressources/PublicGroupAPI.md index 18d29b8c..cf6e5096 100644 --- a/docs/src/ressources/PublicGroupAPI.md +++ b/docs/src/ressources/PublicGroupAPI.md @@ -2,14 +2,14 @@ Load Data of Group Homepage with Hash-String. This route is public, so no authentication of the CTConfig is necessary. -{{ \Tests\Unit\Docs\PublicGroupRequestTest.testExampleCodePublicGroupInit }} +{{ \CTApi\Test\Unit\Docs\PublicGroupRequestTest.testExampleCodePublicGroupInit }} The PublicGroup-Model is a Subtype of Group. So all methods of Group will be available in PublicGroup: [GroupAPI](GroupAPI.md) Further the PublicGroup-Model contains the following Methods: -{{ \Tests\Unit\Docs\PublicGroupRequestTest.testExampleCodePublicGroup }} +{{ \CTApi\Test\Unit\Docs\PublicGroupRequestTest.testExampleCodePublicGroup }} For More-Informations on the Attributes have a look at the SourceCode: diff --git a/docs/src/ressources/Requests.md b/docs/src/ressources/Requests.md index b322e528..2c688170 100644 --- a/docs/src/ressources/Requests.md +++ b/docs/src/ressources/Requests.md @@ -23,13 +23,13 @@ is called *pagination*. For example if you like to get only the first 3 events of ChurchTools: -{{ \Tests\Unit\Docs\PaginationTest.testCollectSinglePage }} +{{ \CTApi\Test\Unit\Docs\PaginationTest.testCollectSinglePage }} This is possible for the other APIs like event or group, too. Iterating over all records is quite easy. -{{ \Tests\Unit\Docs\PaginationTest.testIteratePages }} +{{ \CTApi\Test\Unit\Docs\PaginationTest.testIteratePages }} If you want to set the Pagination Page-Size for all Requests you can use the CTConfig. diff --git a/docs/src/ressources/ResourceAPI.md b/docs/src/ressources/ResourceAPI.md index 18c71db4..bfa34003 100644 --- a/docs/src/ressources/ResourceAPI.md +++ b/docs/src/ressources/ResourceAPI.md @@ -2,12 +2,12 @@ Load all Resources that are stored in ChurchTools. -{{ \Tests\Unit\Docs\ResourceRequestTest.testLoadResourceMasterData }} +{{ \CTApi\Test\Unit\Docs\ResourceRequestTest.testLoadResourceMasterData }} Load bookings for specific resource: -{{ \Tests\Unit\Docs\ResourceRequestTest.testLoadBookingsFromResource }} +{{ \CTApi\Test\Unit\Docs\ResourceRequestTest.testLoadBookingsFromResource }} Load bookings for multiple resoures: -{{ \Tests\Unit\Docs\ResourceRequestTest.testLoadBookingsFromResourceIds }} +{{ \CTApi\Test\Unit\Docs\ResourceRequestTest.testLoadBookingsFromResourceIds }} diff --git a/docs/src/ressources/SearchAPI.md b/docs/src/ressources/SearchAPI.md index 816c4b0d..456857cc 100644 --- a/docs/src/ressources/SearchAPI.md +++ b/docs/src/ressources/SearchAPI.md @@ -1,7 +1,7 @@ # Search-API ## Search Global -{{ \Tests\Unit\Docs\SearchRequestTest.testSearchGlobalFor5PM }} +{{ \CTApi\Test\Unit\Docs\SearchRequestTest.testSearchGlobalFor5PM }} ## Search in specific Domain-Types @@ -11,4 +11,4 @@ * song * wiki_page -{{ \Tests\Unit\Docs\SearchRequestTest.testSearchDomainFor5PM }} \ No newline at end of file +{{ \CTApi\Test\Unit\Docs\SearchRequestTest.testSearchDomainFor5PM }} \ No newline at end of file diff --git a/docs/src/ressources/ServiceAPI.md b/docs/src/ressources/ServiceAPI.md index 86726a4a..ffd84ef9 100644 --- a/docs/src/ressources/ServiceAPI.md +++ b/docs/src/ressources/ServiceAPI.md @@ -1,3 +1,3 @@ # ServiceAPI -{{ \Tests\Unit\Docs\ServiceRequestTest.testExampleCode }} \ No newline at end of file +{{ \CTApi\Test\Unit\Docs\ServiceRequestTest.testExampleCode }} \ No newline at end of file diff --git a/docs/src/ressources/SongAPI.md b/docs/src/ressources/SongAPI.md index e36eee11..e3873bb4 100644 --- a/docs/src/ressources/SongAPI.md +++ b/docs/src/ressources/SongAPI.md @@ -2,21 +2,21 @@ ## Request Song -{{ \Tests\Unit\Docs\SongRequestTest.testExampleCode }} +{{ \CTApi\Test\Unit\Docs\SongRequestTest.testExampleCode }} ## Update Song -{{ \Tests\Unit\Docs\SongRequestTest.testUpdateSong }} +{{ \CTApi\Test\Unit\Docs\SongRequestTest.testUpdateSong }} ## Update Song-Arrangement -{{ \Tests\Unit\Docs\SongRequestTest.testUpdateArrangement }} +{{ \CTApi\Test\Unit\Docs\SongRequestTest.testUpdateArrangement }} ## Retrieve Data from CCLI **Retrieve Lyrics for CCLI-Number:** -{{ \Tests\Unit\Docs\CcliRequestTest.testRetrieveLyrics }} +{{ \CTApi\Test\Unit\Docs\CcliRequestTest.testRetrieveLyrics }} **Retrieve Chordsheet for CCLI-Number:** @@ -30,18 +30,18 @@ The method returns a nullable [File-Model](/../../src/Models/File.php). - ⚠ If you insert a invalid ccli-number, churchtools creates an empty file. There is no error reported. -{{ \Tests\Unit\Docs\CcliRequestTest.testRetrieveChordsheet }} +{{ \CTApi\Test\Unit\Docs\CcliRequestTest.testRetrieveChordsheet }} ## Retrieve Song Statistics **Get All Statistics:** -{{ \Tests\Unit\Docs\SongStatisticRequestTest.testGetAll }} +{{ \CTApi\Test\Unit\Docs\SongStatisticRequestTest.testGetAll }} **Get Statistics for Song-Arrangement:** -{{ \Tests\Unit\Docs\SongStatisticRequestTest.testGetViaSongArrangement }} +{{ \CTApi\Test\Unit\Docs\SongStatisticRequestTest.testGetViaSongArrangement }} **Lazy-Builder:** -{{ \Tests\Unit\Docs\SongStatisticRequestTest.testLazy }} +{{ \CTApi\Test\Unit\Docs\SongStatisticRequestTest.testLazy }} diff --git a/docs/src/ressources/WikiAPI.md b/docs/src/ressources/WikiAPI.md index 767c0078..2bc66bff 100644 --- a/docs/src/ressources/WikiAPI.md +++ b/docs/src/ressources/WikiAPI.md @@ -1,3 +1,3 @@ # Wiki-API -{{ \Tests\Unit\Docs\WikiRequestTest.testExampleCode }} \ No newline at end of file +{{ \CTApi\Test\Unit\Docs\WikiRequestTest.testExampleCode }} \ No newline at end of file diff --git a/src/Models/DBField.php b/src/Models/DBField.php index 9c9f84ec..908832b7 100644 --- a/src/Models/DBField.php +++ b/src/Models/DBField.php @@ -1,7 +1,7 @@ expectException(CTAuthException::class); - CTConfig::setApiUrl(\Tests\Integration\IntegrationTestData::get()->getApiUrl()); + CTConfig::setApiUrl(IntegrationTestData::get()->getApiUrl()); CTConfig::authWithCredentials("wrong-email@fail.com", "wrongPassword"); } public function testWrongApiKey(): void { $this->expectException(\CTApi\Exceptions\CTRequestException::class); - CTConfig::setApiUrl(\Tests\Integration\IntegrationTestData::get()->getApiUrl()); + CTConfig::setApiUrl(IntegrationTestData::get()->getApiUrl()); CTConfig::setApiKey("wrong-api-key"); $person = PersonRequest::whoami(); } diff --git a/tests/integration/Exceptions/ConfigExceptionTest.php b/tests/Integration/Exceptions/ConfigExceptionTest.php similarity index 93% rename from tests/integration/Exceptions/ConfigExceptionTest.php rename to tests/Integration/Exceptions/ConfigExceptionTest.php index cbb72984..a240da49 100644 --- a/tests/integration/Exceptions/ConfigExceptionTest.php +++ b/tests/Integration/Exceptions/ConfigExceptionTest.php @@ -1,5 +1,6 @@ getInformation(); diff --git a/tests/unit/Docs/EventRequestTest.php b/tests/Unit/Docs/EventRequestTest.php similarity index 98% rename from tests/unit/Docs/EventRequestTest.php rename to tests/Unit/Docs/EventRequestTest.php index edf72362..759ab506 100644 --- a/tests/unit/Docs/EventRequestTest.php +++ b/tests/Unit/Docs/EventRequestTest.php @@ -1,12 +1,12 @@