Skip to content

Commit c523916

Browse files
committed
improve ftp support detection in testing suite
1 parent ad49689 commit c523916

File tree

1 file changed

+13
-10
lines changed

1 file changed

+13
-10
lines changed

src/Symfony/Component/Finder/Tests/Iterator/RecursiveDirectoryIteratorTest.php

Lines changed: 13 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -15,16 +15,21 @@
1515

1616
class RecursiveDirectoryIteratorTest extends IteratorTestCase
1717
{
18+
protected function skipIfNoFtpSupport(): void
19+
{
20+
if (!\in_array('ftp', stream_get_wrappers(), true) || !\ini_get('allow_url_fopen')) {
21+
$this->markTestSkipped('Unsupported stream "ftp".');
22+
}
23+
}
24+
1825
/**
1926
* @group network
2027
*/
2128
public function testRewindOnFtp()
2229
{
23-
try {
24-
$i = new RecursiveDirectoryIterator('ftp://speedtest:speedtest@ftp.otenet.gr/', \RecursiveDirectoryIterator::SKIP_DOTS);
25-
} catch (\UnexpectedValueException $e) {
26-
$this->markTestSkipped('Unsupported stream "ftp".');
27-
}
30+
$this->skipIfNoFtpSupport();
31+
32+
$i = new RecursiveDirectoryIterator('ftp://speedtest:speedtest@ftp.otenet.gr/', \RecursiveDirectoryIterator::SKIP_DOTS);
2833

2934
$i->rewind();
3035

@@ -36,11 +41,9 @@ public function testRewindOnFtp()
3641
*/
3742
public function testSeekOnFtp()
3843
{
39-
try {
40-
$i = new RecursiveDirectoryIterator('ftp://speedtest:speedtest@ftp.otenet.gr/', \RecursiveDirectoryIterator::SKIP_DOTS);
41-
} catch (\UnexpectedValueException $e) {
42-
$this->markTestSkipped('Unsupported stream "ftp".');
43-
}
44+
$this->skipIfNoFtpSupport();
45+
46+
$i = new RecursiveDirectoryIterator('ftp://speedtest:speedtest@ftp.otenet.gr/', \RecursiveDirectoryIterator::SKIP_DOTS);
4447

4548
$contains = [
4649
'ftp://speedtest:speedtest@ftp.otenet.gr'.\DIRECTORY_SEPARATOR.'test100Mb.db',

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy