File tree 1 file changed +13
-10
lines changed
Filter options
src/Symfony/Component/Finder/Tests/Iterator
1 file changed +13
-10
lines changed
Original file line number Diff line number Diff line change 15
15
16
16
class RecursiveDirectoryIteratorTest extends IteratorTestCase
17
17
{
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
+
18
25
/**
19
26
* @group network
20
27
*/
21
28
public function testRewindOnFtp ()
22
29
{
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 );
28
33
29
34
$ i ->rewind ();
30
35
@@ -36,11 +41,9 @@ public function testRewindOnFtp()
36
41
*/
37
42
public function testSeekOnFtp ()
38
43
{
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 );
44
47
45
48
$ contains = [
46
49
'ftp://speedtest:speedtest@ftp.otenet.gr ' .\DIRECTORY_SEPARATOR .'test100Mb.db ' ,
You can’t perform that action at this time.
0 commit comments