Skip to content

Commit a4d4227

Browse files
authored
Remove support for deprecated features (#414)
1 parent 1883612 commit a4d4227

File tree

10 files changed

+8
-204
lines changed

10 files changed

+8
-204
lines changed

CHANGELOG.md

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,14 @@
11
CHANGELOG
22
=========
33

4+
1.0.0
5+
-----
6+
7+
* Add type hints
8+
* Remove the deprecated PHPUnit listener, use the PHPUnit extension instead
9+
* Remove deprecated support for Goutte, use `HttpBrowser` instead
10+
* Remove deprecated support for `PANTHER_CHROME_DRIVER_BINARY` and `PANTHER_GECKO_DRIVER_BINARY` environment variables, add the binaries in your `PATH` instead
11+
412
0.9.0
513
-----
614

README.md

Lines changed: 0 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -93,17 +93,6 @@ Without the extension, the web server used by Panther to serve the application u
9393
stopped when `tearDownAfterClass()` is called.
9494
On the other hand, when the extension is registered, the web server will be stopped only after the very last test.
9595

96-
To use the Panther extension, PHPUnit 7.3+ is required. Nonetheless, a listener is provided for older versions:
97-
98-
```xml
99-
<!-- phpunit.xml.dist -->
100-
<listeners>
101-
<listener class="Symfony\Component\Panther\ServerListener" />
102-
</listeners>
103-
```
104-
105-
This listener will start the web server on demand like previously, but it will stop it after each test suite.
106-
10796
### Basic Usage
10897

10998
```php

composer.json

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -42,8 +42,6 @@
4242
"sort-packages": true
4343
},
4444
"require-dev": {
45-
"fabpot/goutte": "^3.2.3",
46-
"guzzlehttp/guzzle": "^6.3",
4745
"symfony/css-selector": "^4.4 || ^5.0",
4846
"symfony/framework-bundle": "^4.4 || ^5.0",
4947
"symfony/mime": "^4.4 || ^5.0",

src/PantherTestCaseTrait.php

Lines changed: 0 additions & 40 deletions
Original file line numberDiff line numberDiff line change
@@ -13,8 +13,6 @@
1313

1414
namespace Symfony\Component\Panther;
1515

16-
use Goutte\Client as GoutteClient;
17-
use GuzzleHttp\Client as GuzzleClient;
1816
use Symfony\Bundle\FrameworkBundle\Test\KernelTestCase;
1917
use Symfony\Component\BrowserKit\HttpBrowser as HttpBrowserClient;
2018
use Symfony\Component\HttpClient\HttpClient;
@@ -50,13 +48,6 @@ trait PantherTestCaseTrait
5048
*/
5149
protected static $baseUri;
5250

53-
/**
54-
* @var GoutteClient|null
55-
*
56-
* @deprecated since Panther 0.7
57-
*/
58-
protected static $goutteClient;
59-
6051
/**
6152
* @var HttpBrowserClient|null
6253
*/
@@ -110,10 +101,6 @@ public static function stopWebServer(): void
110101
self::$pantherClients = [];
111102
}
112103

113-
if (null !== self::$goutteClient) {
114-
self::$goutteClient = null;
115-
}
116-
117104
if (null !== self::$httpBrowserClient) {
118105
self::$httpBrowserClient = null;
119106
}
@@ -207,33 +194,6 @@ protected static function createAdditionalPantherClient(): PantherClient
207194
return self::$pantherClient;
208195
}
209196

210-
/**
211-
* @param array $options see {@see $defaultOptions}
212-
*
213-
* @deprecated since Panther 0.7, use createHttpBrowserClient instead
214-
*/
215-
protected static function createGoutteClient(array $options = [], array $kernelOptions = []): GoutteClient
216-
{
217-
if (!\class_exists(GoutteClient::class)) {
218-
throw new \RuntimeException('Goutte is not installed. Run "composer req fabpot/goutte".');
219-
}
220-
221-
self::startWebServer($options);
222-
if (null === self::$goutteClient) {
223-
$goutteClient = new GoutteClient();
224-
$goutteClient->setClient(new GuzzleClient(['base_uri' => self::$baseUri]));
225-
226-
self::$goutteClient = $goutteClient;
227-
}
228-
229-
if (\is_a(self::class, KernelTestCase::class, true)) {
230-
static::bootKernel($kernelOptions); // @phpstan-ignore-line
231-
}
232-
233-
// It's not possible to use assertions with Goutte yet, https://github.com/FriendsOfPHP/Goutte/pull/382 needed
234-
return self::$goutteClient;
235-
}
236-
237197
/**
238198
* @param array $options see {@see $defaultOptions}
239199
*/

src/ProcessManager/ChromeManager.php

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -81,12 +81,6 @@ public function quit(): void
8181
*/
8282
private function findChromeDriverBinary(): string
8383
{
84-
if ($binary = $_SERVER['PANTHER_CHROME_DRIVER_BINARY'] ?? null) {
85-
@trigger_error('The "PANTHER_CHROME_DRIVER_BINARY" environment variable is deprecated since Panther 0.9, add ChromeDriver to your PATH instead.', \E_USER_DEPRECATED);
86-
87-
return $binary;
88-
}
89-
9084
if ($binary = (new ExecutableFinder())->find('chromedriver', null, ['./drivers'])) {
9185
return $binary;
9286
}

src/ProcessManager/FirefoxManager.php

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -80,12 +80,6 @@ public function quit(): void
8080
*/
8181
private function findGeckodriverBinary(): string
8282
{
83-
if ($binary = $_SERVER['PANTHER_GECKO_DRIVER_BINARY'] ?? null) {
84-
@trigger_error('The "PANTHER_GECKO_DRIVER_BINARY" environment variable is deprecated since Panther 0.9, add geckodriver to your PATH instead.', \E_USER_DEPRECATED);
85-
86-
return $binary;
87-
}
88-
8983
if ($binary = (new ExecutableFinder())->find('geckodriver', null, ['./drivers'])) {
9084
return $binary;
9185
}

src/ProcessManager/WebServerManager.php

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -72,12 +72,6 @@ public function __construct(string $documentRoot, string $hostname, int $port, s
7272
null
7373
);
7474
$this->process->disableOutput();
75-
76-
// Symfony Process 3.4 BC: In newer versions env variables always inherit,
77-
// but in 4.4 inheritEnvironmentVariables is deprecated, but setOptions was removed
78-
if (\is_callable([$this->process, 'inheritEnvironmentVariables']) && \is_callable([$this->process, 'setOptions'])) {
79-
$this->process->inheritEnvironmentVariables(true);
80-
}
8175
}
8276

8377
public function start(): void

src/ServerListener.php

Lines changed: 0 additions & 54 deletions
This file was deleted.

tests/ServerListenerTest.php

Lines changed: 0 additions & 77 deletions
This file was deleted.

tests/TestCase.php

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,6 @@
1313

1414
namespace Symfony\Component\Panther\Tests;
1515

16-
use Goutte\Client as GoutteClient;
1716
use Symfony\Component\BrowserKit\HttpBrowser as HttpBrowserClient;
1817
use Symfony\Component\DomCrawler\Crawler;
1918
use Symfony\Component\Panther\Client as PantherClient;
@@ -31,7 +30,6 @@ abstract class TestCase extends PantherTestCase
3130
public function clientFactoryProvider(): iterable
3231
{
3332
// Tests must pass with both Panther and HttpBrowser
34-
yield 'Goutte' => [[static::class, 'createGoutteClient'], GoutteClient::class];
3533
yield 'HttpBrowser' => [[static::class, 'createHttpBrowserClient'], HttpBrowserClient::class];
3634
yield 'Panther' => [[static::class, 'createPantherClient'], PantherClient::class];
3735

0 commit comments

Comments
 (0)