Skip to content

Commit 63e55d7

Browse files
Fix Twig 3.x compatibility
Co-authored-by: Gabriel Ostrolucký <[email protected]>
1 parent b6cc722 commit 63e55d7

File tree

6 files changed

+18
-9
lines changed

6 files changed

+18
-9
lines changed

.github/workflows/continuous-integration.yml

+2-2
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ jobs:
1919
matrix:
2020
include:
2121
# Minimum supported Symfony version and lowest PHP version
22-
- dependencies: "php-http/guzzle7-adapter"
22+
- dependencies: "php-http/guzzle7-adapter php-http/discovery:^1.12"
2323
php-version: "7.3"
2424
dependency-versions: "lowest"
2525
symfony-deprecations-helper: "weak"
@@ -91,7 +91,7 @@ jobs:
9191
- name: "Install dependencies with Composer"
9292
uses: "ramsey/composer-install@v1"
9393
with:
94-
dependency-versions: "${{ matrix.dependencies }}"
94+
dependency-versions: "${{ matrix.dependency-versions }}"
9595
composer-options: "${{ matrix.composer-options }}"
9696

9797
- name: "Run PHPUnit"

CHANGELOG.md

+2-1
Original file line numberDiff line numberDiff line change
@@ -2,10 +2,11 @@
22

33
The change log describes what is "Added", "Removed", "Changed" or "Fixed" between each release.
44

5-
# 1.24.0 - unreleased
5+
# 1.24.0 - 2021-10-23
66
- Changed stopwatch category from default to "httplug", so it's more prominent on Execution timeline view
77
- Changed tab texts inside profiler so that it shows ports in URL in case it's non-standard
88
- Changed default logging plugin monolog channel from "app" to "httplug"
9+
- Fixed compatibility with Twig 3.x
910

1011
# 1.23.1 - 2021-10-13
1112
- Fixed issue with whitespaces in URL when URL in tab was copied

composer.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@
5959
"symfony/dom-crawler": "^3.4.34 || ^4.2.12 || ^5.0",
6060
"symfony/framework-bundle": "^3.4.34 || ^4.2.12 || ^5.0",
6161
"symfony/http-foundation": "^3.4.35 || ~4.2.12 || ^4.3.8 || ^5.0",
62-
"symfony/phpunit-bridge": "^3.4.34 || ^4.2.12 || ^5.0",
62+
"symfony/phpunit-bridge": "^5.3",
6363
"symfony/stopwatch": "^3.4.34 || ^4.2.12 || ^5.0",
6464
"symfony/twig-bundle": "^3.4.34 || ^4.2.12 || ^5.0",
6565
"symfony/web-profiler-bundle": "^3.4.34 || ^4.2.12 || ^5.0",

src/Resources/views/stack.html.twig

+2-2
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
{% endif %}
88
<span class="label httplug-method httplug-method-{{ stack.requestMethod|lower }}">{{ stack.requestMethod }}</span>
99
</div>
10-
{% spaceless %}
10+
{% apply spaceless %}
1111
<div class="label httplug-stack-header-target">
1212
<span class="httplug-scheme">{{ stack.requestScheme }}://</span>
1313
<span class="httplug-host">{{ stack.requestHost }}</span>
@@ -16,7 +16,7 @@
1616
{% endif %}
1717
<span class="httplug-target">{{ stack.requestTarget }}</span>
1818
</div>
19-
{% endspaceless %}
19+
{% endapply %}
2020
<div>
2121
<span class="label httplug-duration">{{ stack.duration|number_format }} ms</span>
2222
{% if stack.responseCode >= 400 and stack.responseCode <= 599 %}

tests/Functional/ProfilerTest.php

+10-1
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,8 @@
44

55
namespace Http\HttplugBundle\Tests\Functional;
66

7+
use GuzzleHttp\Psr7\Request;
8+
use Http\Client\HttpClient;
79
use Symfony\Bundle\FrameworkBundle\Test\WebTestCase;
810

911
class ProfilerTest extends WebTestCase
@@ -14,12 +16,19 @@ class ProfilerTest extends WebTestCase
1416
public function testShowProfiler(): void
1517
{
1618
$client = static::createClient();
19+
$httpClient = $client->getContainer()->get('httplug.client.acme');
20+
21+
assert($httpClient instanceof HttpClient);
22+
23+
$httpClient->sendRequest(new Request('GET', '/posts/1'));
1724

1825
//Browse any page to get a profile
1926
$client->request('GET', '/');
2027

2128
$client->request('GET', '/_profiler/latest?panel=httplug');
2229
$content = $client->getResponse()->getContent();
23-
$this->assertTrue(false !== strpos($content, '<h2>HTTPlug</h2>'));
30+
$this->assertStringContainsString(<<<HTML
31+
<div class="label httplug-stack-header-target"><span class="httplug-scheme">https://</span><span class="httplug-host">jsonplaceholder.typicode.com</span><span class="httplug-target">/posts/1</span></div>
32+
HTML, $content);
2433
}
2534
}

tests/Resources/app/config/config_test.yml

+1-2
Original file line numberDiff line numberDiff line change
@@ -7,15 +7,14 @@ httplug:
77
async_client: auto
88
clients:
99
acme:
10-
factory: httplug.factory.guzzle7
1110
plugins:
1211
-
1312
decoder:
1413
use_content_encoding: false
1514
- app.http.plugin.custom
1615
-
1716
add_host:
18-
host: "http://localhost:8000"
17+
host: "https://jsonplaceholder.typicode.com"
1918
-
2019
authentication:
2120
my_basic:

0 commit comments

Comments
 (0)