Skip to content

Commit 62dba58

Browse files
committed
Laravel 12 compatibility issues, Updated readme.md and fixed tests
1 parent d88dcb1 commit 62dba58

File tree

10 files changed

+72
-59
lines changed

10 files changed

+72
-59
lines changed

CHANGELOG.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
All notable changes to `laravel-docuware` will be documented in this file.
44

5-
## [Unreleased]
5+
## [v12.1.0]
66

77
### Laravel 12 Compatibility
88
- Updated cache configuration to use `CACHE_STORE` instead of deprecated `CACHE_DRIVER` for Laravel 12 compatibility

README.md

Lines changed: 35 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -149,13 +149,12 @@ then optimize the processes that power the core of your business.
149149

150150
| Version | PHP Version | Laravel Version | DocuWare Cloud Access |
151151
|---------------|-------------|-----------------|-----------------------|
152-
| v12.0 | ^8.2 - ^8.4 | 12.* ||
153-
| v11.0 (alpha) | ^8.2 | 11.* ||
154-
| > v4.0 | ^8.2 | 11.* ||
155-
| > v3.0 | ^8.2 | 10.* ||
156-
| > v2.0 | ^8.1 | 9.* ||
157-
| > v1.2 | ^8.1 | 9.* ||
158-
| < v1.2 | ^8.0 | 8.* ||
152+
| v2.0+ | ^8.2 - ^8.4 | 12.* ||
153+
| v2.0+ | ^8.2 | 11.* ||
154+
| v2.0+ | ^8.2 | 10.* ||
155+
| v2.0+ | ^8.1 | 9.* ||
156+
| v1.2 - v1.3 | ^8.1 | 9.* ||
157+
| v1.0 - v1.1 | ^8.0 | 8.* ||
159158

160159
</details>
161160

@@ -262,6 +261,11 @@ DOCUWARE_URL=https://domain.docuware.cloud
262261
263262
DOCUWARE_PASSWORD=password
264263
DOCUWARE_PASSPHRASE="passphrase"
264+
DOCUWARE_TIMEOUT=30
265+
DOCUWARE_CACHE_DRIVER=file
266+
DOCUWARE_CACHE_LIFETIME_IN_SECONDS=60
267+
DOCUWARE_CLIENT_ID=docuware.platform.net.client
268+
DOCUWARE_SCOPE=docuware.platform
265269
```
266270

267271
With the passphrase we are able to encrypt the URLs.
@@ -312,31 +316,7 @@ $connector = new DocuWareConnector(
312316

313317
### Available Requests
314318

315-
- [General](docs/General)
316-
- [Organisation](docs/General/organization.md)
317-
- [User Management](docs/General/User%20Management)
318-
- [Get Users](docs/General/User%20Management/get_users.md)
319-
- [Create/Update Users](docs/General/User%20Management/create-update_users.md)
320-
- [Get/Modify Groups](docs/General/User%20Management/get-modify_groups.md)
321-
- [Get/Modify Roles](docs/General/User%20Management/get-modify_roles.md)
322-
- [File Cabinets](docs/File%20Cabinets)
323-
- [General](docs/File%20Cabinets/general.md)
324-
- [Dialogs](docs/File%20Cabinets/dialogs.md)
325-
- [Search](docs/File%20Cabinets/search.md)
326-
- [Check/In & Check/Out](docs/File%20Cabinets/check-in_check-out.md)
327-
- [Select Lists](docs/File%20Cabinets/select_lists.md)
328-
- [Upload](docs/File%20Cabinets/upload.md)
329-
- [Batch Index Fields Update](docs/File%20Cabinets/batch_index_fields_update.md)
330-
- [Documents](docs/Documents)
331-
- [Update Index Values](docs/Documents/update_index_values.md)
332-
- [Modify Documents](docs/Documents/modify_documents.md)
333-
- [Clip/Unclip & Staple/Unstaple](docs/Documents/clip-unclicp_and_staple-unstaple.md)
334-
- [Annotations & Stamps](docs/Documents/annotations-stamps.md)
335-
- [Documents Trash Bin](docs/Documents/documents-trash-bin.md)
336-
- [Application Properties](docs/Documents/application_properties.md)
337-
- [Sections](docs/Documents/sections.md)
338-
- [Download](docs/Documents/download.md)
339-
- [Workflow](docs/workflow.md)
319+
The following sections provide examples for each available request type. All functionality is documented inline below with code examples.
340320

341321
#### Organization
342322

@@ -1699,6 +1679,7 @@ return [
16991679
| Cache driver
17001680
|--------------------------------------------------------------------------
17011681
| You may like to define a different cache driver than the default Laravel cache driver.
1682+
| In Laravel 12+, CACHE_STORE is used instead of CACHE_DRIVER.
17021683
|
17031684
*/
17041685

@@ -1768,6 +1749,24 @@ return [
17681749
'driver' => env('DOCUWARE_CACHE_DRIVER', env('CACHE_STORE', env('CACHE_DRIVER', 'file'))),
17691750
'lifetime_in_seconds' => env('DOCUWARE_CACHE_LIFETIME_IN_SECONDS', 60),
17701751
],
1752+
'request' => [
1753+
'timeout_in_seconds' => env('DOCUWARE_TIMEOUT', 60),
1754+
],
1755+
1756+
'client_id' => env('DOCUWARE_CLIENT_ID', 'docuware.platform.net.client'),
1757+
'scope' => env('DOCUWARE_SCOPE', 'docuware.platform'),
1758+
],
1759+
1760+
/*
1761+
|--------------------------------------------------------------------------
1762+
| Tests
1763+
|--------------------------------------------------------------------------
1764+
|
1765+
*/
1766+
'tests' => [
1767+
'file_cabinet_id' => env('DOCUWARE_TESTS_FILE_CABINET_ID'),
1768+
'dialog_id' => env('DOCUWARE_TESTS_DIALOG_ID'),
1769+
'basket_id' => env('DOCUWARE_TESTS_BASKET_ID'),
17711770
],
17721771
];
17731772
```
@@ -1783,18 +1782,19 @@ cp phpunit.xml.dist phpunit.xml
17831782
Modify environment variables in the phpunit.xml-file:
17841783

