Skip to content

Commit 5af04a6

Browse files
authored
Merge pull request #194 from codebar-ag/feature-fix
Feature Fix
2 parents 9c52496 + d026abf commit 5af04a6

File tree

12 files changed

+79
-57
lines changed

12 files changed

+79
-57
lines changed

.phpunit.cache/test-results

Lines changed: 1 addition & 1 deletion
Large diffs are not rendered by default.

CHANGELOG.md

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,13 @@
22

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

5+
## [v12.1.0]
6+
7+
### Laravel 12 Compatibility
8+
- Updated cache configuration to use `CACHE_STORE` instead of deprecated `CACHE_DRIVER` for Laravel 12 compatibility
9+
- This ensures DocuWare cache uses the same store as the application, preventing MAC validation errors when using encrypted cache values
10+
- Maintains backward compatibility with Laravel 9-11 by falling back to `CACHE_DRIVER` if `CACHE_STORE` is not available
11+
512
## 2.0.0 pre-release
613
### General
714
- Dropped support below PHP 8.1

README.md

Lines changed: 31 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -262,6 +262,11 @@ DOCUWARE_URL=https://domain.docuware.cloud
262262
DOCUWARE_USERNAME=user@domain.test
263263
DOCUWARE_PASSWORD=password
264264
DOCUWARE_PASSPHRASE="passphrase"
265+
DOCUWARE_TIMEOUT=30
266+
DOCUWARE_CACHE_DRIVER=file
267+
DOCUWARE_CACHE_LIFETIME_IN_SECONDS=60
268+
DOCUWARE_CLIENT_ID=docuware.platform.net.client
269+
DOCUWARE_SCOPE=docuware.platform
265270
```
266271

267272
With the passphrase we are able to encrypt the URLs.
@@ -312,31 +317,7 @@ $connector = new DocuWareConnector(
312317

313318
### Available Requests
314319

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)
320+
The following sections provide examples for each available request type. All functionality is documented inline below with code examples.
340321

341322
#### Organization
342323

@@ -1699,10 +1680,11 @@ return [
16991680
| Cache driver
17001681
|--------------------------------------------------------------------------
17011682
| You may like to define a different cache driver than the default Laravel cache driver.
1683+
| In Laravel 12+, CACHE_STORE is used instead of CACHE_DRIVER.
17021684
|
17031685
*/
17041686

1705-
'cache_driver' => env('DOCUWARE_CACHE_DRIVER', env('CACHE_DRIVER', 'file')),
1687+
'cache_driver' => env('DOCUWARE_CACHE_DRIVER', env('CACHE_STORE', 'file')),
17061688

17071689
/*
17081690
|--------------------------------------------------------------------------
@@ -1765,9 +1747,27 @@ return [
17651747
'additional_result_fields' => [],
17661748
],
17671749
'cache' => [
1768-
'driver' => env('DOCUWARE_CACHE_DRIVER', env('CACHE_DRIVER', 'file')),
1750+
'driver' => env('DOCUWARE_CACHE_DRIVER', env('CACHE_STORE', 'file')),
17691751
'lifetime_in_seconds' => env('DOCUWARE_CACHE_LIFETIME_IN_SECONDS', 60),
17701752
],
1753+
'request' => [
1754+
'timeout_in_seconds' => env('DOCUWARE_TIMEOUT', 60),
1755+
],
1756+
1757+
'client_id' => env('DOCUWARE_CLIENT_ID', 'docuware.platform.net.client'),
1758+
'scope' => env('DOCUWARE_SCOPE', 'docuware.platform'),
1759+
],
1760+
1761+
/*
1762+
|--------------------------------------------------------------------------
1763+
| Tests
1764+
|--------------------------------------------------------------------------
1765+
|
1766+
*/
1767+
'tests' => [
1768+
'file_cabinet_id' => env('DOCUWARE_TESTS_FILE_CABINET_ID'),
1769+
'dialog_id' => env('DOCUWARE_TESTS_DIALOG_ID'),
1770+
'basket_id' => env('DOCUWARE_TESTS_BASKET_ID'),
17711771
],
17721772
];
17731773
```
@@ -1783,18 +1783,19 @@ cp phpunit.xml.dist phpunit.xml
17831783
Modify environment variables in the phpunit.xml-file:
17841784

