Skip to content

Commit

Permalink
UHF-9239: Add tests
Browse files Browse the repository at this point in the history
  • Loading branch information
hyrsky committed Jan 11, 2024
1 parent a97744b commit f0889f6
Show file tree
Hide file tree
Showing 5 changed files with 593 additions and 0 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
name: HELfi api client test
type: module
package: Custom
core_version_requirement: ^9 || ^10
dependencies:
- helfi_api_base
33 changes: 33 additions & 0 deletions tests/modules/helfi_api_client_test/src/ApiClient.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
<?php

declare(strict_types = 1);

namespace Drupal\helfi_api_client_test;

use Drupal\helfi_api_base\ApiClient\ApiClientBase;
use Drupal\helfi_api_base\ApiClient\ApiResponse;
use Drupal\helfi_api_base\ApiClient\CacheValue;
use GuzzleHttp\Exception\GuzzleException;

/**
* Class responsible for performing language negotiation.
*/
class ApiClient extends ApiClientBase {

/**
* Expose protected method for testing.
*
* @throws GuzzleException
*/
public function exposedMakeRequest(string $method, string $url, array $options = [], ?callable $mockCallback = NULL): ApiResponse {
return $this->makeRequest($method, $url, $options, $mockCallback);
}

/**
* Expose protected method for testing
*/
public function exposedCache(string $key, callable $callback): CacheValue {
return $this->cache($key, $callback);
}

}
Loading

0 comments on commit f0889f6

Please sign in to comment.