Skip to content

Commit a3797e3

Browse files
authored
Fix error in thumbnail retrieval (#1236)
* fix: require bedita web-tools 5.3.3 * tests: fix * chore fix: phpcs and stan
1 parent a4ae31e commit a3797e3

File tree

3 files changed

+23
-3
lines changed

3 files changed

+23
-3
lines changed

composer.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@
2323
"require": {
2424
"php": ">=8.3",
2525
"bedita/i18n": "^5.1.0",
26-
"bedita/web-tools": "^5.3",
26+
"bedita/web-tools": "^5.3.3",
2727
"cakephp/authentication": "^2.9",
2828
"cakephp/cakephp": "~4.5.0",
2929
"cakephp/plugin-installer": "^1.3",

tests/TestCase/Controller/ModulesControllerTest.php

+10-1
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,8 @@
2121
use Authentication\AuthenticationServiceInterface;
2222
use Authentication\Identity;
2323
use Authentication\IdentityInterface;
24+
use BEdita\SDK\BEditaClient;
25+
use BEdita\SDK\BEditaClientException;
2426
use Cake\Cache\Cache;
2527
use Cake\Core\Configure;
2628
use Cake\Event\Event;
@@ -763,14 +765,21 @@ public function testDeleteError(): void
763765
'REQUEST_METHOD' => 'POST',
764766
],
765767
'post' => [
766-
'wrongquery' => '123456789',
768+
'id' => '123456789',
767769
],
768770
'params' => [
769771
'object_type' => 'documents',
770772
],
771773
];
772774
$request = new ServerRequest($config);
773775
$this->controller = new ModulesControllerSample($request);
776+
$apiClient = new class ('https://api.example.com') extends BEditaClient {
777+
public function delete(string $path, ?string $body = null, ?array $headers = null): ?array
778+
{
779+
throw new BEditaClientException('Error');
780+
}
781+
};
782+
$this->controller->setApiClient($apiClient);
774783

775784
// do controller call
776785
$result = $this->controller->delete();

tests/Utils/ModulesControllerSample.php

+12-1
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ public function availableRelationshipsUrl(string $relation): string
3232
}
3333

3434
/**
35-
* Create new object from ajax request.
35+
* Get api client.
3636
*
3737
* @return \BEdita\SDK\BEditaClient
3838
*/
@@ -41,6 +41,17 @@ public function getApiClient(): BEditaClient
4141
return $this->apiClient;
4242
}
4343

44+
/**
45+
* Set api client.
46+
*
47+
* @param \BEdita\SDK\BEditaClient|null $client Api client.
48+
* @return void
49+
*/
50+
public function setApiClient(?BEditaClient $client = null): void
51+
{
52+
$this->apiClient = $client;
53+
}
54+
4455
/**
4556
* Create new object from ajax request.
4657
*

0 commit comments

Comments
 (0)