From ae25a9145a900764158d439653d5630191155ca0 Mon Sep 17 00:00:00 2001 From: Alexandre Daubois Date: Tue, 13 Aug 2024 14:31:45 +0200 Subject: [PATCH] Replace external FTP server by a local docker instance --- .../RecursiveDirectoryIteratorTest.php | 22 ++++++++++++++----- 1 file changed, 17 insertions(+), 5 deletions(-) diff --git a/Tests/Iterator/RecursiveDirectoryIteratorTest.php b/Tests/Iterator/RecursiveDirectoryIteratorTest.php index 353a919..c63dd6e 100644 --- a/Tests/Iterator/RecursiveDirectoryIteratorTest.php +++ b/Tests/Iterator/RecursiveDirectoryIteratorTest.php @@ -24,26 +24,38 @@ protected function setUp(): void /** * @group network + * @group integration */ public function testRewindOnFtp() { - $i = new RecursiveDirectoryIterator('ftp://test.rebex.net/', \RecursiveDirectoryIterator::SKIP_DOTS); + if (!getenv('INTEGRATION_FTP_URL')) { + self::markTestSkipped('INTEGRATION_FTP_URL env var is not defined.'); + } + + $i = new RecursiveDirectoryIterator(getenv('INTEGRATION_FTP_URL').\DIRECTORY_SEPARATOR, \RecursiveDirectoryIterator::SKIP_DOTS); $i->rewind(); - $this->assertTrue(true); + $this->expectNotToPerformAssertions(); } /** * @group network + * @group integration */ public function testSeekOnFtp() { - $i = new RecursiveDirectoryIterator('ftp://test.rebex.net/', \RecursiveDirectoryIterator::SKIP_DOTS); + if (!getenv('INTEGRATION_FTP_URL')) { + self::markTestSkipped('INTEGRATION_FTP_URL env var is not defined.'); + } + + $ftpUrl = getenv('INTEGRATION_FTP_URL'); + + $i = new RecursiveDirectoryIterator($ftpUrl.\DIRECTORY_SEPARATOR, \RecursiveDirectoryIterator::SKIP_DOTS); $contains = [ - 'ftp://test.rebex.net'.\DIRECTORY_SEPARATOR.'pub', - 'ftp://test.rebex.net'.\DIRECTORY_SEPARATOR.'readme.txt', + $ftpUrl.\DIRECTORY_SEPARATOR.'pub', + $ftpUrl.\DIRECTORY_SEPARATOR.'readme.txt', ]; $actual = [];