Skip to content

Commit e7ee62a

Browse files
committed
fix stability handling and workaround for symfony 8 bug
1 parent 19b9c7e commit e7ee62a

File tree

9 files changed

+24
-11
lines changed

9 files changed

+24
-11
lines changed

.github/workflows/continuous-integration.yml

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -92,14 +92,17 @@ jobs:
9292
tools: "flex"
9393

9494
- name: "Enforce using stable dependencies"
95-
run: "composer config minimum-stability stable"
96-
if: "${{ matrix.stability == 'stable' }}"
95+
run: "composer config minimum-stability ${{ matrix.stability }}"
96+
if: "${{ matrix.stability }}"
9797

9898
- name: "Add dependencies and enable flex"
9999
run: |
100100
composer config allow-plugins.symfony/flex true
101101
composer require --no-update ${{ matrix.dependencies }}
102102
103+
- name: "Work around https://github.com/symfony/symfony/pull/62692"
104+
run: "composer require --no-update symfony/console:*"
105+
103106
- name: "Install dependencies with Composer"
104107
uses: "ramsey/composer-install@v3"
105108
with:

composer.json

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -52,15 +52,15 @@
5252
},
5353
"require-dev": {
5454
"guzzlehttp/psr7": "^1.7 || ^2.0",
55-
"matthiasnoback/symfony-config-test": "^5.2",
56-
"matthiasnoback/symfony-dependency-injection-test": "^4.3.1 || ^5.0",
55+
"matthiasnoback/symfony-config-test": "^5.2 || ^v6.1.0",
56+
"matthiasnoback/symfony-dependency-injection-test": "^4.3.1 || ^5.0 || ^6.2.0",
5757
"nyholm/nsa": "^1.1",
5858
"nyholm/psr7": "^1.2.1",
5959
"php-http/cache-plugin": "^1.7",
6060
"php-http/mock-client": "^1.2",
6161
"php-http/promise": "^1.0",
6262
"php-http/throttle-plugin": "^1.1",
63-
"phpunit/phpunit": "^9",
63+
"phpunit/phpunit": "^9 || ^10.0 || ^11.0 || ^12.0",
6464
"symfony/browser-kit": "^6.4 || ^7.1 || ^8.0",
6565
"symfony/cache": "^6.4 || ^7.1 || ^8.0",
6666
"symfony/dom-crawler": "^6.4 || ^7.1 || ^8.0",
@@ -96,7 +96,6 @@
9696
"tests/Resources/app/AppKernel.php"
9797
]
9898
},
99-
"prefer-stable": false,
10099
"scripts": {
101100
"test": "vendor/bin/phpunit",
102101
"test-ci": "vendor/bin/phpunit --coverage-text --coverage-clover=build/coverage.xml"

tests/Functional/DiscoveredClientsTest.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@
1515
use Nyholm\NSA;
1616
use Psr\Http\Client\ClientInterface;
1717
use Symfony\Bundle\FrameworkBundle\Test\WebTestCase;
18+
use Symfony\Component\DependencyInjection\ContainerInterface;
1819

1920
final class DiscoveredClientsTest extends WebTestCase
2021
{
@@ -119,7 +120,7 @@ public function testForcedDiscovery(): void
119120
$this->assertEquals($container->get('httplug.client.acme'), HttpAsyncClientDiscovery::find());
120121
}
121122

122-
private function getCustomContainer($debug, $environment = 'test')
123+
private function getCustomContainer($debug, $environment = 'test'): ContainerInterface
123124
{
124125
static::bootKernel(['debug' => $debug, 'environment' => $environment]);
125126

tests/Functional/Issue206.php

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,6 @@
55
namespace Http\HttplugBundle\Tests\Functional;
66

77
use Http\Client\Common\HttpMethodsClient;
8-
use Http\Client\Common\PluginClient;
98
use Http\Client\Common\PluginClientFactory;
109
use Http\Discovery\Psr18ClientDiscovery;
1110
use Nyholm\Psr7\Factory\Psr17Factory;
@@ -24,6 +23,6 @@ public function testCustomClientDoesNotCauseException(): void
2423
$pluginClient = (new PluginClientFactory())->createClient($myCustomClient, []);
2524

2625
// If we get to this line, no exceptions has been thrown.
27-
$this->assertInstanceOf(PluginClient::class, $pluginClient);
26+
$this->addToAssertionCount(1);
2827
}
2928
}

tests/Functional/ProfilerTest.php

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
namespace Http\HttplugBundle\Tests\Functional;
66

