2010-04-21 08:31:18 +01:00
|
|
|
<?php
|
|
|
|
|
|
|
|
/*
|
2010-04-25 16:06:54 +01:00
|
|
|
* This file is part of the Symfony package.
|
2010-04-21 08:31:18 +01:00
|
|
|
*
|
|
|
|
* (c) Fabien Potencier <fabien.potencier@symfony-project.com>
|
|
|
|
*
|
|
|
|
* For the full copyright and license information, please view the LICENSE
|
|
|
|
* file that was distributed with this source code.
|
|
|
|
*/
|
|
|
|
|
|
|
|
namespace Symfony\Tests\Components\Finder\Iterator;
|
|
|
|
|
|
|
|
require_once __DIR__.'/IteratorTestCase.php';
|
|
|
|
|
|
|
|
class RealIteratorTestCase extends IteratorTestCase
|
|
|
|
{
|
2010-05-06 12:25:53 +01:00
|
|
|
static protected $files;
|
2010-04-21 08:31:18 +01:00
|
|
|
|
2010-05-06 12:25:53 +01:00
|
|
|
static public function setUpBeforeClass()
|
2010-04-21 08:31:18 +01:00
|
|
|
{
|
2010-05-06 12:25:53 +01:00
|
|
|
$tmpDir = sys_get_temp_dir().'/symfony2_finder';
|
|
|
|
self::$files = array($tmpDir.'/.git', $tmpDir.'/test.py', $tmpDir.'/foo', $tmpDir.'/foo/bar.tmp', $tmpDir.'/test.php', $tmpDir.'/toto');
|
|
|
|
|
2010-05-07 15:09:11 +01:00
|
|
|
if (is_dir($tmpDir)) {
|
2010-05-06 12:25:53 +01:00
|
|
|
self::tearDownAfterClass();
|
|
|
|
rmdir($tmpDir);
|
|
|
|
}
|
|
|
|
mkdir($tmpDir);
|
|
|
|
|
2010-05-07 15:09:11 +01:00
|
|
|
foreach (self::$files as $file) {
|
2010-05-06 12:25:53 +01:00
|
|
|
if (false !== ($pos = strpos($file, '.')) && '/' !== $file[$pos - 1])
|
|
|
|
{
|
|
|
|
touch($file);
|
2010-05-07 15:09:11 +01:00
|
|
|
} else {
|
2010-05-06 12:25:53 +01:00
|
|
|
mkdir($file);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
file_put_contents($tmpDir.'/test.php', str_repeat(' ', 800));
|
|
|
|
file_put_contents($tmpDir.'/test.py', str_repeat(' ', 2000));
|
2010-04-21 08:31:18 +01:00
|
|
|
}
|
|
|
|
|
2010-05-06 12:25:53 +01:00
|
|
|
static public function tearDownAfterClass()
|
2010-04-21 08:31:18 +01:00
|
|
|
{
|
2010-05-07 15:09:11 +01:00
|
|
|
foreach (self::$files as $file) {
|
2010-05-06 12:25:53 +01:00
|
|
|
if (false !== ($pos = strpos($file, '.')) && '/' !== $file[$pos - 1])
|
|
|
|
{
|
|
|
|
@unlink($file);
|
2010-05-07 15:09:11 +01:00
|
|
|
} else {
|
2010-05-06 12:25:53 +01:00
|
|
|
@rmdir($file);
|
|
|
|
}
|
|
|
|
}
|
2010-04-21 08:31:18 +01:00
|
|
|
}
|
|
|
|
}
|