Skip to content

Commit

Permalink
Add a group for tests of the finder against the FTP server
Browse files Browse the repository at this point in the history
This allows to skip them easily when running the testsuite, as they
represent a significant part of the testsuite time.
  • Loading branch information
stof committed Sep 26, 2015
1 parent c7b0ff1 commit 11a5cee
Showing 1 changed file with 13 additions and 33 deletions.
46 changes: 13 additions & 33 deletions Tests/Iterator/RecursiveDirectoryIteratorTest.php
Expand Up @@ -16,42 +16,36 @@
class RecursiveDirectoryIteratorTest extends IteratorTestCase
{
/**
* @dataProvider getPaths
*
* @param string $path
* @param bool $seekable
* @param bool $contains
* @param string $message
* @group network
*/
public function testRewind($path, $seekable, $contains, $message = null)
public function testRewindOnFtp()
{
try {
$i = new RecursiveDirectoryIterator($path, \RecursiveDirectoryIterator::SKIP_DOTS);
$i = new RecursiveDirectoryIterator('ftp://ftp.mozilla.org/', \RecursiveDirectoryIterator::SKIP_DOTS);
} catch (\UnexpectedValueException $e) {
$this->markTestSkipped(sprintf('Unsupported stream "%s".', $path));
$this->markTestSkipped('Unsupported stream "ftp".');
}

$i->rewind();

$this->assertTrue(true, $message);
$this->assertTrue(true);
}

/**
* @dataProvider getPaths
*
* @param string $path
* @param bool $seekable
* @param bool $contains
* @param string $message
* @group network
*/
public function testSeek($path, $seekable, $contains, $message = null)
public function testSeekOnFtp()
{
try {
$i = new RecursiveDirectoryIterator($path, \RecursiveDirectoryIterator::SKIP_DOTS);
$i = new RecursiveDirectoryIterator('ftp://ftp.mozilla.org/', \RecursiveDirectoryIterator::SKIP_DOTS);
} catch (\UnexpectedValueException $e) {
$this->markTestSkipped(sprintf('Unsupported stream "%s".', $path));
$this->markTestSkipped('Unsupported stream "ftp".');
}

$contains = array(
'ftp://ftp.mozilla.org'.DIRECTORY_SEPARATOR.'README',
'ftp://ftp.mozilla.org'.DIRECTORY_SEPARATOR.'pub',
);
$actual = array();

$i->seek(0);
Expand All @@ -62,18 +56,4 @@ public function testSeek($path, $seekable, $contains, $message = null)

$this->assertEquals($contains, $actual);
}

public function getPaths()
{
$data = array();

// ftp
$contains = array(
'ftp://ftp.mozilla.org'.DIRECTORY_SEPARATOR.'README',
'ftp://ftp.mozilla.org'.DIRECTORY_SEPARATOR.'pub',
);
$data[] = array('ftp://ftp.mozilla.org/', false, $contains);

return $data;
}
}

0 comments on commit 11a5cee

Please sign in to comment.