Skip to content

Commit

Permalink
Merge pull request #448 from php-http/support-cache-2.x
Browse files Browse the repository at this point in the history
support cache plugin 2.x, bump to minimum 1.7 to always support psr17…
  • Loading branch information
dbu committed Feb 26, 2024
2 parents 22dae44 + 74064d1 commit c11415a
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 7 deletions.
1 change: 1 addition & 0 deletions composer.json
Expand Up @@ -43,6 +43,7 @@
},
"conflict": {
"php-http/guzzle6-adapter": "<1.1",
"php-http/cache-plugin": "<1.7.0",
"php-http/curl-client": "<2.0",
"php-http/socket-client": "<2.0"
},
Expand Down
8 changes: 4 additions & 4 deletions src/DependencyInjection/Configuration.php
Expand Up @@ -13,8 +13,8 @@
use Http\Client\Plugin\Vcr\Recorder\RecorderInterface;
use Http\Message\CookieJar;
use Http\Message\Formatter;
use Http\Message\StreamFactory;
use Psr\Cache\CacheItemPoolInterface;
use Psr\Http\Message\StreamFactoryInterface;
use Psr\Log\LoggerInterface;
use Symfony\Component\Config\Definition\Builder\ArrayNodeDefinition;
use Symfony\Component\Config\Definition\Builder\NodeDefinition;
Expand Down Expand Up @@ -744,7 +744,7 @@ private function createCachePluginNode(): NodeDefinition
// Cannot set both respect_cache_headers and respect_response_cache_directives
return isset($config['respect_cache_headers'], $config['respect_response_cache_directives']);
})
->thenInvalid('You can\'t provide config option "respect_cache_headers" and "respect_response_cache_directives" simultaniously. Use "respect_response_cache_directives" instead.')
->thenInvalid('You can\'t provide config option "respect_cache_headers" and "respect_response_cache_directives" simultaneously. Use "respect_response_cache_directives" instead.')
->end()
->children()
->scalarNode('cache_key_generator')
Expand Down Expand Up @@ -856,8 +856,8 @@ private function createCachePluginNode(): NodeDefinition
->cannotBeEmpty()
->end()
->scalarNode('stream_factory')
->info('This must be a service id to a service implementing '.StreamFactory::class)
->defaultValue('httplug.stream_factory')
->info('This must be a service id to a service implementing '.StreamFactoryInterface::class)
->defaultValue('httplug.psr17_stream_factory')
->cannotBeEmpty()
->end()
->end()
Expand Down
6 changes: 3 additions & 3 deletions tests/Unit/DependencyInjection/ConfigurationTest.php
Expand Up @@ -59,7 +59,7 @@ class ConfigurationTest extends AbstractExtensionConfigurationTestCase
'authentication' => [],
'cache' => [
'enabled' => false,
'stream_factory' => 'httplug.stream_factory',
'stream_factory' => 'httplug.psr17_stream_factory',
'config' => [
'methods' => ['GET', 'HEAD'],
'blacklisted_paths' => [],
Expand Down Expand Up @@ -363,7 +363,7 @@ public function testInvalidCacheConfig(): void
$file = __DIR__.'/../../Resources/Fixtures/config/invalid_cache_config.yml';

$this->expectException(InvalidConfigurationException::class);
$this->expectExceptionMessage('Invalid configuration for path "httplug.plugins.cache.config": You can\'t provide config option "respect_cache_headers" and "respect_response_cache_directives" simultaniously. Use "respect_response_cache_directives" instead.');
$this->expectExceptionMessage('Invalid configuration for path "httplug.plugins.cache.config": You can\'t provide config option "respect_cache_headers" and "respect_response_cache_directives" simultaneously. Use "respect_response_cache_directives" instead.');
$this->assertProcessedConfigurationEquals([], [$file]);
}

Expand Down Expand Up @@ -492,7 +492,7 @@ public function testNullDefaultTtl(): void
],
'cache_pool' => 'my_custom_cache_pull',
'enabled' => true,
'stream_factory' => 'httplug.stream_factory',
'stream_factory' => 'httplug.psr17_stream_factory',
],
],
],
Expand Down

0 comments on commit c11415a

Please sign in to comment.