77
use GuzzleHttp\Psr7\Request;
8+
use PHPUnit\Framework\Attributes\Group;
89
use Psr\Http\Client\ClientInterface;
910
use Symfony\Bundle\FrameworkBundle\Test\WebTestCase;
1011

@@ -13,6 +14,7 @@ final class ProfilerTest extends WebTestCase
1314
/**
1415
* @group legacy
1516
*/
17+
#[Group('legacy')]
1618
public function testShowProfiler(): void
1719
{
1820
$client = static::createClient();

tests/Functional/ProfilingTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -95,7 +95,7 @@ public function testProfiling(): void
9595
$this->assertEquals('example.com', $stack->getRequestHost());
9696
}
9797

98-
private function createClient(array $plugins, $clientName = 'Acme', array $clientOptions = [])
98+
private function createClient(array $plugins, string $clientName = 'Acme', array $clientOptions = [])
9999
{
100100
$plugins = array_map(fn (Plugin $plugin) => new ProfilePlugin($plugin, $this->collector, $this->formatter, $plugin::class), $plugins);
101101

tests/Functional/ServiceInstantiationTest.php

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@
1313
use Http\HttplugBundle\Collector\ProfilePlugin;
1414
use Http\HttplugBundle\Collector\StackPlugin;
1515
use Nyholm\NSA;
16+
use PHPUnit\Framework\Attributes\Group;
1617
use Psr\Http\Client\ClientInterface;
1718
use Psr\Http\Message\ResponseInterface;
1819
use Symfony\Bundle\FrameworkBundle\Test\WebTestCase;
@@ -55,6 +56,7 @@ public function testHttpClientNoDebug(): void
5556
/**
5657
* @group legacy
5758
*/
59+
#[Group('legacy')]
5860
public function testDebugToolbar(): void
5961
{
6062
static::bootKernel(['debug' => true]);

tests/Unit/Collector/FormatterTest.php

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@
1212
use Http\Message\Formatter as MessageFormatter;
1313
use Http\Message\Formatter\CurlCommandFormatter;
1414
use Http\Message\Formatter\SimpleFormatter;
15+
use PHPUnit\Framework\Attributes\Group;
1516
use PHPUnit\Framework\MockObject\MockObject;
1617
use PHPUnit\Framework\TestCase;
1718

@@ -66,6 +67,7 @@ public function testFormatResponseForRequest(): void
6667
/**
6768
* @group legacy
6869
*/
70+
#[Group('legacy')]
6971
public function testFormatResponse(): void
7072
{
7173
$response = new Response();

tests/Unit/DependencyInjection/HttplugExtensionTest.php

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,8 @@
99
use Http\HttplugBundle\DependencyInjection\HttplugExtension;
1010
use Http\HttplugBundle\Tests\Resources\CustomPluginConfigurator;
1111
use Matthias\SymfonyDependencyInjectionTest\PhpUnit\AbstractExtensionTestCase;
12+
use PHPUnit\Framework\Attributes\DataProvider;
13+
use PHPUnit\Framework\Attributes\Group;
1214
use Psr\Http\Client\ClientInterface;
1315
use Symfony\Component\DependencyInjection\Definition;
1416
use Symfony\Component\DependencyInjection\Reference;
@@ -505,6 +507,8 @@ public function testClientIsTaggedWithHttplugClientTag(): void
505507
*
506508
* @group vcr-plugin
507509
*/
510+
#[DataProvider('provideVcrPluginConfig')]
511+
#[Group('vcr-plugin')]
508512
public function testVcrPluginConfiguration(array $config, array $services, array $arguments = []): void
509513
{
510514
if (!class_exists(InMemoryRecorder::class)) {
@@ -529,6 +533,7 @@ public function testVcrPluginConfiguration(array $config, array $services, array
529533
/**
530534
* @group vcr-plugin
531535
*/
536+
#[Group('vcr-plugin')]
532537
public function testIsNotLoadedUnlessNeeded(): void
533538
{
534539
if (!class_exists(InMemoryRecorder::class)) {
@@ -539,7 +544,7 @@ public function testIsNotLoadedUnlessNeeded(): void
539544
$this->assertContainerBuilderNotHasService('httplug.plugin.vcr.recorder.in_memory');
540545
}
541546

542-
public function provideVcrPluginConfig()
547+
public static function provideVcrPluginConfig(): \Generator
543548
{
544549
$config = [
545550
'mode' => 'record',

0 commit comments

Comments
 (0)