Add a group for tests of the finder against the FTP server

This allows to skip them easily when running the testsuite, as they
represent a significant part of the testsuite time.
This commit is contained in:
Christophe Coevoet 2015-09-26 17:47:39 +02:00
parent 2bd0738cc5
commit 51147e3aff
1 changed files with 13 additions and 33 deletions

View File

@ -16,42 +16,36 @@ use Symfony\Component\Finder\Iterator\RecursiveDirectoryIterator;
class RecursiveDirectoryIteratorTest extends IteratorTestCase class RecursiveDirectoryIteratorTest extends IteratorTestCase
{ {
/** /**
* @dataProvider getPaths * @group network
*
* @param string $path
* @param bool $seekable
* @param bool $contains
* @param string $message
*/ */
public function testRewind($path, $seekable, $contains, $message = null) public function testRewindOnFtp()
{ {
try { try {
$i = new RecursiveDirectoryIterator($path, \RecursiveDirectoryIterator::SKIP_DOTS); $i = new RecursiveDirectoryIterator('ftp://ftp.mozilla.org/', \RecursiveDirectoryIterator::SKIP_DOTS);
} catch (\UnexpectedValueException $e) { } catch (\UnexpectedValueException $e) {
$this->markTestSkipped(sprintf('Unsupported stream "%s".', $path)); $this->markTestSkipped('Unsupported stream "ftp".');
} }
$i->rewind(); $i->rewind();
$this->assertTrue(true, $message); $this->assertTrue(true);
} }
/** /**
* @dataProvider getPaths * @group network
*
* @param string $path
* @param bool $seekable
* @param bool $contains
* @param string $message
*/ */
public function testSeek($path, $seekable, $contains, $message = null) public function testSeekOnFtp()
{ {
try { try {
$i = new RecursiveDirectoryIterator($path, \RecursiveDirectoryIterator::SKIP_DOTS); $i = new RecursiveDirectoryIterator('ftp://ftp.mozilla.org/', \RecursiveDirectoryIterator::SKIP_DOTS);
} catch (\UnexpectedValueException $e) { } 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(); $actual = array();
$i->seek(0); $i->seek(0);
@ -62,18 +56,4 @@ class RecursiveDirectoryIteratorTest extends IteratorTestCase
$this->assertEquals($contains, $actual); $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;
}
} }