Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .phpunit.cache/test-results

Large diffs are not rendered by default.

7 changes: 7 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,13 @@

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

## [v12.1.0]

### Laravel 12 Compatibility
- Updated cache configuration to use `CACHE_STORE` instead of deprecated `CACHE_DRIVER` for Laravel 12 compatibility
- This ensures DocuWare cache uses the same store as the application, preventing MAC validation errors when using encrypted cache values
- Maintains backward compatibility with Laravel 9-11 by falling back to `CACHE_DRIVER` if `CACHE_STORE` is not available

## 2.0.0 pre-release
### General
- Dropped support below PHP 8.1
Expand Down
62 changes: 31 additions & 31 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -262,6 +262,11 @@ DOCUWARE_URL=https://domain.docuware.cloud
DOCUWARE_USERNAME=user@domain.test
DOCUWARE_PASSWORD=password
DOCUWARE_PASSPHRASE="passphrase"
DOCUWARE_TIMEOUT=30
DOCUWARE_CACHE_DRIVER=file
DOCUWARE_CACHE_LIFETIME_IN_SECONDS=60
DOCUWARE_CLIENT_ID=docuware.platform.net.client
DOCUWARE_SCOPE=docuware.platform
```

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

### Available Requests

- [General](docs/General)
- [Organisation](docs/General/organization.md)
- [User Management](docs/General/User%20Management)
- [Get Users](docs/General/User%20Management/get_users.md)
- [Create/Update Users](docs/General/User%20Management/create-update_users.md)
- [Get/Modify Groups](docs/General/User%20Management/get-modify_groups.md)
- [Get/Modify Roles](docs/General/User%20Management/get-modify_roles.md)
- [File Cabinets](docs/File%20Cabinets)
- [General](docs/File%20Cabinets/general.md)
- [Dialogs](docs/File%20Cabinets/dialogs.md)
- [Search](docs/File%20Cabinets/search.md)
- [Check/In & Check/Out](docs/File%20Cabinets/check-in_check-out.md)
- [Select Lists](docs/File%20Cabinets/select_lists.md)
- [Upload](docs/File%20Cabinets/upload.md)
- [Batch Index Fields Update](docs/File%20Cabinets/batch_index_fields_update.md)
- [Documents](docs/Documents)
- [Update Index Values](docs/Documents/update_index_values.md)
- [Modify Documents](docs/Documents/modify_documents.md)
- [Clip/Unclip & Staple/Unstaple](docs/Documents/clip-unclicp_and_staple-unstaple.md)
- [Annotations & Stamps](docs/Documents/annotations-stamps.md)
- [Documents Trash Bin](docs/Documents/documents-trash-bin.md)
- [Application Properties](docs/Documents/application_properties.md)
- [Sections](docs/Documents/sections.md)
- [Download](docs/Documents/download.md)
- [Workflow](docs/workflow.md)
The following sections provide examples for each available request type. All functionality is documented inline below with code examples.

#### Organization

Expand Down Expand Up @@ -1699,10 +1680,11 @@ return [
| Cache driver
|--------------------------------------------------------------------------
| You may like to define a different cache driver than the default Laravel cache driver.
| In Laravel 12+, CACHE_STORE is used instead of CACHE_DRIVER.
|
*/

'cache_driver' => env('DOCUWARE_CACHE_DRIVER', env('CACHE_DRIVER', 'file')),
'cache_driver' => env('DOCUWARE_CACHE_DRIVER', env('CACHE_STORE', 'file')),

/*
|--------------------------------------------------------------------------
Expand Down Expand Up @@ -1765,9 +1747,27 @@ return [
'additional_result_fields' => [],
],
'cache' => [
'driver' => env('DOCUWARE_CACHE_DRIVER', env('CACHE_DRIVER', 'file')),
'driver' => env('DOCUWARE_CACHE_DRIVER', env('CACHE_STORE', 'file')),
'lifetime_in_seconds' => env('DOCUWARE_CACHE_LIFETIME_IN_SECONDS', 60),
],
'request' => [
'timeout_in_seconds' => env('DOCUWARE_TIMEOUT', 60),
],

'client_id' => env('DOCUWARE_CLIENT_ID', 'docuware.platform.net.client'),
'scope' => env('DOCUWARE_SCOPE', 'docuware.platform'),
],

/*
|--------------------------------------------------------------------------
| Tests
|--------------------------------------------------------------------------
|
*/
'tests' => [
'file_cabinet_id' => env('DOCUWARE_TESTS_FILE_CABINET_ID'),
'dialog_id' => env('DOCUWARE_TESTS_DIALOG_ID'),
'basket_id' => env('DOCUWARE_TESTS_BASKET_ID'),
],
];
```
Expand All @@ -1783,18 +1783,19 @@ cp phpunit.xml.dist phpunit.xml
Modify environment variables in the phpunit.xml-file:

