Skip to content

Commit 19c3171

Browse files
Merge pull request #406 from symfony/cleanup
Cleanups
2 parents 09e4a2e + c37c6e5 commit 19c3171

File tree

11 files changed

+17
-20
lines changed

11 files changed

+17
-20
lines changed

README.md

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -41,9 +41,6 @@ Use [Composer](https://getcomposer.org/) to install Panther in your project. You
4141

4242
composer req --dev symfony/panther
4343

44-
**Warning:** On \*nix systems, the `unzip` command must be installed, or you will encounter an error similar to `RuntimeException: sh: 1: exec: /app/vendor/symfony/panther/src/ProcessManager/../../chromedriver-bin/chromedriver_linux64: Permission denied` (or `chromedriver_linux64: not found`).
45-
The underlying reason is that PHP's `ZipArchive` doesn't preserve UNIX executable permissions.
46-
4744
### Installing ChromeDriver and geckodriver
4845

4946
Panther uses the WebDriver protocol to control the browser used to crawl websites.

src/DomCrawler/Crawler.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,7 @@ public function addHtmlContent($content, $charset = 'UTF-8'): void
6161
throw $this->createNotSupportedException(__METHOD__);
6262
}
6363

64-
public function addXmlContent($content, $charset = 'UTF-8', $options = LIBXML_NONET): void
64+
public function addXmlContent($content, $charset = 'UTF-8', $options = \LIBXML_NONET): void
6565
{
6666
throw $this->createNotSupportedException(__METHOD__);
6767
}

src/DomCrawler/Field/FileFormField.php

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -37,14 +37,14 @@ public function setValue($value)
3737
$value = $this->sanitizeValue($value);
3838

3939
if (null !== $value && \is_readable($value)) {
40-
$error = UPLOAD_ERR_OK;
40+
$error = \UPLOAD_ERR_OK;
4141
$size = \filesize($value);
42-
$name = \pathinfo($value, PATHINFO_BASENAME);
42+
$name = \pathinfo($value, \PATHINFO_BASENAME);
4343

4444
$this->setFilePath($value);
4545
$value = $this->element->getAttribute('value');
4646
} else {
47-
$error = UPLOAD_ERR_NO_FILE;
47+
$error = \UPLOAD_ERR_NO_FILE;
4848
$size = 0;
4949
$name = '';
5050
$value = '';
@@ -91,11 +91,11 @@ protected function initialize()
9191
private function setValueFromTmp($tmpValue)
9292
{
9393
$value = $tmpValue;
94-
$error = UPLOAD_ERR_OK;
94+
$error = \UPLOAD_ERR_OK;
9595
// size not determinable
9696
$size = 0;
9797
// C:\fakepath\filename.extension
98-
$basename = \pathinfo($value, PATHINFO_BASENAME);
98+
$basename = \pathinfo($value, \PATHINFO_BASENAME);
9999
$nameParts = \explode('\\', $basename);
100100
$name = \end($nameParts);
101101

src/PantherTestCase.php

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -19,11 +19,11 @@
1919
if (\class_exists(WebTestCase::class)) {
2020
abstract class PantherTestCase extends WebTestCase
2121
{
22+
use WebTestAssertionsTrait;
23+
2224
public const CHROME = 'chrome';
2325
public const FIREFOX = 'firefox';
2426

25-
use WebTestAssertionsTrait;
26-
2727
protected function tearDown(): void
2828
{
2929
$this->doTearDown();
@@ -39,9 +39,9 @@ private function doTearDown(): void
3939
// Without Symfony
4040
abstract class PantherTestCase extends TestCase
4141
{
42+
use PantherTestCaseTrait;
43+
4244
public const CHROME = 'chrome';
4345
public const FIREFOX = 'firefox';
44-
45-
use PantherTestCaseTrait;
4646
}
4747
}

src/ProcessManager/ChromeManager.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -82,7 +82,7 @@ public function quit(): void
8282
private function findChromeDriverBinary(): string
8383
{
8484
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);
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);
8686

8787
return $binary;
8888
}

src/ProcessManager/FirefoxManager.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -81,7 +81,7 @@ public function quit(): void
8181
private function findGeckodriverBinary(): string
8282
{
8383
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);
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);
8585

8686
return $binary;
8787
}

src/ServerListener.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ final class ServerListener implements TestListener
2929

3030
public function __construct()
3131
{
32-
@trigger_error(sprintf('The "%s" class is deprecated since Panther 0.6, use "%s" instead.', self::class, ServerExtension::class), E_USER_DEPRECATED);
32+
@trigger_error(sprintf('The "%s" class is deprecated since Panther 0.6, use "%s" instead.', self::class, ServerExtension::class), \E_USER_DEPRECATED);
3333
}
3434

3535
public function startTestSuite(TestSuite $suite): void

src/ServerTrait.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ private function pause($message): void
4040
) {
4141
echo "$message\n\nPress enter to continue...";
4242
if (!$this->testing) {
43-
fgets(STDIN);
43+
fgets(\STDIN);
4444
}
4545
}
4646
}

tests/DomCrawler/Field/FileFormFieldTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -109,7 +109,7 @@ public function testFileUploadWithInvalidValue(callable $clientFactory)
109109
'name' => '',
110110
'type' => '',
111111
'tmp_name' => '',
112-
'error' => UPLOAD_ERR_NO_FILE,
112+
'error' => \UPLOAD_ERR_NO_FILE,
113113
'size' => 0,
114114
],
115115
$fileFormField->getValue()

tests/WebDriver/WebDriverCheckBoxTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -147,7 +147,7 @@ public function testWebDriverCheckboxSelectByIndexInvalid()
147147
$element = $crawler->filterXPath('//input[@type="checkbox"]')->getElement(0);
148148

149149
$c = new WebDriverCheckbox($element);
150-
$c->selectByIndex(PHP_INT_MAX);
150+
$c->selectByIndex(\PHP_INT_MAX);
151151
}
152152

153153
/**

0 commit comments

Comments
 (0)