Skip to content

support cache plugin 2.x, bump to minimum 1.7 to always support psr17… #448

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Feb 26, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions composer.json
Original file line number Diff line number Diff line change
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
Original file line number Diff line number Diff line change
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
Original file line number Diff line number Diff line change
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