17851785
```xml
1786-
<env name="DOCUWARE_TOKEN" value=""/>
17871786
<env name="DOCUWARE_URL" value="https://domain.docuware.cloud"/>
17881787
<env name="DOCUWARE_USERNAME" value="user@domain.test"/>
17891788
<env name="DOCUWARE_PASSWORD" value="password"/>
17901789
<env name="DOCUWARE_PASSPHRASE" value="passphrase"/>
17911790
<env name="DOCUWARE_TIMEOUT" value="30"/>
1791+
<env name="DOCUWARE_CACHE_DRIVER" value="file"/>
17921792
<env name="DOCUWARE_CACHE_LIFETIME_IN_SECONDS" value="0"/>
1793+
<env name="DOCUWARE_CLIENT_ID" value="docuware.platform.net.client"/>
1794+
<env name="DOCUWARE_SCOPE" value="docuware.platform"/>
17931795

17941796
<env name="DOCUWARE_TESTS_FILE_CABINET_ID" value=""/>
17951797
<env name="DOCUWARE_TESTS_DIALOG_ID" value=""/>
17961798
<env name="DOCUWARE_TESTS_BASKET_ID" value=""/>
1797-
<env name="DOCUWARE_TESTS_ORGANIZATION_ID" value=""/>
17981799
```
17991800

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

18181819
## 🙏 Credits
18191820

1820-
- [Sebastian Fix](https://github.com/StanBarrows)
1821-
- [Rhys Lees](https://github.com/RhysLees)
1821+
- [Sebastian Bürgin-Fix](https://github.com/StanBarrows)
18221822
- [All Contributors](../../contributors)
18231823
- [Skeleton Repository from Spatie](https://github.com/spatie/package-skeleton-laravel)
18241824
- [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": "sebastian.buergin@buergin.ch",
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: 4 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -7,10 +7,11 @@
77
| Cache driver
88
|--------------------------------------------------------------------------
99
| You may like to define a different cache driver than the default Laravel cache driver.
10+
| In Laravel 12+, CACHE_STORE is used instead of CACHE_DRIVER.
1011
|
1112
*/
1213

13-
'cache_driver' => env('DOCUWARE_CACHE_DRIVER', env('CACHE_DRIVER', 'file')),
14+
'cache_driver' => env('DOCUWARE_CACHE_DRIVER', env('CACHE_STORE', 'file')),
1415

1516
/*
1617
|--------------------------------------------------------------------------
@@ -73,11 +74,11 @@
7374
'additional_result_fields' => [],
7475
],
7576
'cache' => [
76-
'driver' => env('DOCUWARE_CACHE_DRIVER', env('CACHE_DRIVER', 'file')),
77+
'driver' => env('DOCUWARE_CACHE_DRIVER', env('CACHE_STORE', 'file')),
7778
'lifetime_in_seconds' => env('DOCUWARE_CACHE_LIFETIME_IN_SECONDS', 60),
7879
],
7980
'request' => [
80-
'timeout_in_seconds' => env('DOCUWARE_CACHE_TIMEOUT_IN_SECONDS', 60),
81+
'timeout_in_seconds' => env('DOCUWARE_TIMEOUT', 60),
8182
],
8283

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

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">

src/DTO/TextshotPage.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ public static function fromJson(array $data): self
2323
}
2424

2525
public function __construct(
26-
public string $language,
26+
public ?string $language,
2727
public string $content,
2828
) {}
2929

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);

0 commit comments

Comments
 (0)