17851784
```xml
1786-
<env name="DOCUWARE_TOKEN" value=""/>
17871785
<env name="DOCUWARE_URL" value="https://domain.docuware.cloud"/>
17881786
<env name="DOCUWARE_USERNAME" value="[email protected]"/>
17891787
<env name="DOCUWARE_PASSWORD" value="password"/>
17901788
<env name="DOCUWARE_PASSPHRASE" value="passphrase"/>
17911789
<env name="DOCUWARE_TIMEOUT" value="30"/>
1790+
<env name="DOCUWARE_CACHE_DRIVER" value="file"/>
17921791
<env name="DOCUWARE_CACHE_LIFETIME_IN_SECONDS" value="0"/>
1792+
<env name="DOCUWARE_CLIENT_ID" value="docuware.platform.net.client"/>
1793+
<env name="DOCUWARE_SCOPE" value="docuware.platform"/>
17931794

17941795
<env name="DOCUWARE_TESTS_FILE_CABINET_ID" value=""/>
17951796
<env name="DOCUWARE_TESTS_DIALOG_ID" value=""/>
17961797
<env name="DOCUWARE_TESTS_BASKET_ID" value=""/>
1797-
<env name="DOCUWARE_TESTS_ORGANIZATION_ID" value=""/>
17981798
```
17991799

18001800
Run the tests:
@@ -1817,8 +1817,7 @@ Please review [our security policy](.github/SECURITY.md) on how to report securi
18171817

18181818
## 🙏 Credits
18191819

