minor #15924 Add a group for tests of the finder against the FTP server (stof)
This PR was merged into the 2.3 branch.
Discussion
----------
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. These 2 tests together represent 42% of the execution time of the testsuite (all the time being spent connecting to the FTP server).
I also remove the usage of the data provider as a data provider with a single dataset (and used only partially) only makes tests harder to read. and does not save any duplication.
Commits
-------
51147e3
Add a group for tests of the finder against the FTP server
This commit is contained in:
commit
8df5d94158
@ -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;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user