```xml
<env name="DOCUWARE_TOKEN" value=""/>
<env name="DOCUWARE_URL" value="https://domain.docuware.cloud"/>
<env name="DOCUWARE_USERNAME" value="user@domain.test"/>
<env name="DOCUWARE_PASSWORD" value="password"/>
<env name="DOCUWARE_PASSPHRASE" value="passphrase"/>
<env name="DOCUWARE_TIMEOUT" value="30"/>
<env name="DOCUWARE_CACHE_DRIVER" value="file"/>
<env name="DOCUWARE_CACHE_LIFETIME_IN_SECONDS" value="0"/>
<env name="DOCUWARE_CLIENT_ID" value="docuware.platform.net.client"/>
<env name="DOCUWARE_SCOPE" value="docuware.platform"/>

<env name="DOCUWARE_TESTS_FILE_CABINET_ID" value=""/>
<env name="DOCUWARE_TESTS_DIALOG_ID" value=""/>
<env name="DOCUWARE_TESTS_BASKET_ID" value=""/>
<env name="DOCUWARE_TESTS_ORGANIZATION_ID" value=""/>
```

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

## 🙏 Credits

- [Sebastian Fix](https://github.com/StanBarrows)
- [Rhys Lees](https://github.com/RhysLees)
- [Sebastian Bürgin-Fix](https://github.com/StanBarrows)
- [All Contributors](../../contributors)
- [Skeleton Repository from Spatie](https://github.com/spatie/package-skeleton-laravel)
- [Laravel Package Training from Spatie](https://spatie.be/videos/laravel-package-training)
Expand Down
4 changes: 0 additions & 4 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -17,10 +17,6 @@
"name": "Sebastian Bürgin-Fix",
"email": "sebastian.buergin@buergin.ch",
"homepage": "https://www.codebar.ch",
"role": "Sofware-Engineer"
},
{
"name": "Rhys Lees",
"role": "Software-Engineer"
}
],
Expand Down
19 changes: 4 additions & 15 deletions config/laravel-docuware.php
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,11 @@
| Cache driver
|--------------------------------------------------------------------------
| You may like to define a different cache driver than the default Laravel cache driver.
| In Laravel 12+, CACHE_STORE is used instead of CACHE_DRIVER.
|
*/

'cache_driver' => env('DOCUWARE_CACHE_DRIVER', env('CACHE_DRIVER', 'file')),
'cache_driver' => env('DOCUWARE_CACHE_DRIVER', env('CACHE_STORE', 'file')),

/*
|--------------------------------------------------------------------------
Expand Down Expand Up @@ -73,11 +74,11 @@
'additional_result_fields' => [],
],
'cache' => [
'driver' => env('DOCUWARE_CACHE_DRIVER', env('CACHE_DRIVER', 'file')),
'driver' => env('DOCUWARE_CACHE_DRIVER', env('CACHE_STORE', 'file')),
'lifetime_in_seconds' => env('DOCUWARE_CACHE_LIFETIME_IN_SECONDS', 60),
],
'request' => [
'timeout_in_seconds' => env('DOCUWARE_CACHE_TIMEOUT_IN_SECONDS', 60),
'timeout_in_seconds' => env('DOCUWARE_TIMEOUT', 60),
],

'client_id' => env('DOCUWARE_CLIENT_ID', 'docuware.platform.net.client'),
Expand All @@ -94,17 +95,5 @@
'file_cabinet_id' => env('DOCUWARE_TESTS_FILE_CABINET_ID'),
'dialog_id' => env('DOCUWARE_TESTS_DIALOG_ID'),
'basket_id' => env('DOCUWARE_TESTS_BASKET_ID'),
'section' => (int) env('DOCUWARE_TESTS_SECTION'),
'organization_id' => env('DOCUWARE_TESTS_ORGANIZATION_ID'),
'document_id' => (int) env('DOCUWARE_TESTS_DOCUMENT_ID'),
'document_file_size_preview' => (int) env('DOCUWARE_TESTS_DOCUMENT_FILE_SIZE_PREVIEW'),
'document_file_size' => (int) env('DOCUWARE_TESTS_DOCUMENT_FILE_SIZE'),
'document_count' => (int) env('DOCUWARE_TESTS_DOCUMENT_COUNT'),
'document_thumbnail_mime_type' => env('DOCUWARE_TESTS_DOCUMENT_THUMBNAIL_MIME_TYPE'),
'document_thumbnail_file_size' => (int) env('DOCUWARE_TESTS_DOCUMENT_THUMBNAIL_FILE_SIZE'),
'document_ids' => json_decode(env('DOCUWARE_TESTS_DOCUMENTS_IDS', '[]')),
'documents_file_size' => (int) env('DOCUWARE_TESTS_DOCUMENTS_FILE_SIZE'),
'field_name' => env('DOCUWARE_TESTS_FIELD_NAME'),
'field_name_2' => env('DOCUWARE_TESTS_FIELD_NAME_2'),
],
];
2 changes: 1 addition & 1 deletion phpunit.xml.dist
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
<phpunit xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:noNamespaceSchemaLocation="https://schema.phpunit.de/10.3/phpunit.xsd" backupGlobals="false"
bootstrap="vendor/autoload.php" colors="true" processIsolation="false" stopOnFailure="false"
executionOrder="random" failOnWarning="true" failOnRisky="true" failOnEmptyTestSuite="true"
executionOrder="defects" failOnWarning="true" failOnRisky="true" failOnEmptyTestSuite="true"
beStrictAboutOutputDuringTests="true" cacheDirectory=".phpunit.cache" backupStaticProperties="false">
<testsuites>
<testsuite name="codebar Solutions AG Test Suite">
Expand Down
2 changes: 1 addition & 1 deletion src/DTO/TextshotPage.php
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ public static function fromJson(array $data): self
}

public function __construct(
public string $language,
public ?string $language,
public string $content,
) {}

Expand Down
26 changes: 22 additions & 4 deletions tests/Feature/DocuWareTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,23 @@
namespace CodebarAg\DocuWare\Tests\Feature;

use CodebarAg\DocuWare\DocuWare;
use CodebarAg\DocuWare\Requests\FileCabinets\Upload\CreateDataRecord;
use Illuminate\Support\Facades\Event;
use Illuminate\Support\Sleep;

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

$fileCabinetId = config('laravel-docuware.tests.file_cabinet_id');
$documentId = config('laravel-docuware.tests.document_id');

// Create a document dynamically for testing
$document = $this->connector->send(new CreateDataRecord(
$fileCabinetId,
'::fake-file-content::',
'example.txt'
))->dto();

Sleep::for(2)->seconds(); // Wait for the document to be processed

$url = (new DocuWare)
->url(
Expand All @@ -19,7 +29,7 @@
passphrase: config('laravel-docuware.passphrase'),
)
->fileCabinet($fileCabinetId)
->document($documentId)
->document($document->id)
->validUntil(now()->addMinute())
->make();

Expand All @@ -38,7 +48,15 @@
Event::fake();

$basketId = config('laravel-docuware.tests.basket_id');
$documentId = config('laravel-docuware.tests.document_id');

// Create a document dynamically for testing
$document = $this->connector->send(new CreateDataRecord(
$basketId,
'::fake-file-content::',
'example.txt'
))->dto();

Sleep::for(2)->seconds(); // Wait for the document to be processed

$url = (new DocuWare)
->url(
Expand All @@ -48,7 +66,7 @@
passphrase: config('laravel-docuware.passphrase'),
)
->basket($basketId)
->document($documentId)
->document($document->id)
->validUntil(now()->addMinute())
->make();

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
use CodebarAg\DocuWare\Requests\FileCabinets\General\GetTotalNumberOfDocuments;
use CodebarAg\DocuWare\Requests\FileCabinets\Upload\CreateDataRecord;
use Illuminate\Support\Facades\Event;
use Illuminate\Support\Sleep;

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

Sleep::for(2)->seconds(); // Wait for the document to be processed

$count = $this->connector->send(new GetTotalNumberOfDocuments(
$fileCabinetId,
$dialogId
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
use CodebarAg\DocuWare\Requests\FileCabinets\Search\GetASpecificDocumentFromAFileCabinet;
use CodebarAg\DocuWare\Requests\FileCabinets\Upload\CreateDataRecord;
use Illuminate\Support\Facades\Event;
use Illuminate\Support\Sleep;

it('can show a document', function () {
Event::fake();
Expand All @@ -17,6 +18,8 @@
'example.txt'
))->dto();

Sleep::for(2)->seconds(); // Wait for the document to be processed

$getdocument = $this->connector->send(new GetASpecificDocumentFromAFileCabinet($fileCabinetId, $document->id))->dto();

$this->assertInstanceOf(Document::class, $getdocument);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
use CodebarAg\DocuWare\Requests\FileCabinets\Search\GetDocumentsFromAFileCabinet;
use CodebarAg\DocuWare\Requests\FileCabinets\Upload\CreateDataRecord;
use Illuminate\Support\Facades\Event;
use Illuminate\Support\Sleep;

it('can get all documents', function () {
Event::fake();
Expand All @@ -19,6 +20,8 @@
'example.txt'
))->dto();

Sleep::for(2)->seconds(); // Wait for the documents to be processed

$documents = $this->connector->send(new GetDocumentsFromAFileCabinet(
config('laravel-docuware.tests.file_cabinet_id')
))->dto();
Expand Down
3 changes: 3 additions & 0 deletions tests/Feature/Requests/Search/GetSearchRequestTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
use CodebarAg\DocuWare\Exceptions\UnableToSearch;
use CodebarAg\DocuWare\Requests\FileCabinets\Upload\CreateDataRecord;
use Illuminate\Support\Facades\Event;
use Illuminate\Support\Sleep;

it('can search documents', function () {
Event::fake();
Expand Down Expand Up @@ -242,6 +243,8 @@
]),
))->dto();

Sleep::for(3)->seconds(); // Wait for the documents to be processed

// Should filter down to documentOne and documentTwo. documentThree should be filtered out.
$paginatorRequestBothDocuments = (new DocuWare)
->searchRequestBuilder()
Expand Down
Loading