Skip to content

Commit

Permalink
fix: skip custom tests
Browse files Browse the repository at this point in the history
  • Loading branch information
shortcuts committed Jan 14, 2025
1 parent d9a9d10 commit a1dbe5f
Show file tree
Hide file tree
Showing 4 changed files with 28 additions and 19 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
targets:
$default:
builders:
json_serializable:
options:
any_map: false
checked: true
create_factory: true
create_to_json: true
disallow_unrecognized_keys: false
explicit_to_json: true
field_rename: none
ignore_unannotated: false
include_if_null: false
22 changes: 9 additions & 13 deletions clients/algoliasearch-client-php/lib/Algolia.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,8 @@
namespace Algolia\AlgoliaSearch;

use Algolia\AlgoliaSearch\Cache\NullCacheDriver;
use Algolia\AlgoliaSearch\Http\CurlHttpClient;
use Algolia\AlgoliaSearch\Http\GuzzleHttpClient;
use Algolia\AlgoliaSearch\Http\HttpClientInterface;
use Algolia\AlgoliaSearch\Log\DebugLogger;
use GuzzleHttp\Client;
use GuzzleHttp\ClientInterface;
use Psr\Log\LoggerInterface;
use Psr\SimpleCache\CacheInterface;

Expand All @@ -19,19 +15,19 @@ final class Algolia
/**
* Holds an instance of the simple cache repository (PSR-16).
*
* @var null|CacheInterface
* @var null|\Psr\SimpleCache\CacheInterface
*/
private static $cache;

/**
* Holds an instance of the logger (PSR-3).
*
* @var null|LoggerInterface
* @var null|\Psr\Log\LoggerInterface
*/
private static $logger;

/**
* @var HttpClientInterface
* @var \Algolia\AlgoliaSearch\Http\HttpClientInterface
*/
private static $httpClient;

Expand All @@ -47,7 +43,7 @@ public static function isCacheEnabled()
/**
* Gets the cache instance.
*
* @return CacheInterface
* @return \Psr\SimpleCache\CacheInterface
*/
public static function getCache()
{
Expand All @@ -69,7 +65,7 @@ public static function setCache(CacheInterface $cache)
/**
* Gets the logger instance.
*
* @return LoggerInterface
* @return \Psr\Log\LoggerInterface
*/
public static function getLogger()
{
Expand All @@ -94,23 +90,23 @@ public static function getHttpClient()
if (interface_exists('\GuzzleHttp\ClientInterface')) {
if (defined('\GuzzleHttp\ClientInterface::VERSION')) {
$guzzleVersion = (int) mb_substr(
Client::VERSION,
\GuzzleHttp\Client::VERSION,
0,
1
);
} else {
$guzzleVersion = ClientInterface::MAJOR_VERSION;
$guzzleVersion = \GuzzleHttp\ClientInterface::MAJOR_VERSION;
}
}

if (null === self::$httpClient) {
if (class_exists('\GuzzleHttp\Client') && 6 <= $guzzleVersion) {
self::setHttpClient(
new GuzzleHttpClient()
new \Algolia\AlgoliaSearch\Http\GuzzleHttpClient()
);
} else {
self::setHttpClient(
new CurlHttpClient()
new \Algolia\AlgoliaSearch\Http\CurlHttpClient()
);
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -107,6 +107,11 @@ public void run(Map<String, CodegenModel> models, Map<String, CodegenOperation>
} else if (step.type.equals("method")) {
ope = operations.get(step.method);
if (ope == null) {
// some clients don't have custom methods
if (step.method.startsWith("custom") && client.equals("composition")) {
continue skipTest;
}

throw new CTSException("Cannot find operation for method: " + step.method, test.testName);
}
stepOut.put("stepTemplate", "tests/client/method.mustache");
Expand Down
6 changes: 0 additions & 6 deletions specs/composition/spec.yml
Original file line number Diff line number Diff line change
Expand Up @@ -47,12 +47,6 @@ x-tagGroups:
tags:
- Compositions
paths:
# ######################
# ### Custom request ###
# ######################
/{path}:
$ref: '../common/paths/customRequest.yml'

# ########################
# ### Search Endpoints ###
# ########################
Expand Down

0 comments on commit a1dbe5f

Please sign in to comment.