From 1728a85bffc3df2dce29c1a9297296393bff01b8 Mon Sep 17 00:00:00 2001 From: Rhys Lees <43909932+RhysLees@users.noreply.github.com> Date: Thu, 12 Oct 2023 00:50:03 +0100 Subject: [PATCH 1/8] Upgrade --- composer.json | 8 ++++---- src/Events/DocuWareResponseLog.php | 3 +-- src/Requests/Auth/PostLoginRequest.php | 2 +- src/Requests/Dialogs/GetDialogRequest.php | 2 +- src/Requests/Dialogs/GetDialogsRequest.php | 2 +- src/Requests/Document/DeleteDocumentRequest.php | 2 +- src/Requests/Document/GetDocumentCountRequest.php | 2 +- src/Requests/Document/GetDocumentDownloadRequest.php | 2 +- src/Requests/Document/GetDocumentPreviewRequest.php | 2 +- src/Requests/Document/GetDocumentRequest.php | 2 +- src/Requests/Document/GetDocumentsDownloadRequest.php | 2 +- src/Requests/Document/GetDocumentsRequest.php | 2 +- src/Requests/Document/PostDocumentRequest.php | 2 +- src/Requests/Document/PostTransferDocumentRequest.php | 2 +- src/Requests/Document/PutDocumentFieldsRequest.php | 2 +- .../Thumbnail/GetDocumentDownloadThumbnailRequest.php | 2 +- src/Requests/Fields/GetFieldsRequest.php | 2 +- src/Requests/FileCabinets/GetFileCabinetsRequest.php | 2 +- src/Requests/Organization/GetOrganizationRequest.php | 2 +- src/Requests/Organization/GetOrganizationsRequest.php | 2 +- src/Requests/Search/GetSearchRequest.php | 2 +- src/Requests/Sections/GetSectionsRequest.php | 2 +- src/Requests/SelectList/GetSelectListRequest.php | 2 +- src/Responses/Dialogs/GetDialogResponse.php | 2 +- src/Responses/Dialogs/GetDialogsResponse.php | 2 +- src/Responses/Document/DeleteDocumentResponse.php | 2 +- src/Responses/Document/GetDocumentCountResponse.php | 2 +- src/Responses/Document/GetDocumentDownloadResponse.php | 2 +- src/Responses/Document/GetDocumentPreviewResponse.php | 2 +- src/Responses/Document/GetDocumentResponse.php | 2 +- src/Responses/Document/GetDocumentsDownloadResponse.php | 2 +- src/Responses/Document/GetDocumentsResponse.php | 2 +- src/Responses/Document/PostDocumentResponse.php | 2 +- src/Responses/Document/PostTransferDocumentResponse.php | 2 +- src/Responses/Document/PutDocumentFieldsResponse.php | 2 +- .../Thumbnail/GetDocumentDownloadThumbnailResponse.php | 2 +- src/Responses/Fields/GetFieldsResponse.php | 2 +- src/Responses/FileCabinets/GetFileCabinetsResponse.php | 2 +- src/Responses/Organization/GetOrganizationResponse.php | 2 +- src/Responses/Organization/GetOrganizationsResponse.php | 2 +- src/Responses/Search/GetSearchResponse.php | 2 +- src/Responses/Sections/GetSectionsResponse.php | 2 +- src/Responses/SelectList/GetSelectListResponse.php | 2 +- src/Support/EnsureValidResponse.php | 3 +-- 44 files changed, 47 insertions(+), 49 deletions(-) diff --git a/composer.json b/composer.json index 0699314..a398463 100644 --- a/composer.json +++ b/composer.json @@ -25,12 +25,12 @@ ], "require": { "php": "^8.2", - "guzzlehttp/guzzle": "^7.5", + "guzzlehttp/guzzle": "^7.6", "illuminate/contracts": "^9.0|^10.0", "nesbot/carbon": "^2.64.0", - "saloonphp/cache-plugin": "^2.0", - "saloonphp/saloon": "^2.0", - "saloonphp/laravel-plugin": "^2.0", + "saloonphp/cache-plugin": "^3.0", + "saloonphp/saloon": "^3.0", + "saloonphp/laravel-plugin": "^3.0", "spatie/laravel-package-tools": "^1.14.0" }, "require-dev": { diff --git a/src/Events/DocuWareResponseLog.php b/src/Events/DocuWareResponseLog.php index e6f02f0..662bb76 100644 --- a/src/Events/DocuWareResponseLog.php +++ b/src/Events/DocuWareResponseLog.php @@ -6,7 +6,6 @@ use Illuminate\Foundation\Events\Dispatchable; use Illuminate\Http\Client\Response; use Illuminate\Queue\SerializesModels; -use Saloon\Contracts\Response as SaloonContracts; use Saloon\Http\Response as SaloonResponse; class DocuWareResponseLog @@ -16,7 +15,7 @@ class DocuWareResponseLog use SerializesModels; public function __construct( - public Response|SaloonResponse|SaloonContracts $response + public Response|SaloonResponse $response ) { } } diff --git a/src/Requests/Auth/PostLoginRequest.php b/src/Requests/Auth/PostLoginRequest.php index 7331d39..bf81c66 100644 --- a/src/Requests/Auth/PostLoginRequest.php +++ b/src/Requests/Auth/PostLoginRequest.php @@ -5,7 +5,7 @@ use CodebarAg\DocuWare\Events\DocuWareResponseLog; use CodebarAg\DocuWare\Support\EnsureValidResponse; use Saloon\Contracts\Body\HasBody; -use Saloon\Contracts\Response; +use Saloon\Http\Response; use Saloon\Enums\Method; use Saloon\Http\SoloRequest; use Saloon\Traits\Body\HasFormBody; diff --git a/src/Requests/Dialogs/GetDialogRequest.php b/src/Requests/Dialogs/GetDialogRequest.php index 1a7b0c6..ecf2f08 100644 --- a/src/Requests/Dialogs/GetDialogRequest.php +++ b/src/Requests/Dialogs/GetDialogRequest.php @@ -7,7 +7,7 @@ use Saloon\CachePlugin\Contracts\Cacheable; use Saloon\CachePlugin\Drivers\LaravelCacheDriver; use Saloon\CachePlugin\Traits\HasCaching; -use Saloon\Contracts\Response; +use Saloon\Http\Response; use Saloon\Enums\Method; use Saloon\Http\Request; diff --git a/src/Requests/Dialogs/GetDialogsRequest.php b/src/Requests/Dialogs/GetDialogsRequest.php index 866c812..838038e 100644 --- a/src/Requests/Dialogs/GetDialogsRequest.php +++ b/src/Requests/Dialogs/GetDialogsRequest.php @@ -7,7 +7,7 @@ use Saloon\CachePlugin\Contracts\Cacheable; use Saloon\CachePlugin\Drivers\LaravelCacheDriver; use Saloon\CachePlugin\Traits\HasCaching; -use Saloon\Contracts\Response; +use Saloon\Http\Response; use Saloon\Enums\Method; use Saloon\Http\Request; diff --git a/src/Requests/Document/DeleteDocumentRequest.php b/src/Requests/Document/DeleteDocumentRequest.php index 967c0b6..25deb0f 100644 --- a/src/Requests/Document/DeleteDocumentRequest.php +++ b/src/Requests/Document/DeleteDocumentRequest.php @@ -3,7 +3,7 @@ namespace CodebarAg\DocuWare\Requests\Document; use CodebarAg\DocuWare\Responses\Document\DeleteDocumentResponse; -use Saloon\Contracts\Response; +use Saloon\Http\Response; use Saloon\Enums\Method; use Saloon\Http\Request; diff --git a/src/Requests/Document/GetDocumentCountRequest.php b/src/Requests/Document/GetDocumentCountRequest.php index 15d5fba..3e066cd 100644 --- a/src/Requests/Document/GetDocumentCountRequest.php +++ b/src/Requests/Document/GetDocumentCountRequest.php @@ -7,7 +7,7 @@ use Saloon\CachePlugin\Contracts\Cacheable; use Saloon\CachePlugin\Drivers\LaravelCacheDriver; use Saloon\CachePlugin\Traits\HasCaching; -use Saloon\Contracts\Response; +use Saloon\Http\Response; use Saloon\Enums\Method; use Saloon\Http\Request; diff --git a/src/Requests/Document/GetDocumentDownloadRequest.php b/src/Requests/Document/GetDocumentDownloadRequest.php index a6dcbe0..ccc21b0 100644 --- a/src/Requests/Document/GetDocumentDownloadRequest.php +++ b/src/Requests/Document/GetDocumentDownloadRequest.php @@ -7,7 +7,7 @@ use Saloon\CachePlugin\Contracts\Cacheable; use Saloon\CachePlugin\Drivers\LaravelCacheDriver; use Saloon\CachePlugin\Traits\HasCaching; -use Saloon\Contracts\Response; +use Saloon\Http\Response; use Saloon\Enums\Method; use Saloon\Http\Request; diff --git a/src/Requests/Document/GetDocumentPreviewRequest.php b/src/Requests/Document/GetDocumentPreviewRequest.php index e42ee73..c0e17ec 100644 --- a/src/Requests/Document/GetDocumentPreviewRequest.php +++ b/src/Requests/Document/GetDocumentPreviewRequest.php @@ -7,7 +7,7 @@ use Saloon\CachePlugin\Contracts\Cacheable; use Saloon\CachePlugin\Drivers\LaravelCacheDriver; use Saloon\CachePlugin\Traits\HasCaching; -use Saloon\Contracts\Response; +use Saloon\Http\Response; use Saloon\Enums\Method; use Saloon\Http\Request; diff --git a/src/Requests/Document/GetDocumentRequest.php b/src/Requests/Document/GetDocumentRequest.php index 880da53..beacaeb 100644 --- a/src/Requests/Document/GetDocumentRequest.php +++ b/src/Requests/Document/GetDocumentRequest.php @@ -7,7 +7,7 @@ use Saloon\CachePlugin\Contracts\Cacheable; use Saloon\CachePlugin\Drivers\LaravelCacheDriver; use Saloon\CachePlugin\Traits\HasCaching; -use Saloon\Contracts\Response; +use Saloon\Http\Response; use Saloon\Enums\Method; use Saloon\Http\Request; diff --git a/src/Requests/Document/GetDocumentsDownloadRequest.php b/src/Requests/Document/GetDocumentsDownloadRequest.php index 5479b53..c5392ee 100644 --- a/src/Requests/Document/GetDocumentsDownloadRequest.php +++ b/src/Requests/Document/GetDocumentsDownloadRequest.php @@ -9,7 +9,7 @@ use Saloon\CachePlugin\Contracts\Cacheable; use Saloon\CachePlugin\Drivers\LaravelCacheDriver; use Saloon\CachePlugin\Traits\HasCaching; -use Saloon\Contracts\Response; +use Saloon\Http\Response; use Saloon\Enums\Method; use Saloon\Http\Request; diff --git a/src/Requests/Document/GetDocumentsRequest.php b/src/Requests/Document/GetDocumentsRequest.php index d5684e6..73ed461 100644 --- a/src/Requests/Document/GetDocumentsRequest.php +++ b/src/Requests/Document/GetDocumentsRequest.php @@ -7,7 +7,7 @@ use Saloon\CachePlugin\Contracts\Cacheable; use Saloon\CachePlugin\Drivers\LaravelCacheDriver; use Saloon\CachePlugin\Traits\HasCaching; -use Saloon\Contracts\Response; +use Saloon\Http\Response; use Saloon\Enums\Method; use Saloon\Http\Request; diff --git a/src/Requests/Document/PostDocumentRequest.php b/src/Requests/Document/PostDocumentRequest.php index 9b73cdf..56773ea 100644 --- a/src/Requests/Document/PostDocumentRequest.php +++ b/src/Requests/Document/PostDocumentRequest.php @@ -6,7 +6,7 @@ use CodebarAg\DocuWare\Responses\Document\PostDocumentResponse; use Illuminate\Support\Collection; use Saloon\Contracts\Body\HasBody; -use Saloon\Contracts\Response; +use Saloon\Http\Response; use Saloon\Data\MultipartValue; use Saloon\Enums\Method; use Saloon\Http\Request; diff --git a/src/Requests/Document/PostTransferDocumentRequest.php b/src/Requests/Document/PostTransferDocumentRequest.php index 02dc47c..6788e6f 100644 --- a/src/Requests/Document/PostTransferDocumentRequest.php +++ b/src/Requests/Document/PostTransferDocumentRequest.php @@ -4,7 +4,7 @@ use CodebarAg\DocuWare\Responses\Document\PostTransferDocumentResponse; use Saloon\Contracts\Body\HasBody; -use Saloon\Contracts\Response; +use Saloon\Http\Response; use Saloon\Enums\Method; use Saloon\Http\Request; use Saloon\Traits\Body\HasJsonBody; diff --git a/src/Requests/Document/PutDocumentFieldsRequest.php b/src/Requests/Document/PutDocumentFieldsRequest.php index 1ad7960..0815bab 100644 --- a/src/Requests/Document/PutDocumentFieldsRequest.php +++ b/src/Requests/Document/PutDocumentFieldsRequest.php @@ -5,7 +5,7 @@ use CodebarAg\DocuWare\Exceptions\UnableToUpdateFields; use CodebarAg\DocuWare\Responses\Document\PutDocumentFieldsResponse; use Saloon\Contracts\Body\HasBody; -use Saloon\Contracts\Response; +use Saloon\Http\Response; use Saloon\Enums\Method; use Saloon\Http\Request; use Saloon\Traits\Body\HasJsonBody; diff --git a/src/Requests/Document/Thumbnail/GetDocumentDownloadThumbnailRequest.php b/src/Requests/Document/Thumbnail/GetDocumentDownloadThumbnailRequest.php index 5d33397..2e1c256 100644 --- a/src/Requests/Document/Thumbnail/GetDocumentDownloadThumbnailRequest.php +++ b/src/Requests/Document/Thumbnail/GetDocumentDownloadThumbnailRequest.php @@ -7,7 +7,7 @@ use Saloon\CachePlugin\Contracts\Cacheable; use Saloon\CachePlugin\Drivers\LaravelCacheDriver; use Saloon\CachePlugin\Traits\HasCaching; -use Saloon\Contracts\Response; +use Saloon\Http\Response; use Saloon\Enums\Method; use Saloon\Http\Request; diff --git a/src/Requests/Fields/GetFieldsRequest.php b/src/Requests/Fields/GetFieldsRequest.php index 0a6f779..2ba65d1 100644 --- a/src/Requests/Fields/GetFieldsRequest.php +++ b/src/Requests/Fields/GetFieldsRequest.php @@ -7,7 +7,7 @@ use Saloon\CachePlugin\Contracts\Cacheable; use Saloon\CachePlugin\Drivers\LaravelCacheDriver; use Saloon\CachePlugin\Traits\HasCaching; -use Saloon\Contracts\Response; +use Saloon\Http\Response; use Saloon\Enums\Method; use Saloon\Http\Request; diff --git a/src/Requests/FileCabinets/GetFileCabinetsRequest.php b/src/Requests/FileCabinets/GetFileCabinetsRequest.php index cf758e3..860faa8 100644 --- a/src/Requests/FileCabinets/GetFileCabinetsRequest.php +++ b/src/Requests/FileCabinets/GetFileCabinetsRequest.php @@ -7,7 +7,7 @@ use Saloon\CachePlugin\Contracts\Cacheable; use Saloon\CachePlugin\Drivers\LaravelCacheDriver; use Saloon\CachePlugin\Traits\HasCaching; -use Saloon\Contracts\Response; +use Saloon\Http\Response; use Saloon\Enums\Method; use Saloon\Http\Request; diff --git a/src/Requests/Organization/GetOrganizationRequest.php b/src/Requests/Organization/GetOrganizationRequest.php index 4c1001c..acce3bf 100644 --- a/src/Requests/Organization/GetOrganizationRequest.php +++ b/src/Requests/Organization/GetOrganizationRequest.php @@ -7,7 +7,7 @@ use Saloon\CachePlugin\Contracts\Cacheable; use Saloon\CachePlugin\Drivers\LaravelCacheDriver; use Saloon\CachePlugin\Traits\HasCaching; -use Saloon\Contracts\Response; +use Saloon\Http\Response; use Saloon\Enums\Method; use Saloon\Http\Request; diff --git a/src/Requests/Organization/GetOrganizationsRequest.php b/src/Requests/Organization/GetOrganizationsRequest.php index f9d11ac..6aa01c9 100644 --- a/src/Requests/Organization/GetOrganizationsRequest.php +++ b/src/Requests/Organization/GetOrganizationsRequest.php @@ -7,7 +7,7 @@ use Saloon\CachePlugin\Contracts\Cacheable; use Saloon\CachePlugin\Drivers\LaravelCacheDriver; use Saloon\CachePlugin\Traits\HasCaching; -use Saloon\Contracts\Response; +use Saloon\Http\Response; use Saloon\Enums\Method; use Saloon\Http\Request; diff --git a/src/Requests/Search/GetSearchRequest.php b/src/Requests/Search/GetSearchRequest.php index e047257..744d24d 100644 --- a/src/Requests/Search/GetSearchRequest.php +++ b/src/Requests/Search/GetSearchRequest.php @@ -8,7 +8,7 @@ use Saloon\CachePlugin\Drivers\LaravelCacheDriver; use Saloon\CachePlugin\Traits\HasCaching; use Saloon\Contracts\Body\HasBody; -use Saloon\Contracts\Response; +use Saloon\Http\Response; use Saloon\Enums\Method; use Saloon\Http\Request; use Saloon\Traits\Body\HasJsonBody; diff --git a/src/Requests/Sections/GetSectionsRequest.php b/src/Requests/Sections/GetSectionsRequest.php index fea39ab..07687b3 100644 --- a/src/Requests/Sections/GetSectionsRequest.php +++ b/src/Requests/Sections/GetSectionsRequest.php @@ -7,7 +7,7 @@ use Saloon\CachePlugin\Contracts\Cacheable; use Saloon\CachePlugin\Drivers\LaravelCacheDriver; use Saloon\CachePlugin\Traits\HasCaching; -use Saloon\Contracts\Response; +use Saloon\Http\Response; use Saloon\Enums\Method; use Saloon\Http\Request; diff --git a/src/Requests/SelectList/GetSelectListRequest.php b/src/Requests/SelectList/GetSelectListRequest.php index 68b1c04..3c9d6a3 100644 --- a/src/Requests/SelectList/GetSelectListRequest.php +++ b/src/Requests/SelectList/GetSelectListRequest.php @@ -7,7 +7,7 @@ use Saloon\CachePlugin\Contracts\Cacheable; use Saloon\CachePlugin\Drivers\LaravelCacheDriver; use Saloon\CachePlugin\Traits\HasCaching; -use Saloon\Contracts\Response; +use Saloon\Http\Response; use Saloon\Enums\Method; use Saloon\Http\Request; diff --git a/src/Responses/Dialogs/GetDialogResponse.php b/src/Responses/Dialogs/GetDialogResponse.php index 23cf257..ad09963 100644 --- a/src/Responses/Dialogs/GetDialogResponse.php +++ b/src/Responses/Dialogs/GetDialogResponse.php @@ -5,7 +5,7 @@ use CodebarAg\DocuWare\DTO\Dialog; use CodebarAg\DocuWare\Events\DocuWareResponseLog; use CodebarAg\DocuWare\Support\EnsureValidResponse; -use Saloon\Contracts\Response; +use Saloon\Http\Response; final class GetDialogResponse { diff --git a/src/Responses/Dialogs/GetDialogsResponse.php b/src/Responses/Dialogs/GetDialogsResponse.php index 819f207..2f2c0d3 100644 --- a/src/Responses/Dialogs/GetDialogsResponse.php +++ b/src/Responses/Dialogs/GetDialogsResponse.php @@ -7,7 +7,7 @@ use CodebarAg\DocuWare\Support\EnsureValidResponse; use Illuminate\Support\Collection; use Illuminate\Support\Enumerable; -use Saloon\Contracts\Response; +use Saloon\Http\Response; final class GetDialogsResponse { diff --git a/src/Responses/Document/DeleteDocumentResponse.php b/src/Responses/Document/DeleteDocumentResponse.php index b6cd064..8d408a1 100644 --- a/src/Responses/Document/DeleteDocumentResponse.php +++ b/src/Responses/Document/DeleteDocumentResponse.php @@ -4,7 +4,7 @@ use CodebarAg\DocuWare\Events\DocuWareResponseLog; use CodebarAg\DocuWare\Support\EnsureValidResponse; -use Saloon\Contracts\Response; +use Saloon\Http\Response; final class DeleteDocumentResponse { diff --git a/src/Responses/Document/GetDocumentCountResponse.php b/src/Responses/Document/GetDocumentCountResponse.php index 92a3f34..6c97d7a 100644 --- a/src/Responses/Document/GetDocumentCountResponse.php +++ b/src/Responses/Document/GetDocumentCountResponse.php @@ -6,7 +6,7 @@ use CodebarAg\DocuWare\Exceptions\UnableToGetDocumentCount; use CodebarAg\DocuWare\Support\EnsureValidResponse; use Illuminate\Support\Arr; -use Saloon\Contracts\Response; +use Saloon\Http\Response; final class GetDocumentCountResponse { diff --git a/src/Responses/Document/GetDocumentDownloadResponse.php b/src/Responses/Document/GetDocumentDownloadResponse.php index b50242a..0741be1 100644 --- a/src/Responses/Document/GetDocumentDownloadResponse.php +++ b/src/Responses/Document/GetDocumentDownloadResponse.php @@ -4,7 +4,7 @@ use CodebarAg\DocuWare\Events\DocuWareResponseLog; use CodebarAg\DocuWare\Support\EnsureValidResponse; -use Saloon\Contracts\Response; +use Saloon\Http\Response; final class GetDocumentDownloadResponse { diff --git a/src/Responses/Document/GetDocumentPreviewResponse.php b/src/Responses/Document/GetDocumentPreviewResponse.php index 716b450..8800cd7 100644 --- a/src/Responses/Document/GetDocumentPreviewResponse.php +++ b/src/Responses/Document/GetDocumentPreviewResponse.php @@ -4,7 +4,7 @@ use CodebarAg\DocuWare\Events\DocuWareResponseLog; use CodebarAg\DocuWare\Support\EnsureValidResponse; -use Saloon\Contracts\Response; +use Saloon\Http\Response; final class GetDocumentPreviewResponse { diff --git a/src/Responses/Document/GetDocumentResponse.php b/src/Responses/Document/GetDocumentResponse.php index c928c56..4abc76d 100644 --- a/src/Responses/Document/GetDocumentResponse.php +++ b/src/Responses/Document/GetDocumentResponse.php @@ -5,7 +5,7 @@ use CodebarAg\DocuWare\DTO\Document; use CodebarAg\DocuWare\Events\DocuWareResponseLog; use CodebarAg\DocuWare\Support\EnsureValidResponse; -use Saloon\Contracts\Response; +use Saloon\Http\Response; final class GetDocumentResponse { diff --git a/src/Responses/Document/GetDocumentsDownloadResponse.php b/src/Responses/Document/GetDocumentsDownloadResponse.php index 4a4859a..d7891c7 100644 --- a/src/Responses/Document/GetDocumentsDownloadResponse.php +++ b/src/Responses/Document/GetDocumentsDownloadResponse.php @@ -4,7 +4,7 @@ use CodebarAg\DocuWare\Events\DocuWareResponseLog; use CodebarAg\DocuWare\Support\EnsureValidResponse; -use Saloon\Contracts\Response; +use Saloon\Http\Response; final class GetDocumentsDownloadResponse { diff --git a/src/Responses/Document/GetDocumentsResponse.php b/src/Responses/Document/GetDocumentsResponse.php index ac5fe7c..bb8f1a5 100644 --- a/src/Responses/Document/GetDocumentsResponse.php +++ b/src/Responses/Document/GetDocumentsResponse.php @@ -6,7 +6,7 @@ use CodebarAg\DocuWare\Events\DocuWareResponseLog; use CodebarAg\DocuWare\Support\EnsureValidResponse; use Illuminate\Support\Collection; -use Saloon\Contracts\Response; +use Saloon\Http\Response; final class GetDocumentsResponse { diff --git a/src/Responses/Document/PostDocumentResponse.php b/src/Responses/Document/PostDocumentResponse.php index cb45ed1..8e2c1b2 100644 --- a/src/Responses/Document/PostDocumentResponse.php +++ b/src/Responses/Document/PostDocumentResponse.php @@ -5,7 +5,7 @@ use CodebarAg\DocuWare\DTO\Document; use CodebarAg\DocuWare\Events\DocuWareResponseLog; use CodebarAg\DocuWare\Support\EnsureValidResponse; -use Saloon\Contracts\Response; +use Saloon\Http\Response; final class PostDocumentResponse { diff --git a/src/Responses/Document/PostTransferDocumentResponse.php b/src/Responses/Document/PostTransferDocumentResponse.php index bc32714..b497829 100644 --- a/src/Responses/Document/PostTransferDocumentResponse.php +++ b/src/Responses/Document/PostTransferDocumentResponse.php @@ -4,7 +4,7 @@ use CodebarAg\DocuWare\Events\DocuWareResponseLog; use CodebarAg\DocuWare\Support\EnsureValidResponse; -use Saloon\Contracts\Response; +use Saloon\Http\Response; final class PostTransferDocumentResponse { diff --git a/src/Responses/Document/PutDocumentFieldsResponse.php b/src/Responses/Document/PutDocumentFieldsResponse.php index 9abb91f..b1e7937 100644 --- a/src/Responses/Document/PutDocumentFieldsResponse.php +++ b/src/Responses/Document/PutDocumentFieldsResponse.php @@ -6,7 +6,7 @@ use CodebarAg\DocuWare\Support\EnsureValidResponse; use CodebarAg\DocuWare\Support\ParseValue; use Illuminate\Support\Collection; -use Saloon\Contracts\Response; +use Saloon\Http\Response; final class PutDocumentFieldsResponse { diff --git a/src/Responses/Document/Thumbnail/GetDocumentDownloadThumbnailResponse.php b/src/Responses/Document/Thumbnail/GetDocumentDownloadThumbnailResponse.php index 7b0a635..40dda9f 100644 --- a/src/Responses/Document/Thumbnail/GetDocumentDownloadThumbnailResponse.php +++ b/src/Responses/Document/Thumbnail/GetDocumentDownloadThumbnailResponse.php @@ -5,7 +5,7 @@ use CodebarAg\DocuWare\DTO\DocumentThumbnail; use CodebarAg\DocuWare\Events\DocuWareResponseLog; use CodebarAg\DocuWare\Support\EnsureValidResponse; -use Saloon\Contracts\Response; +use Saloon\Http\Response; final class GetDocumentDownloadThumbnailResponse { diff --git a/src/Responses/Fields/GetFieldsResponse.php b/src/Responses/Fields/GetFieldsResponse.php index 667eccb..20ed8e3 100644 --- a/src/Responses/Fields/GetFieldsResponse.php +++ b/src/Responses/Fields/GetFieldsResponse.php @@ -7,7 +7,7 @@ use CodebarAg\DocuWare\Support\EnsureValidResponse; use Illuminate\Support\Collection; use Illuminate\Support\Enumerable; -use Saloon\Contracts\Response; +use Saloon\Http\Response; final class GetFieldsResponse { diff --git a/src/Responses/FileCabinets/GetFileCabinetsResponse.php b/src/Responses/FileCabinets/GetFileCabinetsResponse.php index 7096d1b..9eb4e8d 100644 --- a/src/Responses/FileCabinets/GetFileCabinetsResponse.php +++ b/src/Responses/FileCabinets/GetFileCabinetsResponse.php @@ -7,7 +7,7 @@ use CodebarAg\DocuWare\Support\EnsureValidResponse; use Illuminate\Support\Collection; use Illuminate\Support\Enumerable; -use Saloon\Contracts\Response; +use Saloon\Http\Response; final class GetFileCabinetsResponse { diff --git a/src/Responses/Organization/GetOrganizationResponse.php b/src/Responses/Organization/GetOrganizationResponse.php index 7d786be..3693e79 100644 --- a/src/Responses/Organization/GetOrganizationResponse.php +++ b/src/Responses/Organization/GetOrganizationResponse.php @@ -5,7 +5,7 @@ use CodebarAg\DocuWare\DTO\Organization; use CodebarAg\DocuWare\Events\DocuWareResponseLog; use CodebarAg\DocuWare\Support\EnsureValidResponse; -use Saloon\Contracts\Response; +use Saloon\Http\Response; final class GetOrganizationResponse { diff --git a/src/Responses/Organization/GetOrganizationsResponse.php b/src/Responses/Organization/GetOrganizationsResponse.php index 80690c0..bf013c7 100644 --- a/src/Responses/Organization/GetOrganizationsResponse.php +++ b/src/Responses/Organization/GetOrganizationsResponse.php @@ -7,7 +7,7 @@ use CodebarAg\DocuWare\Support\EnsureValidResponse; use Illuminate\Support\Collection; use Illuminate\Support\Enumerable; -use Saloon\Contracts\Response; +use Saloon\Http\Response; final class GetOrganizationsResponse { diff --git a/src/Responses/Search/GetSearchResponse.php b/src/Responses/Search/GetSearchResponse.php index f3c7001..42e4535 100644 --- a/src/Responses/Search/GetSearchResponse.php +++ b/src/Responses/Search/GetSearchResponse.php @@ -6,7 +6,7 @@ use CodebarAg\DocuWare\Events\DocuWareResponseLog; use CodebarAg\DocuWare\Support\EnsureValidResponse; use Exception; -use Saloon\Contracts\Response; +use Saloon\Http\Response; final class GetSearchResponse { diff --git a/src/Responses/Sections/GetSectionsResponse.php b/src/Responses/Sections/GetSectionsResponse.php index 05af065..603b2c8 100644 --- a/src/Responses/Sections/GetSectionsResponse.php +++ b/src/Responses/Sections/GetSectionsResponse.php @@ -6,7 +6,7 @@ use CodebarAg\DocuWare\Support\EnsureValidResponse; use Illuminate\Support\Collection; use Illuminate\Support\Enumerable; -use Saloon\Contracts\Response; +use Saloon\Http\Response; final class GetSectionsResponse { diff --git a/src/Responses/SelectList/GetSelectListResponse.php b/src/Responses/SelectList/GetSelectListResponse.php index e69ed30..14b7078 100644 --- a/src/Responses/SelectList/GetSelectListResponse.php +++ b/src/Responses/SelectList/GetSelectListResponse.php @@ -4,7 +4,7 @@ use CodebarAg\DocuWare\Events\DocuWareResponseLog; use CodebarAg\DocuWare\Support\EnsureValidResponse; -use Saloon\Contracts\Response; +use Saloon\Http\Response; final class GetSelectListResponse { diff --git a/src/Support/EnsureValidResponse.php b/src/Support/EnsureValidResponse.php index f7c40f0..26ed841 100644 --- a/src/Support/EnsureValidResponse.php +++ b/src/Support/EnsureValidResponse.php @@ -5,13 +5,12 @@ use CodebarAg\DocuWare\Exceptions\UnableToMakeRequest; use CodebarAg\DocuWare\Exceptions\UnableToProcessRequest; use Illuminate\Http\Client\Response; -use Saloon\Contracts\Response as SaloonContracts; use Saloon\Http\Response as SaloonResponse; use Symfony\Component\HttpFoundation\Response as Status; class EnsureValidResponse { - public static function from(Response|SaloonResponse|SaloonContracts $response): void + public static function from(Response|SaloonResponse $response): void { if ($response->successful()) { return; From 60c9d37d8ff54888723cd827d5fbf9d81e9b2252 Mon Sep 17 00:00:00 2001 From: RhysLees Date: Wed, 11 Oct 2023 23:50:35 +0000 Subject: [PATCH 2/8] Fix styling --- src/Requests/Auth/PostLoginRequest.php | 2 +- src/Requests/Dialogs/GetDialogRequest.php | 2 +- src/Requests/Dialogs/GetDialogsRequest.php | 2 +- src/Requests/Document/DeleteDocumentRequest.php | 2 +- src/Requests/Document/GetDocumentCountRequest.php | 2 +- src/Requests/Document/GetDocumentDownloadRequest.php | 2 +- src/Requests/Document/GetDocumentPreviewRequest.php | 2 +- src/Requests/Document/GetDocumentRequest.php | 2 +- src/Requests/Document/GetDocumentsDownloadRequest.php | 2 +- src/Requests/Document/GetDocumentsRequest.php | 2 +- src/Requests/Document/PostDocumentRequest.php | 2 +- src/Requests/Document/PostTransferDocumentRequest.php | 2 +- src/Requests/Document/PutDocumentFieldsRequest.php | 2 +- .../Document/Thumbnail/GetDocumentDownloadThumbnailRequest.php | 2 +- src/Requests/Fields/GetFieldsRequest.php | 2 +- src/Requests/FileCabinets/GetFileCabinetsRequest.php | 2 +- src/Requests/Organization/GetOrganizationRequest.php | 2 +- src/Requests/Organization/GetOrganizationsRequest.php | 2 +- src/Requests/Search/GetSearchRequest.php | 2 +- src/Requests/Sections/GetSectionsRequest.php | 2 +- src/Requests/SelectList/GetSelectListRequest.php | 2 +- 21 files changed, 21 insertions(+), 21 deletions(-) diff --git a/src/Requests/Auth/PostLoginRequest.php b/src/Requests/Auth/PostLoginRequest.php index bf81c66..e14deb6 100644 --- a/src/Requests/Auth/PostLoginRequest.php +++ b/src/Requests/Auth/PostLoginRequest.php @@ -5,8 +5,8 @@ use CodebarAg\DocuWare\Events\DocuWareResponseLog; use CodebarAg\DocuWare\Support\EnsureValidResponse; use Saloon\Contracts\Body\HasBody; -use Saloon\Http\Response; use Saloon\Enums\Method; +use Saloon\Http\Response; use Saloon\Http\SoloRequest; use Saloon\Traits\Body\HasFormBody; diff --git a/src/Requests/Dialogs/GetDialogRequest.php b/src/Requests/Dialogs/GetDialogRequest.php index ecf2f08..4dadfcd 100644 --- a/src/Requests/Dialogs/GetDialogRequest.php +++ b/src/Requests/Dialogs/GetDialogRequest.php @@ -7,9 +7,9 @@ use Saloon\CachePlugin\Contracts\Cacheable; use Saloon\CachePlugin\Drivers\LaravelCacheDriver; use Saloon\CachePlugin\Traits\HasCaching; -use Saloon\Http\Response; use Saloon\Enums\Method; use Saloon\Http\Request; +use Saloon\Http\Response; class GetDialogRequest extends Request implements Cacheable { diff --git a/src/Requests/Dialogs/GetDialogsRequest.php b/src/Requests/Dialogs/GetDialogsRequest.php index 838038e..f21437d 100644 --- a/src/Requests/Dialogs/GetDialogsRequest.php +++ b/src/Requests/Dialogs/GetDialogsRequest.php @@ -7,9 +7,9 @@ use Saloon\CachePlugin\Contracts\Cacheable; use Saloon\CachePlugin\Drivers\LaravelCacheDriver; use Saloon\CachePlugin\Traits\HasCaching; -use Saloon\Http\Response; use Saloon\Enums\Method; use Saloon\Http\Request; +use Saloon\Http\Response; class GetDialogsRequest extends Request implements Cacheable { diff --git a/src/Requests/Document/DeleteDocumentRequest.php b/src/Requests/Document/DeleteDocumentRequest.php index 25deb0f..f48ae9b 100644 --- a/src/Requests/Document/DeleteDocumentRequest.php +++ b/src/Requests/Document/DeleteDocumentRequest.php @@ -3,9 +3,9 @@ namespace CodebarAg\DocuWare\Requests\Document; use CodebarAg\DocuWare\Responses\Document\DeleteDocumentResponse; -use Saloon\Http\Response; use Saloon\Enums\Method; use Saloon\Http\Request; +use Saloon\Http\Response; class DeleteDocumentRequest extends Request { diff --git a/src/Requests/Document/GetDocumentCountRequest.php b/src/Requests/Document/GetDocumentCountRequest.php index 3e066cd..863e0f9 100644 --- a/src/Requests/Document/GetDocumentCountRequest.php +++ b/src/Requests/Document/GetDocumentCountRequest.php @@ -7,9 +7,9 @@ use Saloon\CachePlugin\Contracts\Cacheable; use Saloon\CachePlugin\Drivers\LaravelCacheDriver; use Saloon\CachePlugin\Traits\HasCaching; -use Saloon\Http\Response; use Saloon\Enums\Method; use Saloon\Http\Request; +use Saloon\Http\Response; class GetDocumentCountRequest extends Request implements Cacheable { diff --git a/src/Requests/Document/GetDocumentDownloadRequest.php b/src/Requests/Document/GetDocumentDownloadRequest.php index ccc21b0..157720d 100644 --- a/src/Requests/Document/GetDocumentDownloadRequest.php +++ b/src/Requests/Document/GetDocumentDownloadRequest.php @@ -7,9 +7,9 @@ use Saloon\CachePlugin\Contracts\Cacheable; use Saloon\CachePlugin\Drivers\LaravelCacheDriver; use Saloon\CachePlugin\Traits\HasCaching; -use Saloon\Http\Response; use Saloon\Enums\Method; use Saloon\Http\Request; +use Saloon\Http\Response; class GetDocumentDownloadRequest extends Request implements Cacheable { diff --git a/src/Requests/Document/GetDocumentPreviewRequest.php b/src/Requests/Document/GetDocumentPreviewRequest.php index c0e17ec..2afc2f7 100644 --- a/src/Requests/Document/GetDocumentPreviewRequest.php +++ b/src/Requests/Document/GetDocumentPreviewRequest.php @@ -7,9 +7,9 @@ use Saloon\CachePlugin\Contracts\Cacheable; use Saloon\CachePlugin\Drivers\LaravelCacheDriver; use Saloon\CachePlugin\Traits\HasCaching; -use Saloon\Http\Response; use Saloon\Enums\Method; use Saloon\Http\Request; +use Saloon\Http\Response; class GetDocumentPreviewRequest extends Request implements Cacheable { diff --git a/src/Requests/Document/GetDocumentRequest.php b/src/Requests/Document/GetDocumentRequest.php index beacaeb..8f07f40 100644 --- a/src/Requests/Document/GetDocumentRequest.php +++ b/src/Requests/Document/GetDocumentRequest.php @@ -7,9 +7,9 @@ use Saloon\CachePlugin\Contracts\Cacheable; use Saloon\CachePlugin\Drivers\LaravelCacheDriver; use Saloon\CachePlugin\Traits\HasCaching; -use Saloon\Http\Response; use Saloon\Enums\Method; use Saloon\Http\Request; +use Saloon\Http\Response; class GetDocumentRequest extends Request implements Cacheable { diff --git a/src/Requests/Document/GetDocumentsDownloadRequest.php b/src/Requests/Document/GetDocumentsDownloadRequest.php index c5392ee..79ac015 100644 --- a/src/Requests/Document/GetDocumentsDownloadRequest.php +++ b/src/Requests/Document/GetDocumentsDownloadRequest.php @@ -9,9 +9,9 @@ use Saloon\CachePlugin\Contracts\Cacheable; use Saloon\CachePlugin\Drivers\LaravelCacheDriver; use Saloon\CachePlugin\Traits\HasCaching; -use Saloon\Http\Response; use Saloon\Enums\Method; use Saloon\Http\Request; +use Saloon\Http\Response; class GetDocumentsDownloadRequest extends Request implements Cacheable { diff --git a/src/Requests/Document/GetDocumentsRequest.php b/src/Requests/Document/GetDocumentsRequest.php index 73ed461..6f6745c 100644 --- a/src/Requests/Document/GetDocumentsRequest.php +++ b/src/Requests/Document/GetDocumentsRequest.php @@ -7,9 +7,9 @@ use Saloon\CachePlugin\Contracts\Cacheable; use Saloon\CachePlugin\Drivers\LaravelCacheDriver; use Saloon\CachePlugin\Traits\HasCaching; -use Saloon\Http\Response; use Saloon\Enums\Method; use Saloon\Http\Request; +use Saloon\Http\Response; class GetDocumentsRequest extends Request implements Cacheable { diff --git a/src/Requests/Document/PostDocumentRequest.php b/src/Requests/Document/PostDocumentRequest.php index 56773ea..9c4a126 100644 --- a/src/Requests/Document/PostDocumentRequest.php +++ b/src/Requests/Document/PostDocumentRequest.php @@ -6,10 +6,10 @@ use CodebarAg\DocuWare\Responses\Document\PostDocumentResponse; use Illuminate\Support\Collection; use Saloon\Contracts\Body\HasBody; -use Saloon\Http\Response; use Saloon\Data\MultipartValue; use Saloon\Enums\Method; use Saloon\Http\Request; +use Saloon\Http\Response; use Saloon\Traits\Body\HasMultipartBody; class PostDocumentRequest extends Request implements HasBody diff --git a/src/Requests/Document/PostTransferDocumentRequest.php b/src/Requests/Document/PostTransferDocumentRequest.php index 6788e6f..171791a 100644 --- a/src/Requests/Document/PostTransferDocumentRequest.php +++ b/src/Requests/Document/PostTransferDocumentRequest.php @@ -4,9 +4,9 @@ use CodebarAg\DocuWare\Responses\Document\PostTransferDocumentResponse; use Saloon\Contracts\Body\HasBody; -use Saloon\Http\Response; use Saloon\Enums\Method; use Saloon\Http\Request; +use Saloon\Http\Response; use Saloon\Traits\Body\HasJsonBody; class PostTransferDocumentRequest extends Request implements HasBody diff --git a/src/Requests/Document/PutDocumentFieldsRequest.php b/src/Requests/Document/PutDocumentFieldsRequest.php index 0815bab..3ff1712 100644 --- a/src/Requests/Document/PutDocumentFieldsRequest.php +++ b/src/Requests/Document/PutDocumentFieldsRequest.php @@ -5,9 +5,9 @@ use CodebarAg\DocuWare\Exceptions\UnableToUpdateFields; use CodebarAg\DocuWare\Responses\Document\PutDocumentFieldsResponse; use Saloon\Contracts\Body\HasBody; -use Saloon\Http\Response; use Saloon\Enums\Method; use Saloon\Http\Request; +use Saloon\Http\Response; use Saloon\Traits\Body\HasJsonBody; class PutDocumentFieldsRequest extends Request implements HasBody diff --git a/src/Requests/Document/Thumbnail/GetDocumentDownloadThumbnailRequest.php b/src/Requests/Document/Thumbnail/GetDocumentDownloadThumbnailRequest.php index 2e1c256..a3910e1 100644 --- a/src/Requests/Document/Thumbnail/GetDocumentDownloadThumbnailRequest.php +++ b/src/Requests/Document/Thumbnail/GetDocumentDownloadThumbnailRequest.php @@ -7,9 +7,9 @@ use Saloon\CachePlugin\Contracts\Cacheable; use Saloon\CachePlugin\Drivers\LaravelCacheDriver; use Saloon\CachePlugin\Traits\HasCaching; -use Saloon\Http\Response; use Saloon\Enums\Method; use Saloon\Http\Request; +use Saloon\Http\Response; class GetDocumentDownloadThumbnailRequest extends Request implements Cacheable { diff --git a/src/Requests/Fields/GetFieldsRequest.php b/src/Requests/Fields/GetFieldsRequest.php index 2ba65d1..c62fabc 100644 --- a/src/Requests/Fields/GetFieldsRequest.php +++ b/src/Requests/Fields/GetFieldsRequest.php @@ -7,9 +7,9 @@ use Saloon\CachePlugin\Contracts\Cacheable; use Saloon\CachePlugin\Drivers\LaravelCacheDriver; use Saloon\CachePlugin\Traits\HasCaching; -use Saloon\Http\Response; use Saloon\Enums\Method; use Saloon\Http\Request; +use Saloon\Http\Response; class GetFieldsRequest extends Request implements Cacheable { diff --git a/src/Requests/FileCabinets/GetFileCabinetsRequest.php b/src/Requests/FileCabinets/GetFileCabinetsRequest.php index 860faa8..e3021f1 100644 --- a/src/Requests/FileCabinets/GetFileCabinetsRequest.php +++ b/src/Requests/FileCabinets/GetFileCabinetsRequest.php @@ -7,9 +7,9 @@ use Saloon\CachePlugin\Contracts\Cacheable; use Saloon\CachePlugin\Drivers\LaravelCacheDriver; use Saloon\CachePlugin\Traits\HasCaching; -use Saloon\Http\Response; use Saloon\Enums\Method; use Saloon\Http\Request; +use Saloon\Http\Response; class GetFileCabinetsRequest extends Request implements Cacheable { diff --git a/src/Requests/Organization/GetOrganizationRequest.php b/src/Requests/Organization/GetOrganizationRequest.php index acce3bf..9b30864 100644 --- a/src/Requests/Organization/GetOrganizationRequest.php +++ b/src/Requests/Organization/GetOrganizationRequest.php @@ -7,9 +7,9 @@ use Saloon\CachePlugin\Contracts\Cacheable; use Saloon\CachePlugin\Drivers\LaravelCacheDriver; use Saloon\CachePlugin\Traits\HasCaching; -use Saloon\Http\Response; use Saloon\Enums\Method; use Saloon\Http\Request; +use Saloon\Http\Response; class GetOrganizationRequest extends Request implements Cacheable { diff --git a/src/Requests/Organization/GetOrganizationsRequest.php b/src/Requests/Organization/GetOrganizationsRequest.php index 6aa01c9..31b072b 100644 --- a/src/Requests/Organization/GetOrganizationsRequest.php +++ b/src/Requests/Organization/GetOrganizationsRequest.php @@ -7,9 +7,9 @@ use Saloon\CachePlugin\Contracts\Cacheable; use Saloon\CachePlugin\Drivers\LaravelCacheDriver; use Saloon\CachePlugin\Traits\HasCaching; -use Saloon\Http\Response; use Saloon\Enums\Method; use Saloon\Http\Request; +use Saloon\Http\Response; class GetOrganizationsRequest extends Request implements Cacheable { diff --git a/src/Requests/Search/GetSearchRequest.php b/src/Requests/Search/GetSearchRequest.php index 744d24d..84ac157 100644 --- a/src/Requests/Search/GetSearchRequest.php +++ b/src/Requests/Search/GetSearchRequest.php @@ -8,9 +8,9 @@ use Saloon\CachePlugin\Drivers\LaravelCacheDriver; use Saloon\CachePlugin\Traits\HasCaching; use Saloon\Contracts\Body\HasBody; -use Saloon\Http\Response; use Saloon\Enums\Method; use Saloon\Http\Request; +use Saloon\Http\Response; use Saloon\Traits\Body\HasJsonBody; class GetSearchRequest extends Request implements Cacheable, HasBody diff --git a/src/Requests/Sections/GetSectionsRequest.php b/src/Requests/Sections/GetSectionsRequest.php index 07687b3..280bc87 100644 --- a/src/Requests/Sections/GetSectionsRequest.php +++ b/src/Requests/Sections/GetSectionsRequest.php @@ -7,9 +7,9 @@ use Saloon\CachePlugin\Contracts\Cacheable; use Saloon\CachePlugin\Drivers\LaravelCacheDriver; use Saloon\CachePlugin\Traits\HasCaching; -use Saloon\Http\Response; use Saloon\Enums\Method; use Saloon\Http\Request; +use Saloon\Http\Response; class GetSectionsRequest extends Request implements Cacheable { diff --git a/src/Requests/SelectList/GetSelectListRequest.php b/src/Requests/SelectList/GetSelectListRequest.php index 3c9d6a3..beb9631 100644 --- a/src/Requests/SelectList/GetSelectListRequest.php +++ b/src/Requests/SelectList/GetSelectListRequest.php @@ -7,9 +7,9 @@ use Saloon\CachePlugin\Contracts\Cacheable; use Saloon\CachePlugin\Drivers\LaravelCacheDriver; use Saloon\CachePlugin\Traits\HasCaching; -use Saloon\Http\Response; use Saloon\Enums\Method; use Saloon\Http\Request; +use Saloon\Http\Response; class GetSelectListRequest extends Request implements Cacheable { From 14f68316986d328dd847fbe89b54446c3813353a Mon Sep 17 00:00:00 2001 From: Rhys Lees <43909932+RhysLees@users.noreply.github.com> Date: Thu, 12 Oct 2023 23:39:28 +0100 Subject: [PATCH 3/8] Soft Tests --- tests/Feature/DocumentTest.php | 288 ------------------ .../Requests/Dialogs/GetDialogRequestTest.php | 40 +++ .../Dialogs/GetDialogsRequestTest.php} | 13 - .../Document/GetDocumentCountRequestTest.php | 61 ++++ .../GetDocumentDownloadRequestTest.php | 60 ++++ .../GetDocumentPreviewRequestTest.php | 57 ++++ .../Document/GetDocumentRequestTest.php | 59 ++++ .../GetDocumentsDownloadRequestTest.php | 71 +++++ .../Document/GetDocumentsRequestTest.php | 64 ++++ .../Document/PostDocumentRequestTest.php | 66 ++++ .../Document/PutDocumentFieldsRequestTest.php | 95 ++++++ ...tDocumentDownloadThumbnailRequestTest.php} | 0 .../Fields/GetFieldsRequestTest.php} | 0 .../GetFileCabinetsRequestTests.php} | 0 .../GetOrganizationRequestTest.php} | 10 - .../GetOrganizationsRequestTest.php | 37 +++ .../Search/GetSearchRequestTest.php} | 0 .../SelectList}/SelectListTest.php | 0 18 files changed, 610 insertions(+), 311 deletions(-) delete mode 100644 tests/Feature/DocumentTest.php create mode 100644 tests/Feature/Requests/Dialogs/GetDialogRequestTest.php rename tests/Feature/{DialogsTest.php => Requests/Dialogs/GetDialogsRequestTest.php} (77%) create mode 100644 tests/Feature/Requests/Document/GetDocumentCountRequestTest.php create mode 100644 tests/Feature/Requests/Document/GetDocumentDownloadRequestTest.php create mode 100644 tests/Feature/Requests/Document/GetDocumentPreviewRequestTest.php create mode 100644 tests/Feature/Requests/Document/GetDocumentRequestTest.php create mode 100644 tests/Feature/Requests/Document/GetDocumentsDownloadRequestTest.php create mode 100644 tests/Feature/Requests/Document/GetDocumentsRequestTest.php create mode 100644 tests/Feature/Requests/Document/PostDocumentRequestTest.php create mode 100644 tests/Feature/Requests/Document/PutDocumentFieldsRequestTest.php rename tests/Feature/{ThumbnailTest.php => Requests/Document/Thumbnail/GetDocumentDownloadThumbnailRequestTest.php} (100%) rename tests/Feature/{FieldsTest.php => Requests/Fields/GetFieldsRequestTest.php} (100%) rename tests/Feature/{FileCabinetsTests.php => Requests/FileCabinets/GetFileCabinetsRequestTests.php} (100%) rename tests/Feature/{OrganizationTest.php => Requests/Organization/GetOrganizationRequestTest.php} (80%) create mode 100644 tests/Feature/Requests/Organization/GetOrganizationsRequestTest.php rename tests/Feature/{SearchTest.php => Requests/Search/GetSearchRequestTest.php} (100%) rename tests/Feature/{ => Requests/SelectList}/SelectListTest.php (100%) diff --git a/tests/Feature/DocumentTest.php b/tests/Feature/DocumentTest.php deleted file mode 100644 index 1d25be9..0000000 --- a/tests/Feature/DocumentTest.php +++ /dev/null @@ -1,288 +0,0 @@ -group('docuware'); - -beforeEach(function () { - EnsureValidCookie::check(); - - $config = Config::make([ - 'url' => config('docuware.credentials.url'), - 'cookie' => config('docuware.cookies'), - 'cache_driver' => config('docuware.configurations.cache.driver'), - 'cache_lifetime_in_seconds' => config('docuware.configurations.cache.lifetime_in_seconds'), - 'request_timeout_in_seconds' => config('docuware.timeout'), - ]); - - $this->connector = new DocuWareStaticConnector($config); -}); - -it('can preview a document image', function () { - Event::fake(); - - $fileCabinetId = config('docuware.tests.file_cabinet_id'); - - $document = $this->connector->send(new PostDocumentRequest( - $fileCabinetId, - '::fake-file-content::', - 'example.txt' - ))->dto(); - - $image = $this->connector->send(new GetDocumentPreviewRequest($fileCabinetId, $document->id))->dto(); - - $this->assertSame(9221, strlen($image)); - Event::assertDispatched(DocuWareResponseLog::class); - - $this->connector->send(new DeleteDocumentRequest( - $fileCabinetId, - $document->id - ))->dto(); -}); - -it('can show a document', function () { - Event::fake(); - - $fileCabinetId = config('docuware.tests.file_cabinet_id'); - - $document = $this->connector->send(new PostDocumentRequest( - $fileCabinetId, - '::fake-file-content::', - 'example.txt' - ))->dto(); - - $getdocument = $this->connector->send(new GetDocumentRequest($fileCabinetId, $document->id))->dto(); - - $this->assertInstanceOf(Document::class, $getdocument); - $this->assertSame($document->id, $getdocument->id); - $this->assertSame($fileCabinetId, $getdocument->file_cabinet_id); - Event::assertDispatched(DocuWareResponseLog::class); - - $this->connector->send(new DeleteDocumentRequest( - $fileCabinetId, - $document->id - ))->dto(); -}); - -it('can update a document value', function () { - Event::fake(); - - $fileCabinetId = config('docuware.tests.file_cabinet_id'); - $newValue = 'laravel-docuware'; - - $document = $this->connector->send(new PostDocumentRequest( - $fileCabinetId, - '::fake-file-content::', - 'example.txt' - ))->dto(); - - $response = $this->connector->send(new PutDocumentFieldsRequest( - $fileCabinetId, - $document->id, - ['UUID' => $newValue] - ))->dto(); - - $this->assertSame('laravel-docuware', $response['UUID']); - Event::assertDispatched(DocuWareResponseLog::class); - - $this->connector->send(new DeleteDocumentRequest( - $fileCabinetId, - $document->id - ))->dto(); -}); - -it('can update multiple document values', function () { - Event::fake(); - - $fileCabinetId = config('docuware.tests.file_cabinet_id'); - $values = [ - 'UUID' => 'laravel-docuware', - 'DOCUMENT_LABEL' => 'laravel-docuware-2', - ]; - - $document = $this->connector->send(new PostDocumentRequest( - $fileCabinetId, - '::fake-file-content::', - 'example.txt' - ))->dto(); - - $response = $this->connector->send(new PutDocumentFieldsRequest( - $fileCabinetId, - $document->id, - $values, - true - ))->dto(); - - $this->assertSame('laravel-docuware', $response['UUID']); - $this->assertSame('laravel-docuware-2', $response['DOCUMENT_LABEL']); - - Event::assertDispatched(DocuWareResponseLog::class); - - $this->connector->send(new DeleteDocumentRequest( - $fileCabinetId, - $document->id - ))->dto(); -}); - -it('can download multiple documents', function () { - Event::fake(); - - $fileCabinetId = config('docuware.tests.file_cabinet_id'); - - $document1 = $this->connector->send(new PostDocumentRequest( - $fileCabinetId, - '::fake-file-content::', - 'example.txt' - ))->dto(); - - $document2 = $this->connector->send(new PostDocumentRequest( - $fileCabinetId, - '::fake-file-content::', - 'example.txt' - ))->dto(); - - $contents = $this->connector->send(new GetDocumentsDownloadRequest( - $fileCabinetId, - [$document1->id, $document2->id] - ))->dto(); - - $this->assertSame(478, strlen($contents)); - Event::assertDispatched(DocuWareResponseLog::class); - - $this->connector->send(new DeleteDocumentRequest( - $fileCabinetId, - $document1->id - ))->dto(); - - $this->connector->send(new DeleteDocumentRequest( - $fileCabinetId, - $document2->id - ))->dto(); -}); - -it('can download a document', function () { - Event::fake(); - - $fileCabinetId = config('docuware.tests.file_cabinet_id'); - - $document = $this->connector->send(new PostDocumentRequest( - $fileCabinetId, - '::fake-file-content::', - 'example.txt' - ))->dto(); - - $contents = $this->connector->send(new GetDocumentDownloadRequest( - $fileCabinetId, - $document->id - ))->dto(); - - $this->assertSame(strlen('::fake-file-content::'), strlen($contents)); - Event::assertDispatched(DocuWareResponseLog::class); - - $this->connector->send(new DeleteDocumentRequest( - $fileCabinetId, - $document->id - ))->dto(); -}); - -it('can get a total count of documents', function () { - Event::fake(); - - $fileCabinetId = config('docuware.tests.file_cabinet_id'); - $dialogId = config('docuware.tests.dialog_id'); - - $document = $this->connector->send(new PostDocumentRequest( - $fileCabinetId, - '::fake-file-content::', - 'example.txt' - ))->dto(); - - $count = $this->connector->send(new GetDocumentCountRequest( - $fileCabinetId, - $dialogId - ))->dto(); - - $this->assertSame(1, $count); - Event::assertDispatched(DocuWareResponseLog::class); - - $this->connector->send(new DeleteDocumentRequest( - $fileCabinetId, - $document->id - ))->dto(); -}); - -it('can upload document with index values and delete it', function () { - Event::fake(); - - $fileCabinetId = config('docuware.tests.file_cabinet_id'); - $fileContent = '::fake-file-content::'; - $fileName = 'example.txt'; - - $document = $this->connector->send(new PostDocumentRequest( - $fileCabinetId, - $fileContent, - $fileName, - collect([ - DocumentIndex::make('DOCUMENT_LABEL', '::text::'), - ]), - ))->dto(); - - $this->connector->send(new DeleteDocumentRequest( - $fileCabinetId, - $document->id, - ))->dto(); - - $this->assertInstanceOf(Document::class, $document); - $this->assertSame('example', $document->title); - tap($document->fields['DOCUMENT_LABEL'], function (DocumentField $field) { - $this->assertSame($field->name, 'DOCUMENT_LABEL'); - $this->assertSame($field->type, 'String'); - $this->assertSame($field->value, '::text::'); - }); - Event::assertDispatched(DocuWareResponseLog::class); -}); - -it('can get all documents', function () { - Event::fake(); - - $this->connector->send(new PostDocumentRequest( - config('docuware.tests.file_cabinet_id'), - '::fake-file-content::', - 'example.txt' - ))->dto(); - $this->connector->send(new PostDocumentRequest( - config('docuware.tests.file_cabinet_id'), - '::fake-file-content::', - 'example.txt' - ))->dto(); - - $documents = $this->connector->send(new GetDocumentsRequest( - config('docuware.tests.file_cabinet_id') - ))->dto(); - - foreach ($documents as $document) { - $this->assertInstanceOf(Document::class, $document); - $this->connector->send(new DeleteDocumentRequest( - config('docuware.tests.file_cabinet_id'), - $document->id, - ))->dto(); - } - - Event::assertDispatched(DocuWareResponseLog::class); -}); diff --git a/tests/Feature/Requests/Dialogs/GetDialogRequestTest.php b/tests/Feature/Requests/Dialogs/GetDialogRequestTest.php new file mode 100644 index 0000000..d5c3ae5 --- /dev/null +++ b/tests/Feature/Requests/Dialogs/GetDialogRequestTest.php @@ -0,0 +1,40 @@ +group('docuware'); + +beforeEach(function () { + EnsureValidCookie::check(); + + $config = Config::make([ + 'url' => config('docuware.credentials.url'), + 'cookie' => config('docuware.cookies'), + 'cache_driver' => config('docuware.configurations.cache.driver'), + 'cache_lifetime_in_seconds' => config('docuware.configurations.cache.lifetime_in_seconds'), + 'request_timeout_in_seconds' => config('docuware.timeout'), + ]); + + $this->connector = new DocuWareStaticConnector($config); +}); + +it('can get a dialog', function () { + Event::fake(); + + $fileCabinetId = config('docuware.tests.file_cabinet_id'); + $dialogId = config('docuware.tests.dialog_id'); + + $dialog = $this->connector->send(new GetDialogRequest($fileCabinetId, $dialogId))->dto(); + + $this->assertInstanceOf(Dialog::class, $dialog); + + Event::assertDispatched(DocuWareResponseLog::class); +}); diff --git a/tests/Feature/DialogsTest.php b/tests/Feature/Requests/Dialogs/GetDialogsRequestTest.php similarity index 77% rename from tests/Feature/DialogsTest.php rename to tests/Feature/Requests/Dialogs/GetDialogsRequestTest.php index aa8dde2..5ac62d8 100644 --- a/tests/Feature/DialogsTest.php +++ b/tests/Feature/Requests/Dialogs/GetDialogsRequestTest.php @@ -26,19 +26,6 @@ $this->connector = new DocuWareStaticConnector($config); }); -it('can get a dialog', function () { - Event::fake(); - - $fileCabinetId = config('docuware.tests.file_cabinet_id'); - $dialogId = config('docuware.tests.dialog_id'); - - $dialog = $this->connector->send(new GetDialogRequest($fileCabinetId, $dialogId))->dto(); - - $this->assertInstanceOf(Dialog::class, $dialog); - - Event::assertDispatched(DocuWareResponseLog::class); -}); - it('can list dialogs for a file cabinet', function () { Event::fake(); diff --git a/tests/Feature/Requests/Document/GetDocumentCountRequestTest.php b/tests/Feature/Requests/Document/GetDocumentCountRequestTest.php new file mode 100644 index 0000000..8dbcc33 --- /dev/null +++ b/tests/Feature/Requests/Document/GetDocumentCountRequestTest.php @@ -0,0 +1,61 @@ +group('docuware'); + +beforeEach(function () { + EnsureValidCookie::check(); + + $config = Config::make([ + 'url' => config('docuware.credentials.url'), + 'cookie' => config('docuware.cookies'), + 'cache_driver' => config('docuware.configurations.cache.driver'), + 'cache_lifetime_in_seconds' => config('docuware.configurations.cache.lifetime_in_seconds'), + 'request_timeout_in_seconds' => config('docuware.timeout'), + ]); + + $this->connector = new DocuWareStaticConnector($config); +}); + +it('can get a total count of documents', function () { + Event::fake(); + + $fileCabinetId = config('docuware.tests.file_cabinet_id'); + $dialogId = config('docuware.tests.dialog_id'); + + $document = $this->connector->send(new PostDocumentRequest( + $fileCabinetId, + '::fake-file-content::', + 'example.txt' + ))->dto(); + + $count = $this->connector->send(new GetDocumentCountRequest( + $fileCabinetId, + $dialogId + ))->dto(); + + $this->assertSame(1, $count); + Event::assertDispatched(DocuWareResponseLog::class); + + $this->connector->send(new DeleteDocumentRequest( + $fileCabinetId, + $document->id + ))->dto(); +}); diff --git a/tests/Feature/Requests/Document/GetDocumentDownloadRequestTest.php b/tests/Feature/Requests/Document/GetDocumentDownloadRequestTest.php new file mode 100644 index 0000000..c2dff4a --- /dev/null +++ b/tests/Feature/Requests/Document/GetDocumentDownloadRequestTest.php @@ -0,0 +1,60 @@ +group('docuware'); + +beforeEach(function () { + EnsureValidCookie::check(); + + $config = Config::make([ + 'url' => config('docuware.credentials.url'), + 'cookie' => config('docuware.cookies'), + 'cache_driver' => config('docuware.configurations.cache.driver'), + 'cache_lifetime_in_seconds' => config('docuware.configurations.cache.lifetime_in_seconds'), + 'request_timeout_in_seconds' => config('docuware.timeout'), + ]); + + $this->connector = new DocuWareStaticConnector($config); +}); + +it('can download a document', function () { + Event::fake(); + + $fileCabinetId = config('docuware.tests.file_cabinet_id'); + + $document = $this->connector->send(new PostDocumentRequest( + $fileCabinetId, + '::fake-file-content::', + 'example.txt' + ))->dto(); + + $contents = $this->connector->send(new GetDocumentDownloadRequest( + $fileCabinetId, + $document->id + ))->dto(); + + $this->assertSame(strlen('::fake-file-content::'), strlen($contents)); + Event::assertDispatched(DocuWareResponseLog::class); + + $this->connector->send(new DeleteDocumentRequest( + $fileCabinetId, + $document->id + ))->dto(); +}); diff --git a/tests/Feature/Requests/Document/GetDocumentPreviewRequestTest.php b/tests/Feature/Requests/Document/GetDocumentPreviewRequestTest.php new file mode 100644 index 0000000..5c027b1 --- /dev/null +++ b/tests/Feature/Requests/Document/GetDocumentPreviewRequestTest.php @@ -0,0 +1,57 @@ +group('docuware'); + +beforeEach(function () { + EnsureValidCookie::check(); + + $config = Config::make([ + 'url' => config('docuware.credentials.url'), + 'cookie' => config('docuware.cookies'), + 'cache_driver' => config('docuware.configurations.cache.driver'), + 'cache_lifetime_in_seconds' => config('docuware.configurations.cache.lifetime_in_seconds'), + 'request_timeout_in_seconds' => config('docuware.timeout'), + ]); + + $this->connector = new DocuWareStaticConnector($config); +}); + +it('can preview a document image', function () { + Event::fake(); + + $fileCabinetId = config('docuware.tests.file_cabinet_id'); + + $document = $this->connector->send(new PostDocumentRequest( + $fileCabinetId, + '::fake-file-content::', + 'example.txt' + ))->dto(); + + $image = $this->connector->send(new GetDocumentPreviewRequest($fileCabinetId, $document->id))->dto(); + + $this->assertSame(9221, strlen($image)); + Event::assertDispatched(DocuWareResponseLog::class); + + $this->connector->send(new DeleteDocumentRequest( + $fileCabinetId, + $document->id + ))->dto(); +}); diff --git a/tests/Feature/Requests/Document/GetDocumentRequestTest.php b/tests/Feature/Requests/Document/GetDocumentRequestTest.php new file mode 100644 index 0000000..a0d687d --- /dev/null +++ b/tests/Feature/Requests/Document/GetDocumentRequestTest.php @@ -0,0 +1,59 @@ +group('docuware'); + +beforeEach(function () { + EnsureValidCookie::check(); + + $config = Config::make([ + 'url' => config('docuware.credentials.url'), + 'cookie' => config('docuware.cookies'), + 'cache_driver' => config('docuware.configurations.cache.driver'), + 'cache_lifetime_in_seconds' => config('docuware.configurations.cache.lifetime_in_seconds'), + 'request_timeout_in_seconds' => config('docuware.timeout'), + ]); + + $this->connector = new DocuWareStaticConnector($config); +}); + +it('can show a document', function () { + Event::fake(); + + $fileCabinetId = config('docuware.tests.file_cabinet_id'); + + $document = $this->connector->send(new PostDocumentRequest( + $fileCabinetId, + '::fake-file-content::', + 'example.txt' + ))->dto(); + + $getdocument = $this->connector->send(new GetDocumentRequest($fileCabinetId, $document->id))->dto(); + + $this->assertInstanceOf(Document::class, $getdocument); + $this->assertSame($document->id, $getdocument->id); + $this->assertSame($fileCabinetId, $getdocument->file_cabinet_id); + Event::assertDispatched(DocuWareResponseLog::class); + + $this->connector->send(new DeleteDocumentRequest( + $fileCabinetId, + $document->id + ))->dto(); +}); diff --git a/tests/Feature/Requests/Document/GetDocumentsDownloadRequestTest.php b/tests/Feature/Requests/Document/GetDocumentsDownloadRequestTest.php new file mode 100644 index 0000000..b1a2850 --- /dev/null +++ b/tests/Feature/Requests/Document/GetDocumentsDownloadRequestTest.php @@ -0,0 +1,71 @@ +group('docuware'); + +beforeEach(function () { + EnsureValidCookie::check(); + + $config = Config::make([ + 'url' => config('docuware.credentials.url'), + 'cookie' => config('docuware.cookies'), + 'cache_driver' => config('docuware.configurations.cache.driver'), + 'cache_lifetime_in_seconds' => config('docuware.configurations.cache.lifetime_in_seconds'), + 'request_timeout_in_seconds' => config('docuware.timeout'), + ]); + + $this->connector = new DocuWareStaticConnector($config); +}); + +it('can download multiple documents', function () { + Event::fake(); + + $fileCabinetId = config('docuware.tests.file_cabinet_id'); + + $document1 = $this->connector->send(new PostDocumentRequest( + $fileCabinetId, + '::fake-file-content::', + 'example.txt' + ))->dto(); + + $document2 = $this->connector->send(new PostDocumentRequest( + $fileCabinetId, + '::fake-file-content::', + 'example.txt' + ))->dto(); + + $contents = $this->connector->send(new GetDocumentsDownloadRequest( + $fileCabinetId, + [$document1->id, $document2->id] + ))->dto(); + + $this->assertSame(478, strlen($contents)); + Event::assertDispatched(DocuWareResponseLog::class); + + $this->connector->send(new DeleteDocumentRequest( + $fileCabinetId, + $document1->id + ))->dto(); + + $this->connector->send(new DeleteDocumentRequest( + $fileCabinetId, + $document2->id + ))->dto(); +}); diff --git a/tests/Feature/Requests/Document/GetDocumentsRequestTest.php b/tests/Feature/Requests/Document/GetDocumentsRequestTest.php new file mode 100644 index 0000000..08ca02e --- /dev/null +++ b/tests/Feature/Requests/Document/GetDocumentsRequestTest.php @@ -0,0 +1,64 @@ +group('docuware'); + +beforeEach(function () { + EnsureValidCookie::check(); + + $config = Config::make([ + 'url' => config('docuware.credentials.url'), + 'cookie' => config('docuware.cookies'), + 'cache_driver' => config('docuware.configurations.cache.driver'), + 'cache_lifetime_in_seconds' => config('docuware.configurations.cache.lifetime_in_seconds'), + 'request_timeout_in_seconds' => config('docuware.timeout'), + ]); + + $this->connector = new DocuWareStaticConnector($config); +}); + +it('can get all documents', function () { + Event::fake(); + + $this->connector->send(new PostDocumentRequest( + config('docuware.tests.file_cabinet_id'), + '::fake-file-content::', + 'example.txt' + ))->dto(); + $this->connector->send(new PostDocumentRequest( + config('docuware.tests.file_cabinet_id'), + '::fake-file-content::', + 'example.txt' + ))->dto(); + + $documents = $this->connector->send(new GetDocumentsRequest( + config('docuware.tests.file_cabinet_id') + ))->dto(); + + foreach ($documents as $document) { + $this->assertInstanceOf(Document::class, $document); + $this->connector->send(new DeleteDocumentRequest( + config('docuware.tests.file_cabinet_id'), + $document->id, + ))->dto(); + } + + Event::assertDispatched(DocuWareResponseLog::class); +}); diff --git a/tests/Feature/Requests/Document/PostDocumentRequestTest.php b/tests/Feature/Requests/Document/PostDocumentRequestTest.php new file mode 100644 index 0000000..7a186e0 --- /dev/null +++ b/tests/Feature/Requests/Document/PostDocumentRequestTest.php @@ -0,0 +1,66 @@ +group('docuware'); + +beforeEach(function () { + EnsureValidCookie::check(); + + $config = Config::make([ + 'url' => config('docuware.credentials.url'), + 'cookie' => config('docuware.cookies'), + 'cache_driver' => config('docuware.configurations.cache.driver'), + 'cache_lifetime_in_seconds' => config('docuware.configurations.cache.lifetime_in_seconds'), + 'request_timeout_in_seconds' => config('docuware.timeout'), + ]); + + $this->connector = new DocuWareStaticConnector($config); +}); + +it('can upload document with index values and delete it', function () { + Event::fake(); + + $fileCabinetId = config('docuware.tests.file_cabinet_id'); + $fileContent = '::fake-file-content::'; + $fileName = 'example.txt'; + + $document = $this->connector->send(new PostDocumentRequest( + $fileCabinetId, + $fileContent, + $fileName, + collect([ + DocumentIndex::make('DOCUMENT_LABEL', '::text::'), + ]), + ))->dto(); + + $this->connector->send(new DeleteDocumentRequest( + $fileCabinetId, + $document->id, + ))->dto(); + + $this->assertInstanceOf(Document::class, $document); + $this->assertSame('example', $document->title); + tap($document->fields['DOCUMENT_LABEL'], function (DocumentField $field) { + $this->assertSame($field->name, 'DOCUMENT_LABEL'); + $this->assertSame($field->type, 'String'); + $this->assertSame($field->value, '::text::'); + }); + Event::assertDispatched(DocuWareResponseLog::class); +}); diff --git a/tests/Feature/Requests/Document/PutDocumentFieldsRequestTest.php b/tests/Feature/Requests/Document/PutDocumentFieldsRequestTest.php new file mode 100644 index 0000000..ca6c0db --- /dev/null +++ b/tests/Feature/Requests/Document/PutDocumentFieldsRequestTest.php @@ -0,0 +1,95 @@ +group('docuware'); + +beforeEach(function () { + EnsureValidCookie::check(); + + $config = Config::make([ + 'url' => config('docuware.credentials.url'), + 'cookie' => config('docuware.cookies'), + 'cache_driver' => config('docuware.configurations.cache.driver'), + 'cache_lifetime_in_seconds' => config('docuware.configurations.cache.lifetime_in_seconds'), + 'request_timeout_in_seconds' => config('docuware.timeout'), + ]); + + $this->connector = new DocuWareStaticConnector($config); +}); + +it('can update a document value', function () { + Event::fake(); + + $fileCabinetId = config('docuware.tests.file_cabinet_id'); + $newValue = 'laravel-docuware'; + + $document = $this->connector->send(new PostDocumentRequest( + $fileCabinetId, + '::fake-file-content::', + 'example.txt' + ))->dto(); + + $response = $this->connector->send(new PutDocumentFieldsRequest( + $fileCabinetId, + $document->id, + ['UUID' => $newValue] + ))->dto(); + + $this->assertSame('laravel-docuware', $response['UUID']); + Event::assertDispatched(DocuWareResponseLog::class); + + $this->connector->send(new DeleteDocumentRequest( + $fileCabinetId, + $document->id + ))->dto(); +}); + +it('can update multiple document values', function () { + Event::fake(); + + $fileCabinetId = config('docuware.tests.file_cabinet_id'); + $values = [ + 'UUID' => 'laravel-docuware', + 'DOCUMENT_LABEL' => 'laravel-docuware-2', + ]; + + $document = $this->connector->send(new PostDocumentRequest( + $fileCabinetId, + '::fake-file-content::', + 'example.txt' + ))->dto(); + + $response = $this->connector->send(new PutDocumentFieldsRequest( + $fileCabinetId, + $document->id, + $values, + true + ))->dto(); + + $this->assertSame('laravel-docuware', $response['UUID']); + $this->assertSame('laravel-docuware-2', $response['DOCUMENT_LABEL']); + + Event::assertDispatched(DocuWareResponseLog::class); + + $this->connector->send(new DeleteDocumentRequest( + $fileCabinetId, + $document->id + ))->dto(); +}); diff --git a/tests/Feature/ThumbnailTest.php b/tests/Feature/Requests/Document/Thumbnail/GetDocumentDownloadThumbnailRequestTest.php similarity index 100% rename from tests/Feature/ThumbnailTest.php rename to tests/Feature/Requests/Document/Thumbnail/GetDocumentDownloadThumbnailRequestTest.php diff --git a/tests/Feature/FieldsTest.php b/tests/Feature/Requests/Fields/GetFieldsRequestTest.php similarity index 100% rename from tests/Feature/FieldsTest.php rename to tests/Feature/Requests/Fields/GetFieldsRequestTest.php diff --git a/tests/Feature/FileCabinetsTests.php b/tests/Feature/Requests/FileCabinets/GetFileCabinetsRequestTests.php similarity index 100% rename from tests/Feature/FileCabinetsTests.php rename to tests/Feature/Requests/FileCabinets/GetFileCabinetsRequestTests.php diff --git a/tests/Feature/OrganizationTest.php b/tests/Feature/Requests/Organization/GetOrganizationRequestTest.php similarity index 80% rename from tests/Feature/OrganizationTest.php rename to tests/Feature/Requests/Organization/GetOrganizationRequestTest.php index 6dafc68..1ca40e6 100644 --- a/tests/Feature/OrganizationTest.php +++ b/tests/Feature/Requests/Organization/GetOrganizationRequestTest.php @@ -26,16 +26,6 @@ $this->connector = new DocuWareStaticConnector($config); }); -it('can list organizations', function () { - Event::fake(); - - $organizations = $this->connector->send(new GetOrganizationsRequest())->dto(); - - $this->assertInstanceOf(Collection::class, $organizations); - $this->assertNotCount(0, $organizations); - Event::assertDispatched(DocuWareResponseLog::class); -}); - it('can get an organization', function () { Event::fake(); diff --git a/tests/Feature/Requests/Organization/GetOrganizationsRequestTest.php b/tests/Feature/Requests/Organization/GetOrganizationsRequestTest.php new file mode 100644 index 0000000..767648e --- /dev/null +++ b/tests/Feature/Requests/Organization/GetOrganizationsRequestTest.php @@ -0,0 +1,37 @@ +group('docuware'); + +beforeEach(function () { + EnsureValidCookie::check(); + + $config = Config::make([ + 'url' => config('docuware.credentials.url'), + 'cookie' => config('docuware.cookies'), + 'cache_driver' => config('docuware.configurations.cache.driver'), + 'cache_lifetime_in_seconds' => config('docuware.configurations.cache.lifetime_in_seconds'), + 'request_timeout_in_seconds' => config('docuware.timeout'), + ]); + + $this->connector = new DocuWareStaticConnector($config); +}); + +it('can list organizations', function () { + Event::fake(); + + $organizations = $this->connector->send(new GetOrganizationsRequest())->dto(); + + $this->assertInstanceOf(Collection::class, $organizations); + $this->assertNotCount(0, $organizations); + Event::assertDispatched(DocuWareResponseLog::class); +}); diff --git a/tests/Feature/SearchTest.php b/tests/Feature/Requests/Search/GetSearchRequestTest.php similarity index 100% rename from tests/Feature/SearchTest.php rename to tests/Feature/Requests/Search/GetSearchRequestTest.php diff --git a/tests/Feature/SelectListTest.php b/tests/Feature/Requests/SelectList/SelectListTest.php similarity index 100% rename from tests/Feature/SelectListTest.php rename to tests/Feature/Requests/SelectList/SelectListTest.php From 96994ab4e33bb8887cc86c627bf50ceb92fdfc51 Mon Sep 17 00:00:00 2001 From: Rhys Lees <43909932+RhysLees@users.noreply.github.com> Date: Thu, 12 Oct 2023 23:56:17 +0100 Subject: [PATCH 4/8] Fix Tests --- ...eCabinetsRequestTests.php => GetFileCabinetsRequestTest.php} | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) rename tests/Feature/Requests/FileCabinets/{GetFileCabinetsRequestTests.php => GetFileCabinetsRequestTest.php} (99%) diff --git a/tests/Feature/Requests/FileCabinets/GetFileCabinetsRequestTests.php b/tests/Feature/Requests/FileCabinets/GetFileCabinetsRequestTest.php similarity index 99% rename from tests/Feature/Requests/FileCabinets/GetFileCabinetsRequestTests.php rename to tests/Feature/Requests/FileCabinets/GetFileCabinetsRequestTest.php index da6703c..841d9f9 100644 --- a/tests/Feature/Requests/FileCabinets/GetFileCabinetsRequestTests.php +++ b/tests/Feature/Requests/FileCabinets/GetFileCabinetsRequestTest.php @@ -34,4 +34,4 @@ $this->assertNotCount(0, $fileCabinets); Event::assertDispatched(DocuWareResponseLog::class); -})->only(); +}); From 4443a8a837b42cfd9aa728c9eec478468bf1873b Mon Sep 17 00:00:00 2001 From: RhysLees Date: Thu, 12 Oct 2023 22:56:45 +0000 Subject: [PATCH 5/8] Fix styling --- tests/Feature/Requests/Dialogs/GetDialogRequestTest.php | 2 -- tests/Feature/Requests/Dialogs/GetDialogsRequestTest.php | 2 -- .../Requests/Document/GetDocumentCountRequestTest.php | 9 --------- .../Requests/Document/GetDocumentDownloadRequestTest.php | 9 --------- .../Requests/Document/GetDocumentPreviewRequestTest.php | 9 --------- .../Feature/Requests/Document/GetDocumentRequestTest.php | 8 -------- .../Document/GetDocumentsDownloadRequestTest.php | 9 --------- .../Requests/Document/GetDocumentsRequestTest.php | 8 -------- .../Requests/Document/PostDocumentRequestTest.php | 7 ------- .../Requests/Document/PutDocumentFieldsRequestTest.php | 9 --------- .../Requests/Organization/GetOrganizationRequestTest.php | 2 -- .../Organization/GetOrganizationsRequestTest.php | 2 -- 12 files changed, 76 deletions(-) diff --git a/tests/Feature/Requests/Dialogs/GetDialogRequestTest.php b/tests/Feature/Requests/Dialogs/GetDialogRequestTest.php index d5c3ae5..a0c81c8 100644 --- a/tests/Feature/Requests/Dialogs/GetDialogRequestTest.php +++ b/tests/Feature/Requests/Dialogs/GetDialogRequestTest.php @@ -5,9 +5,7 @@ use CodebarAg\DocuWare\DTO\Dialog; use CodebarAg\DocuWare\Events\DocuWareResponseLog; use CodebarAg\DocuWare\Requests\Dialogs\GetDialogRequest; -use CodebarAg\DocuWare\Requests\Dialogs\GetDialogsRequest; use CodebarAg\DocuWare\Support\EnsureValidCookie; -use Illuminate\Support\Collection; use Illuminate\Support\Facades\Event; uses()->group('docuware'); diff --git a/tests/Feature/Requests/Dialogs/GetDialogsRequestTest.php b/tests/Feature/Requests/Dialogs/GetDialogsRequestTest.php index 5ac62d8..dbf10bc 100644 --- a/tests/Feature/Requests/Dialogs/GetDialogsRequestTest.php +++ b/tests/Feature/Requests/Dialogs/GetDialogsRequestTest.php @@ -2,9 +2,7 @@ use CodebarAg\DocuWare\Connectors\DocuWareStaticConnector; use CodebarAg\DocuWare\DTO\Config; -use CodebarAg\DocuWare\DTO\Dialog; use CodebarAg\DocuWare\Events\DocuWareResponseLog; -use CodebarAg\DocuWare\Requests\Dialogs\GetDialogRequest; use CodebarAg\DocuWare\Requests\Dialogs\GetDialogsRequest; use CodebarAg\DocuWare\Support\EnsureValidCookie; use Illuminate\Support\Collection; diff --git a/tests/Feature/Requests/Document/GetDocumentCountRequestTest.php b/tests/Feature/Requests/Document/GetDocumentCountRequestTest.php index 8dbcc33..f482e09 100644 --- a/tests/Feature/Requests/Document/GetDocumentCountRequestTest.php +++ b/tests/Feature/Requests/Document/GetDocumentCountRequestTest.php @@ -2,19 +2,10 @@ use CodebarAg\DocuWare\Connectors\DocuWareStaticConnector; use CodebarAg\DocuWare\DTO\Config; -use CodebarAg\DocuWare\DTO\Document; -use CodebarAg\DocuWare\DTO\DocumentField; -use CodebarAg\DocuWare\DTO\DocumentIndex; use CodebarAg\DocuWare\Events\DocuWareResponseLog; use CodebarAg\DocuWare\Requests\Document\DeleteDocumentRequest; use CodebarAg\DocuWare\Requests\Document\GetDocumentCountRequest; -use CodebarAg\DocuWare\Requests\Document\GetDocumentDownloadRequest; -use CodebarAg\DocuWare\Requests\Document\GetDocumentPreviewRequest; -use CodebarAg\DocuWare\Requests\Document\GetDocumentRequest; -use CodebarAg\DocuWare\Requests\Document\GetDocumentsDownloadRequest; -use CodebarAg\DocuWare\Requests\Document\GetDocumentsRequest; use CodebarAg\DocuWare\Requests\Document\PostDocumentRequest; -use CodebarAg\DocuWare\Requests\Document\PutDocumentFieldsRequest; use CodebarAg\DocuWare\Support\EnsureValidCookie; use Illuminate\Support\Facades\Event; diff --git a/tests/Feature/Requests/Document/GetDocumentDownloadRequestTest.php b/tests/Feature/Requests/Document/GetDocumentDownloadRequestTest.php index c2dff4a..25eab82 100644 --- a/tests/Feature/Requests/Document/GetDocumentDownloadRequestTest.php +++ b/tests/Feature/Requests/Document/GetDocumentDownloadRequestTest.php @@ -2,19 +2,10 @@ use CodebarAg\DocuWare\Connectors\DocuWareStaticConnector; use CodebarAg\DocuWare\DTO\Config; -use CodebarAg\DocuWare\DTO\Document; -use CodebarAg\DocuWare\DTO\DocumentField; -use CodebarAg\DocuWare\DTO\DocumentIndex; use CodebarAg\DocuWare\Events\DocuWareResponseLog; use CodebarAg\DocuWare\Requests\Document\DeleteDocumentRequest; -use CodebarAg\DocuWare\Requests\Document\GetDocumentCountRequest; use CodebarAg\DocuWare\Requests\Document\GetDocumentDownloadRequest; -use CodebarAg\DocuWare\Requests\Document\GetDocumentPreviewRequest; -use CodebarAg\DocuWare\Requests\Document\GetDocumentRequest; -use CodebarAg\DocuWare\Requests\Document\GetDocumentsDownloadRequest; -use CodebarAg\DocuWare\Requests\Document\GetDocumentsRequest; use CodebarAg\DocuWare\Requests\Document\PostDocumentRequest; -use CodebarAg\DocuWare\Requests\Document\PutDocumentFieldsRequest; use CodebarAg\DocuWare\Support\EnsureValidCookie; use Illuminate\Support\Facades\Event; diff --git a/tests/Feature/Requests/Document/GetDocumentPreviewRequestTest.php b/tests/Feature/Requests/Document/GetDocumentPreviewRequestTest.php index 5c027b1..7a9bb68 100644 --- a/tests/Feature/Requests/Document/GetDocumentPreviewRequestTest.php +++ b/tests/Feature/Requests/Document/GetDocumentPreviewRequestTest.php @@ -2,19 +2,10 @@ use CodebarAg\DocuWare\Connectors\DocuWareStaticConnector; use CodebarAg\DocuWare\DTO\Config; -use CodebarAg\DocuWare\DTO\Document; -use CodebarAg\DocuWare\DTO\DocumentField; -use CodebarAg\DocuWare\DTO\DocumentIndex; use CodebarAg\DocuWare\Events\DocuWareResponseLog; use CodebarAg\DocuWare\Requests\Document\DeleteDocumentRequest; -use CodebarAg\DocuWare\Requests\Document\GetDocumentCountRequest; -use CodebarAg\DocuWare\Requests\Document\GetDocumentDownloadRequest; use CodebarAg\DocuWare\Requests\Document\GetDocumentPreviewRequest; -use CodebarAg\DocuWare\Requests\Document\GetDocumentRequest; -use CodebarAg\DocuWare\Requests\Document\GetDocumentsDownloadRequest; -use CodebarAg\DocuWare\Requests\Document\GetDocumentsRequest; use CodebarAg\DocuWare\Requests\Document\PostDocumentRequest; -use CodebarAg\DocuWare\Requests\Document\PutDocumentFieldsRequest; use CodebarAg\DocuWare\Support\EnsureValidCookie; use Illuminate\Support\Facades\Event; diff --git a/tests/Feature/Requests/Document/GetDocumentRequestTest.php b/tests/Feature/Requests/Document/GetDocumentRequestTest.php index a0d687d..b8875d5 100644 --- a/tests/Feature/Requests/Document/GetDocumentRequestTest.php +++ b/tests/Feature/Requests/Document/GetDocumentRequestTest.php @@ -3,18 +3,10 @@ use CodebarAg\DocuWare\Connectors\DocuWareStaticConnector; use CodebarAg\DocuWare\DTO\Config; use CodebarAg\DocuWare\DTO\Document; -use CodebarAg\DocuWare\DTO\DocumentField; -use CodebarAg\DocuWare\DTO\DocumentIndex; use CodebarAg\DocuWare\Events\DocuWareResponseLog; use CodebarAg\DocuWare\Requests\Document\DeleteDocumentRequest; -use CodebarAg\DocuWare\Requests\Document\GetDocumentCountRequest; -use CodebarAg\DocuWare\Requests\Document\GetDocumentDownloadRequest; -use CodebarAg\DocuWare\Requests\Document\GetDocumentPreviewRequest; use CodebarAg\DocuWare\Requests\Document\GetDocumentRequest; -use CodebarAg\DocuWare\Requests\Document\GetDocumentsDownloadRequest; -use CodebarAg\DocuWare\Requests\Document\GetDocumentsRequest; use CodebarAg\DocuWare\Requests\Document\PostDocumentRequest; -use CodebarAg\DocuWare\Requests\Document\PutDocumentFieldsRequest; use CodebarAg\DocuWare\Support\EnsureValidCookie; use Illuminate\Support\Facades\Event; diff --git a/tests/Feature/Requests/Document/GetDocumentsDownloadRequestTest.php b/tests/Feature/Requests/Document/GetDocumentsDownloadRequestTest.php index b1a2850..c86cb15 100644 --- a/tests/Feature/Requests/Document/GetDocumentsDownloadRequestTest.php +++ b/tests/Feature/Requests/Document/GetDocumentsDownloadRequestTest.php @@ -2,19 +2,10 @@ use CodebarAg\DocuWare\Connectors\DocuWareStaticConnector; use CodebarAg\DocuWare\DTO\Config; -use CodebarAg\DocuWare\DTO\Document; -use CodebarAg\DocuWare\DTO\DocumentField; -use CodebarAg\DocuWare\DTO\DocumentIndex; use CodebarAg\DocuWare\Events\DocuWareResponseLog; use CodebarAg\DocuWare\Requests\Document\DeleteDocumentRequest; -use CodebarAg\DocuWare\Requests\Document\GetDocumentCountRequest; -use CodebarAg\DocuWare\Requests\Document\GetDocumentDownloadRequest; -use CodebarAg\DocuWare\Requests\Document\GetDocumentPreviewRequest; -use CodebarAg\DocuWare\Requests\Document\GetDocumentRequest; use CodebarAg\DocuWare\Requests\Document\GetDocumentsDownloadRequest; -use CodebarAg\DocuWare\Requests\Document\GetDocumentsRequest; use CodebarAg\DocuWare\Requests\Document\PostDocumentRequest; -use CodebarAg\DocuWare\Requests\Document\PutDocumentFieldsRequest; use CodebarAg\DocuWare\Support\EnsureValidCookie; use Illuminate\Support\Facades\Event; diff --git a/tests/Feature/Requests/Document/GetDocumentsRequestTest.php b/tests/Feature/Requests/Document/GetDocumentsRequestTest.php index 08ca02e..03a3da7 100644 --- a/tests/Feature/Requests/Document/GetDocumentsRequestTest.php +++ b/tests/Feature/Requests/Document/GetDocumentsRequestTest.php @@ -3,18 +3,10 @@ use CodebarAg\DocuWare\Connectors\DocuWareStaticConnector; use CodebarAg\DocuWare\DTO\Config; use CodebarAg\DocuWare\DTO\Document; -use CodebarAg\DocuWare\DTO\DocumentField; -use CodebarAg\DocuWare\DTO\DocumentIndex; use CodebarAg\DocuWare\Events\DocuWareResponseLog; use CodebarAg\DocuWare\Requests\Document\DeleteDocumentRequest; -use CodebarAg\DocuWare\Requests\Document\GetDocumentCountRequest; -use CodebarAg\DocuWare\Requests\Document\GetDocumentDownloadRequest; -use CodebarAg\DocuWare\Requests\Document\GetDocumentPreviewRequest; -use CodebarAg\DocuWare\Requests\Document\GetDocumentRequest; -use CodebarAg\DocuWare\Requests\Document\GetDocumentsDownloadRequest; use CodebarAg\DocuWare\Requests\Document\GetDocumentsRequest; use CodebarAg\DocuWare\Requests\Document\PostDocumentRequest; -use CodebarAg\DocuWare\Requests\Document\PutDocumentFieldsRequest; use CodebarAg\DocuWare\Support\EnsureValidCookie; use Illuminate\Support\Facades\Event; diff --git a/tests/Feature/Requests/Document/PostDocumentRequestTest.php b/tests/Feature/Requests/Document/PostDocumentRequestTest.php index 7a186e0..be6ea86 100644 --- a/tests/Feature/Requests/Document/PostDocumentRequestTest.php +++ b/tests/Feature/Requests/Document/PostDocumentRequestTest.php @@ -7,14 +7,7 @@ use CodebarAg\DocuWare\DTO\DocumentIndex; use CodebarAg\DocuWare\Events\DocuWareResponseLog; use CodebarAg\DocuWare\Requests\Document\DeleteDocumentRequest; -use CodebarAg\DocuWare\Requests\Document\GetDocumentCountRequest; -use CodebarAg\DocuWare\Requests\Document\GetDocumentDownloadRequest; -use CodebarAg\DocuWare\Requests\Document\GetDocumentPreviewRequest; -use CodebarAg\DocuWare\Requests\Document\GetDocumentRequest; -use CodebarAg\DocuWare\Requests\Document\GetDocumentsDownloadRequest; -use CodebarAg\DocuWare\Requests\Document\GetDocumentsRequest; use CodebarAg\DocuWare\Requests\Document\PostDocumentRequest; -use CodebarAg\DocuWare\Requests\Document\PutDocumentFieldsRequest; use CodebarAg\DocuWare\Support\EnsureValidCookie; use Illuminate\Support\Facades\Event; diff --git a/tests/Feature/Requests/Document/PutDocumentFieldsRequestTest.php b/tests/Feature/Requests/Document/PutDocumentFieldsRequestTest.php index ca6c0db..2e1afe3 100644 --- a/tests/Feature/Requests/Document/PutDocumentFieldsRequestTest.php +++ b/tests/Feature/Requests/Document/PutDocumentFieldsRequestTest.php @@ -2,17 +2,8 @@ use CodebarAg\DocuWare\Connectors\DocuWareStaticConnector; use CodebarAg\DocuWare\DTO\Config; -use CodebarAg\DocuWare\DTO\Document; -use CodebarAg\DocuWare\DTO\DocumentField; -use CodebarAg\DocuWare\DTO\DocumentIndex; use CodebarAg\DocuWare\Events\DocuWareResponseLog; use CodebarAg\DocuWare\Requests\Document\DeleteDocumentRequest; -use CodebarAg\DocuWare\Requests\Document\GetDocumentCountRequest; -use CodebarAg\DocuWare\Requests\Document\GetDocumentDownloadRequest; -use CodebarAg\DocuWare\Requests\Document\GetDocumentPreviewRequest; -use CodebarAg\DocuWare\Requests\Document\GetDocumentRequest; -use CodebarAg\DocuWare\Requests\Document\GetDocumentsDownloadRequest; -use CodebarAg\DocuWare\Requests\Document\GetDocumentsRequest; use CodebarAg\DocuWare\Requests\Document\PostDocumentRequest; use CodebarAg\DocuWare\Requests\Document\PutDocumentFieldsRequest; use CodebarAg\DocuWare\Support\EnsureValidCookie; diff --git a/tests/Feature/Requests/Organization/GetOrganizationRequestTest.php b/tests/Feature/Requests/Organization/GetOrganizationRequestTest.php index 1ca40e6..6bf6201 100644 --- a/tests/Feature/Requests/Organization/GetOrganizationRequestTest.php +++ b/tests/Feature/Requests/Organization/GetOrganizationRequestTest.php @@ -5,9 +5,7 @@ use CodebarAg\DocuWare\DTO\Organization; use CodebarAg\DocuWare\Events\DocuWareResponseLog; use CodebarAg\DocuWare\Requests\Organization\GetOrganizationRequest; -use CodebarAg\DocuWare\Requests\Organization\GetOrganizationsRequest; use CodebarAg\DocuWare\Support\EnsureValidCookie; -use Illuminate\Support\Collection; use Illuminate\Support\Facades\Event; uses()->group('docuware'); diff --git a/tests/Feature/Requests/Organization/GetOrganizationsRequestTest.php b/tests/Feature/Requests/Organization/GetOrganizationsRequestTest.php index 767648e..6c2534a 100644 --- a/tests/Feature/Requests/Organization/GetOrganizationsRequestTest.php +++ b/tests/Feature/Requests/Organization/GetOrganizationsRequestTest.php @@ -2,9 +2,7 @@ use CodebarAg\DocuWare\Connectors\DocuWareStaticConnector; use CodebarAg\DocuWare\DTO\Config; -use CodebarAg\DocuWare\DTO\Organization; use CodebarAg\DocuWare\Events\DocuWareResponseLog; -use CodebarAg\DocuWare\Requests\Organization\GetOrganizationRequest; use CodebarAg\DocuWare\Requests\Organization\GetOrganizationsRequest; use CodebarAg\DocuWare\Support\EnsureValidCookie; use Illuminate\Support\Collection; From fed06d91e26312835d36538058232bbb73bb4a88 Mon Sep 17 00:00:00 2001 From: Rhys Lees <43909932+RhysLees@users.noreply.github.com> Date: Fri, 13 Oct 2023 00:06:25 +0100 Subject: [PATCH 6/8] Fix Tests --- .../SelectList/{SelectListTest.php => GetSelectListRequest.php} | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename tests/Feature/Requests/SelectList/{SelectListTest.php => GetSelectListRequest.php} (100%) diff --git a/tests/Feature/Requests/SelectList/SelectListTest.php b/tests/Feature/Requests/SelectList/GetSelectListRequest.php similarity index 100% rename from tests/Feature/Requests/SelectList/SelectListTest.php rename to tests/Feature/Requests/SelectList/GetSelectListRequest.php From f388f1aa6753ba27d5607978940f704531f91bc5 Mon Sep 17 00:00:00 2001 From: Rhys Lees <43909932+RhysLees@users.noreply.github.com> Date: Fri, 13 Oct 2023 12:15:08 +0100 Subject: [PATCH 7/8] Dto checks --- tests/Feature/Requests/Dialogs/GetDialogsRequestTest.php | 7 +++++++ .../Requests/Document/GetDocumentCountRequestTest.php | 4 ++++ tests/Feature/Requests/Document/GetDocumentRequestTest.php | 1 + .../Feature/Requests/Document/GetDocumentsRequestTest.php | 1 + .../Feature/Requests/Document/PostDocumentRequestTest.php | 1 + .../Requests/Document/PutDocumentFieldsRequestTest.php | 3 +++ .../Thumbnail/GetDocumentDownloadThumbnailRequestTest.php | 4 ++++ tests/Feature/Requests/Fields/GetFieldsRequestTest.php | 7 +++++++ .../Requests/FileCabinets/GetFileCabinetsRequestTest.php | 6 ++++++ .../Requests/Organization/GetOrganizationsRequestTest.php | 6 ++++++ 10 files changed, 40 insertions(+) diff --git a/tests/Feature/Requests/Dialogs/GetDialogsRequestTest.php b/tests/Feature/Requests/Dialogs/GetDialogsRequestTest.php index dbf10bc..f070a6b 100644 --- a/tests/Feature/Requests/Dialogs/GetDialogsRequestTest.php +++ b/tests/Feature/Requests/Dialogs/GetDialogsRequestTest.php @@ -2,6 +2,7 @@ use CodebarAg\DocuWare\Connectors\DocuWareStaticConnector; use CodebarAg\DocuWare\DTO\Config; +use CodebarAg\DocuWare\DTO\Dialog; use CodebarAg\DocuWare\Events\DocuWareResponseLog; use CodebarAg\DocuWare\Requests\Dialogs\GetDialogsRequest; use CodebarAg\DocuWare\Support\EnsureValidCookie; @@ -32,6 +33,12 @@ $dialogs = $this->connector->send(new GetDialogsRequest($fileCabinetId))->dto(); $this->assertInstanceOf(Collection::class, $dialogs); + $this->assertNotCount(0, $dialogs); + + foreach ($dialogs as $dialog) { + $this->assertInstanceOf(Dialog::class, $dialog); + } + Event::assertDispatched(DocuWareResponseLog::class); }); diff --git a/tests/Feature/Requests/Document/GetDocumentCountRequestTest.php b/tests/Feature/Requests/Document/GetDocumentCountRequestTest.php index f482e09..f1147f7 100644 --- a/tests/Feature/Requests/Document/GetDocumentCountRequestTest.php +++ b/tests/Feature/Requests/Document/GetDocumentCountRequestTest.php @@ -42,7 +42,11 @@ $dialogId ))->dto(); + + $this->assertIsInt($count); + $this->assertSame(1, $count); + Event::assertDispatched(DocuWareResponseLog::class); $this->connector->send(new DeleteDocumentRequest( diff --git a/tests/Feature/Requests/Document/GetDocumentRequestTest.php b/tests/Feature/Requests/Document/GetDocumentRequestTest.php index b8875d5..bfb56c5 100644 --- a/tests/Feature/Requests/Document/GetDocumentRequestTest.php +++ b/tests/Feature/Requests/Document/GetDocumentRequestTest.php @@ -40,6 +40,7 @@ $getdocument = $this->connector->send(new GetDocumentRequest($fileCabinetId, $document->id))->dto(); $this->assertInstanceOf(Document::class, $getdocument); + $this->assertSame($document->id, $getdocument->id); $this->assertSame($fileCabinetId, $getdocument->file_cabinet_id); Event::assertDispatched(DocuWareResponseLog::class); diff --git a/tests/Feature/Requests/Document/GetDocumentsRequestTest.php b/tests/Feature/Requests/Document/GetDocumentsRequestTest.php index 03a3da7..6f66af4 100644 --- a/tests/Feature/Requests/Document/GetDocumentsRequestTest.php +++ b/tests/Feature/Requests/Document/GetDocumentsRequestTest.php @@ -46,6 +46,7 @@ foreach ($documents as $document) { $this->assertInstanceOf(Document::class, $document); + $this->connector->send(new DeleteDocumentRequest( config('docuware.tests.file_cabinet_id'), $document->id, diff --git a/tests/Feature/Requests/Document/PostDocumentRequestTest.php b/tests/Feature/Requests/Document/PostDocumentRequestTest.php index be6ea86..dfc5d18 100644 --- a/tests/Feature/Requests/Document/PostDocumentRequestTest.php +++ b/tests/Feature/Requests/Document/PostDocumentRequestTest.php @@ -49,6 +49,7 @@ ))->dto(); $this->assertInstanceOf(Document::class, $document); + $this->assertSame('example', $document->title); tap($document->fields['DOCUMENT_LABEL'], function (DocumentField $field) { $this->assertSame($field->name, 'DOCUMENT_LABEL'); diff --git a/tests/Feature/Requests/Document/PutDocumentFieldsRequestTest.php b/tests/Feature/Requests/Document/PutDocumentFieldsRequestTest.php index 2e1afe3..784d658 100644 --- a/tests/Feature/Requests/Document/PutDocumentFieldsRequestTest.php +++ b/tests/Feature/Requests/Document/PutDocumentFieldsRequestTest.php @@ -7,6 +7,7 @@ use CodebarAg\DocuWare\Requests\Document\PostDocumentRequest; use CodebarAg\DocuWare\Requests\Document\PutDocumentFieldsRequest; use CodebarAg\DocuWare\Support\EnsureValidCookie; +use Illuminate\Support\Collection; use Illuminate\Support\Facades\Event; uses()->group('docuware'); @@ -74,6 +75,8 @@ true ))->dto(); + $this->assertInstanceOf(Collection::class, $response); + $this->assertSame('laravel-docuware', $response['UUID']); $this->assertSame('laravel-docuware-2', $response['DOCUMENT_LABEL']); diff --git a/tests/Feature/Requests/Document/Thumbnail/GetDocumentDownloadThumbnailRequestTest.php b/tests/Feature/Requests/Document/Thumbnail/GetDocumentDownloadThumbnailRequestTest.php index 8cb0d14..f267abd 100644 --- a/tests/Feature/Requests/Document/Thumbnail/GetDocumentDownloadThumbnailRequestTest.php +++ b/tests/Feature/Requests/Document/Thumbnail/GetDocumentDownloadThumbnailRequestTest.php @@ -2,6 +2,7 @@ use CodebarAg\DocuWare\Connectors\DocuWareStaticConnector; use CodebarAg\DocuWare\DTO\Config; +use CodebarAg\DocuWare\DTO\DocumentThumbnail; use CodebarAg\DocuWare\Events\DocuWareResponseLog; use CodebarAg\DocuWare\Requests\Document\DeleteDocumentRequest; use CodebarAg\DocuWare\Requests\Document\PostDocumentRequest; @@ -44,6 +45,9 @@ $this->assertSame('image/png', $contents->mime); $this->assertSame(282, strlen($contents->data)); + + $this->assertInstanceOf(DocumentThumbnail::class, $contents); + Event::assertDispatched(DocuWareResponseLog::class); $this->connector->send(new DeleteDocumentRequest( diff --git a/tests/Feature/Requests/Fields/GetFieldsRequestTest.php b/tests/Feature/Requests/Fields/GetFieldsRequestTest.php index 81dc463..df32759 100644 --- a/tests/Feature/Requests/Fields/GetFieldsRequestTest.php +++ b/tests/Feature/Requests/Fields/GetFieldsRequestTest.php @@ -2,6 +2,7 @@ use CodebarAg\DocuWare\Connectors\DocuWareStaticConnector; use CodebarAg\DocuWare\DTO\Config; +use CodebarAg\DocuWare\DTO\Field; use CodebarAg\DocuWare\Events\DocuWareResponseLog; use CodebarAg\DocuWare\Requests\Fields\GetFieldsRequest; use CodebarAg\DocuWare\Support\EnsureValidCookie; @@ -32,6 +33,12 @@ $fields = $this->connector->send(new GetFieldsRequest($fileCabinetId))->dto(); $this->assertInstanceOf(Collection::class, $fields); + + foreach ($fields as $field){ + $this->assertInstanceOf(Field::class, $field); + } + $this->assertNotCount(0, $fields); + Event::assertDispatched(DocuWareResponseLog::class); }); diff --git a/tests/Feature/Requests/FileCabinets/GetFileCabinetsRequestTest.php b/tests/Feature/Requests/FileCabinets/GetFileCabinetsRequestTest.php index 841d9f9..4bfeceb 100644 --- a/tests/Feature/Requests/FileCabinets/GetFileCabinetsRequestTest.php +++ b/tests/Feature/Requests/FileCabinets/GetFileCabinetsRequestTest.php @@ -2,6 +2,7 @@ use CodebarAg\DocuWare\Connectors\DocuWareStaticConnector; use CodebarAg\DocuWare\DTO\Config; +use CodebarAg\DocuWare\DTO\FileCabinet; use CodebarAg\DocuWare\Events\DocuWareResponseLog; use CodebarAg\DocuWare\Requests\FileCabinets\GetFileCabinetsRequest; use CodebarAg\DocuWare\Support\EnsureValidCookie; @@ -31,6 +32,11 @@ $fileCabinets = $this->connector->send(new GetFileCabinetsRequest())->dto(); $this->assertInstanceOf(Collection::class, $fileCabinets); + + foreach ($fileCabinets as $fileCabinet){ + $this->assertInstanceOf(FileCabinet::class, $fileCabinet); + } + $this->assertNotCount(0, $fileCabinets); Event::assertDispatched(DocuWareResponseLog::class); diff --git a/tests/Feature/Requests/Organization/GetOrganizationsRequestTest.php b/tests/Feature/Requests/Organization/GetOrganizationsRequestTest.php index 6c2534a..7716115 100644 --- a/tests/Feature/Requests/Organization/GetOrganizationsRequestTest.php +++ b/tests/Feature/Requests/Organization/GetOrganizationsRequestTest.php @@ -2,6 +2,7 @@ use CodebarAg\DocuWare\Connectors\DocuWareStaticConnector; use CodebarAg\DocuWare\DTO\Config; +use CodebarAg\DocuWare\DTO\OrganizationIndex; use CodebarAg\DocuWare\Events\DocuWareResponseLog; use CodebarAg\DocuWare\Requests\Organization\GetOrganizationsRequest; use CodebarAg\DocuWare\Support\EnsureValidCookie; @@ -30,6 +31,11 @@ $organizations = $this->connector->send(new GetOrganizationsRequest())->dto(); $this->assertInstanceOf(Collection::class, $organizations); + + foreach ($organizations as $organization){ + $this->assertInstanceOf(OrganizationIndex::class, $organization); + } + $this->assertNotCount(0, $organizations); Event::assertDispatched(DocuWareResponseLog::class); }); From 99135bf3e458b3bc7dedde4e7b12685367e89319 Mon Sep 17 00:00:00 2001 From: RhysLees Date: Fri, 13 Oct 2023 11:15:39 +0000 Subject: [PATCH 8/8] Fix styling --- tests/Feature/Requests/Document/GetDocumentCountRequestTest.php | 1 - tests/Feature/Requests/Fields/GetFieldsRequestTest.php | 2 +- .../Requests/FileCabinets/GetFileCabinetsRequestTest.php | 2 +- .../Requests/Organization/GetOrganizationsRequestTest.php | 2 +- 4 files changed, 3 insertions(+), 4 deletions(-) diff --git a/tests/Feature/Requests/Document/GetDocumentCountRequestTest.php b/tests/Feature/Requests/Document/GetDocumentCountRequestTest.php index f1147f7..0b01843 100644 --- a/tests/Feature/Requests/Document/GetDocumentCountRequestTest.php +++ b/tests/Feature/Requests/Document/GetDocumentCountRequestTest.php @@ -42,7 +42,6 @@ $dialogId ))->dto(); - $this->assertIsInt($count); $this->assertSame(1, $count); diff --git a/tests/Feature/Requests/Fields/GetFieldsRequestTest.php b/tests/Feature/Requests/Fields/GetFieldsRequestTest.php index df32759..1c82e91 100644 --- a/tests/Feature/Requests/Fields/GetFieldsRequestTest.php +++ b/tests/Feature/Requests/Fields/GetFieldsRequestTest.php @@ -34,7 +34,7 @@ $this->assertInstanceOf(Collection::class, $fields); - foreach ($fields as $field){ + foreach ($fields as $field) { $this->assertInstanceOf(Field::class, $field); } diff --git a/tests/Feature/Requests/FileCabinets/GetFileCabinetsRequestTest.php b/tests/Feature/Requests/FileCabinets/GetFileCabinetsRequestTest.php index 4bfeceb..23354dd 100644 --- a/tests/Feature/Requests/FileCabinets/GetFileCabinetsRequestTest.php +++ b/tests/Feature/Requests/FileCabinets/GetFileCabinetsRequestTest.php @@ -33,7 +33,7 @@ $this->assertInstanceOf(Collection::class, $fileCabinets); - foreach ($fileCabinets as $fileCabinet){ + foreach ($fileCabinets as $fileCabinet) { $this->assertInstanceOf(FileCabinet::class, $fileCabinet); } diff --git a/tests/Feature/Requests/Organization/GetOrganizationsRequestTest.php b/tests/Feature/Requests/Organization/GetOrganizationsRequestTest.php index 7716115..974fd54 100644 --- a/tests/Feature/Requests/Organization/GetOrganizationsRequestTest.php +++ b/tests/Feature/Requests/Organization/GetOrganizationsRequestTest.php @@ -32,7 +32,7 @@ $this->assertInstanceOf(Collection::class, $organizations); - foreach ($organizations as $organization){ + foreach ($organizations as $organization) { $this->assertInstanceOf(OrganizationIndex::class, $organization); }