1820-
- [Sebastian Fix](https://github.com/StanBarrows)
1821-
- [Rhys Lees](https://github.com/RhysLees)
1820+
- [Sebastian Bürgin-Fix](https://github.com/StanBarrows)
18221821
- [All Contributors](../../contributors)
18231822
- [Skeleton Repository from Spatie](https://github.com/spatie/package-skeleton-laravel)
18241823
- [Laravel Package Training from Spatie](https://spatie.be/videos/laravel-package-training)

composer.json

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -17,10 +17,6 @@
1717
"name": "Sebastian Bürgin-Fix",
1818
"email": "[email protected]",
1919
"homepage": "https://www.codebar.ch",
20-
"role": "Sofware-Engineer"
21-
},
22-
{
23-
"name": "Rhys Lees",
2420
"role": "Software-Engineer"
2521
}
2622
],

config/laravel-docuware.php

Lines changed: 1 addition & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -78,7 +78,7 @@
7878
'lifetime_in_seconds' => env('DOCUWARE_CACHE_LIFETIME_IN_SECONDS', 60),
7979
],
8080
'request' => [
81-
'timeout_in_seconds' => env('DOCUWARE_CACHE_TIMEOUT_IN_SECONDS', 60),
81+
'timeout_in_seconds' => env('DOCUWARE_TIMEOUT', 60),
8282
],
8383

8484
'client_id' => env('DOCUWARE_CLIENT_ID', 'docuware.platform.net.client'),
@@ -95,17 +95,5 @@
9595
'file_cabinet_id' => env('DOCUWARE_TESTS_FILE_CABINET_ID'),
9696
'dialog_id' => env('DOCUWARE_TESTS_DIALOG_ID'),
9797
'basket_id' => env('DOCUWARE_TESTS_BASKET_ID'),
98-
'section' => (int) env('DOCUWARE_TESTS_SECTION'),
99-
'organization_id' => env('DOCUWARE_TESTS_ORGANIZATION_ID'),
100-
'document_id' => (int) env('DOCUWARE_TESTS_DOCUMENT_ID'),
101-
'document_file_size_preview' => (int) env('DOCUWARE_TESTS_DOCUMENT_FILE_SIZE_PREVIEW'),
102-
'document_file_size' => (int) env('DOCUWARE_TESTS_DOCUMENT_FILE_SIZE'),
103-
'document_count' => (int) env('DOCUWARE_TESTS_DOCUMENT_COUNT'),
104-
'document_thumbnail_mime_type' => env('DOCUWARE_TESTS_DOCUMENT_THUMBNAIL_MIME_TYPE'),
105-
'document_thumbnail_file_size' => (int) env('DOCUWARE_TESTS_DOCUMENT_THUMBNAIL_FILE_SIZE'),
106-
'document_ids' => json_decode(env('DOCUWARE_TESTS_DOCUMENTS_IDS', '[]')),
107-
'documents_file_size' => (int) env('DOCUWARE_TESTS_DOCUMENTS_FILE_SIZE'),
108-
'field_name' => env('DOCUWARE_TESTS_FIELD_NAME'),
109-
'field_name_2' => env('DOCUWARE_TESTS_FIELD_NAME_2'),
11098
],
11199
];

phpunit.xml.dist

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
<phpunit xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
33
xsi:noNamespaceSchemaLocation="https://schema.phpunit.de/10.3/phpunit.xsd" backupGlobals="false"
44
bootstrap="vendor/autoload.php" colors="true" processIsolation="false" stopOnFailure="false"
5-
executionOrder="random" failOnWarning="true" failOnRisky="true" failOnEmptyTestSuite="true"
5+
executionOrder="defects" failOnWarning="true" failOnRisky="true" failOnEmptyTestSuite="true"
66
beStrictAboutOutputDuringTests="true" cacheDirectory=".phpunit.cache" backupStaticProperties="false">
77
<testsuites>
88
<testsuite name="codebar Solutions AG Test Suite">

tests/Feature/DocuWareTest.php

Lines changed: 22 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,13 +3,23 @@
33
namespace CodebarAg\DocuWare\Tests\Feature;
44

55
use CodebarAg\DocuWare\DocuWare;
6+
use CodebarAg\DocuWare\Requests\FileCabinets\Upload\CreateDataRecord;
67
use Illuminate\Support\Facades\Event;
8+
use Illuminate\Support\Sleep;
79

