Skip to content

Commit

Permalink
Issue #56: Rename CoolRequest -> CollaboraDiscovery.
Browse files Browse the repository at this point in the history
  • Loading branch information
donquixote committed Dec 3, 2024
1 parent 9547b2c commit 3d0afac
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
/**
* Helper class to fetch a WOPI client url.
*/
class CoolRequest {
class CollaboraDiscovery {

/**
* Gets the URL for the WOPI client.
Expand Down
4 changes: 2 additions & 2 deletions src/Cool/CoolUtils.php
Original file line number Diff line number Diff line change
Expand Up @@ -248,9 +248,9 @@ public static function getViewerRender(Media $media, bool $can_write, $options =
$wopi_base = $default_config->get('cool')['wopi_base'];
$allowfullscreen = $default_config->get('cool')['allowfullscreen'] ?? FALSE;

$req = new CoolRequest();
$discovery = new CollaboraDiscovery();
try {
$wopi_client = $req->getWopiClientURL();
$wopi_client = $discovery->getWopiClientURL();
}
catch (CollaboraNotAvailableException $e) {
return [
Expand Down
10 changes: 5 additions & 5 deletions tests/src/ExistingSite/FetchClientUrlTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@

namespace Drupal\Tests\collabora_online\ExistingSite;

use Drupal\collabora_online\Cool\CoolRequest;
use Drupal\collabora_online\Cool\CollaboraDiscovery;
use Drupal\collabora_online\Exception\CollaboraNotAvailableException;
use weitzman\DrupalTestTraits\ExistingSiteBase;

Expand All @@ -27,8 +27,8 @@ class FetchClientUrlTest extends ExistingSiteBase {
* Tests fetching the client url.
*/
public function testFetchClientUrl(): void {
$cool_request = new CoolRequest();
$client_url = $cool_request->getWopiClientURL();
$discovery = new CollaboraDiscovery();
$client_url = $discovery->getWopiClientURL();
// The protocol, domain and port are known when this test runs in the
// docker-compose setup.
$this->assertMatchesRegularExpression('@^http://collabora\.test:9980/browser/[0-9a-f]+/cool\.html\?$@', $client_url);
Expand All @@ -45,13 +45,13 @@ public function testFetchClientUrlWithMisconfiguration(): void {
'server' => 'httx://example.com',
],
]);
$cool_request = new CoolRequest();
$discovery = new CollaboraDiscovery();

$this->expectException(CollaboraNotAvailableException::class);
$this->expectExceptionMessage('Warning! You have to specify the scheme protocol too (http|https) for the server address.');
$this->expectExceptionCode(204);

$cool_request->getWopiClientURL();
$discovery->getWopiClientURL();
}

}

0 comments on commit 3d0afac

Please sign in to comment.