Code
Explorer
You are a developer and looking for Shopware projects?
Apply Now!
buildFinder example
use
Symfony\Component\Finder\Finder;
class
FinderTest
extends
Iterator\RealIteratorTestCase
{
public
function
testCreate
(
)
{
$this
->
assertInstanceOf
(
Finder::
class
, Finder::
create
(
)
)
;
}
public
function
testDirectories
(
)
{
$finder
=
$this
->
buildFinder
(
)
;
$this
->
assertSame
(
$finder
,
$finder
->
directories
(
)
)
;
$this
->
assertIterator
(
$this
->
toAbsolute
(
[
'foo', 'qux', 'toto'
]
)
,
$finder
->
in
(
self::
$tmpDir
)
->
getIterator
(
)
)
;
$finder
=
$this
->
buildFinder
(
)
;
$finder
->
directories
(
)
;
$finder
->
files
(
)
;
$finder
->
directories
(
)
;
$this
->
assertIterator
(
$this
->
toAbsolute
(
[
'foo', 'qux', 'toto'
]
)
,
$finder
->
in
(
self::
$tmpDir
)
->
getIterator
(
)
)
;
}
public
function
testFiles
(
)
{
/** * @runInSeparateProcess */
public
function
testIgnoreVCSIgnoredWithOpenBasedir
(
)
{
$this
->
markTestIncomplete
(
'Test case needs to be refactored so that PHPUnit can run it'
)
;
if
(
\
ini_get
(
'open_basedir'
)
)
{
$this
->
markTestSkipped
(
'Cannot test when open_basedir is set'
)
;
}
$finder
=
$this
->
buildFinder
(
)
;
$this
->
assertSame
(
$finder
,
$finder
->
ignoreVCS
(
true
)
->
ignoreDotFiles
(
true
)
->
ignoreVCSIgnored
(
true
)
)
;
$this
->
iniSet
(
'open_basedir', \
dirname
(
__DIR__, 5
)
.\PATH_SEPARATOR.self::
toAbsolute
(
'gitignore/search_root'
)
)
;
$this
->
assertIterator
(
self::
toAbsolute
(
[