810
it('can create encrypted url for a document in a file cabinet', function () {
911
Event::fake();
1012

1113
$fileCabinetId = config('laravel-docuware.tests.file_cabinet_id');
12-
$documentId = config('laravel-docuware.tests.document_id');
14+
15+
// Create a document dynamically for testing
16+
$document = $this->connector->send(new CreateDataRecord(
17+
$fileCabinetId,
18+
'::fake-file-content::',
19+
'example.txt'
20+
))->dto();
21+
22+
Sleep::for(2)->seconds(); // Wait for the document to be processed
1323

1424
$url = (new DocuWare)
1525
->url(
@@ -19,7 +29,7 @@
1929
passphrase: config('laravel-docuware.passphrase'),
2030
)
2131
->fileCabinet($fileCabinetId)
22-
->document($documentId)
32+
->document($document->id)
2333
->validUntil(now()->addMinute())
2434
->make();
2535

@@ -38,7 +48,15 @@
3848
Event::fake();
3949

4050
$basketId = config('laravel-docuware.tests.basket_id');
41-
$documentId = config('laravel-docuware.tests.document_id');
51+
52+
// Create a document dynamically for testing
53+
$document = $this->connector->send(new CreateDataRecord(
54+
$basketId,
55+
'::fake-file-content::',
56+
'example.txt'
57+
))->dto();
58+
59+
Sleep::for(2)->seconds(); // Wait for the document to be processed
4260

4361
$url = (new DocuWare)
4462
->url(
@@ -48,7 +66,7 @@
4866
passphrase: config('laravel-docuware.passphrase'),
4967
)
5068
->basket($basketId)
51-
->document($documentId)
69+
->document($document->id)
5270
->validUntil(now()->addMinute())
5371
->make();
5472

tests/Feature/Requests/Documents/GetDocumentCountRequestTest.php

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
use CodebarAg\DocuWare\Requests\FileCabinets\General\GetTotalNumberOfDocuments;
55
use CodebarAg\DocuWare\Requests\FileCabinets\Upload\CreateDataRecord;
66
use Illuminate\Support\Facades\Event;
7+
use Illuminate\Support\Sleep;
78

89
it('can get a total count of documents', function () {
910
Event::fake();
@@ -17,6 +18,8 @@
1718
'example.txt'
1819
))->dto();
1920

21+
Sleep::for(2)->seconds(); // Wait for the document to be processed
22+
2023
$count = $this->connector->send(new GetTotalNumberOfDocuments(
2124
$fileCabinetId,
2225
$dialogId

tests/Feature/Requests/FileCabinets/Search/GetASpecificDocumentFromAFileCabinetTest.php

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
use CodebarAg\DocuWare\Requests\FileCabinets\Search\GetASpecificDocumentFromAFileCabinet;
66
use CodebarAg\DocuWare\Requests\FileCabinets\Upload\CreateDataRecord;
77
use Illuminate\Support\Facades\Event;
8+
use Illuminate\Support\Sleep;
89

910
it('can show a document', function () {
1011
Event::fake();
@@ -17,6 +18,8 @@
1718
'example.txt'
1819
))->dto();
1920

21+
Sleep::for(2)->seconds(); // Wait for the document to be processed
22+
2023
$getdocument = $this->connector->send(new GetASpecificDocumentFromAFileCabinet($fileCabinetId, $document->id))->dto();
2124

2225
$this->assertInstanceOf(Document::class, $getdocument);

tests/Feature/Requests/FileCabinets/Search/GetDocumentsFromAFileCabinetTest.php

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
use CodebarAg\DocuWare\Requests\FileCabinets\Search\GetDocumentsFromAFileCabinet;
55
use CodebarAg\DocuWare\Requests\FileCabinets\Upload\CreateDataRecord;
66
use Illuminate\Support\Facades\Event;
7+
use Illuminate\Support\Sleep;
78

89
it('can get all documents', function () {
910
Event::fake();
@@ -19,6 +20,8 @@
1920
'example.txt'
2021
))->dto();
2122

23+
Sleep::for(2)->seconds(); // Wait for the documents to be processed
24+
2225
$documents = $this->connector->send(new GetDocumentsFromAFileCabinet(
2326
config('laravel-docuware.tests.file_cabinet_id')
2427
))->dto();

tests/Feature/Requests/Search/GetSearchRequestTest.php

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88
use CodebarAg\DocuWare\Exceptions\UnableToSearch;
99
use CodebarAg\DocuWare\Requests\FileCabinets\Upload\CreateDataRecord;
1010
use Illuminate\Support\Facades\Event;
11+
use Illuminate\Support\Sleep;
1112

1213
it('can search documents', function () {
1314
Event::fake();
@@ -242,6 +243,8 @@
242243
]),
243244
))->dto();
244245

246+
Sleep::for(3)->seconds(); // Wait for the documents to be processed
247+
245248
// Should filter down to documentOne and documentTwo. documentThree should be filtered out.
246249
$paginatorRequestBothDocuments = (new DocuWare)
247250
->searchRequestBuilder()

0 commit comments

Comments
 (0)