Code
Explorer
You are a developer and looking for Shopware projects?
Apply Now!
ignoreVCS example
$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
(
[
'gitignore/search_root/b.txt',
'gitignore/search_root/c.txt',
'gitignore/search_root/dir',
'gitignore/search_root/dir/a.txt',
$this
->
stopServer
(
)
;
foreach
(
$this
->portLocks
as
$lock
)
{
$lock
->
release
(
)
;
}
$ws
=
$this
->
getWorkspaceDirectory
(
)
;
$fs
=
new
SymfonyFilesystem
(
)
;
if
(
$this
->destroyBuild &&
$fs
->
exists
(
$ws
)
)
{
// Filter out symlinks as chmod cannot alter them.
$finder
=
new
Finder
(
)
;
$finder
->
in
(
$ws
)
->
directories
(
)
->
ignoreVCS
(
FALSE
)
->
ignoreDotFiles
(
FALSE
)
// composer script is a symlink and fails chmod. Ignore it. ->
notPath
(
'/^vendor\/bin\/composer$/'
)
;
$fs
->
chmod
(
$finder
->
getIterator
(
)
, 0775, 0000
)
;
$fs
->
remove
(
$ws
)
;
}
}
/** * Get the working directory within the workspace, creating if necessary. * * @param string $working_dir * The path within the workspace directory. * * @return string * The full path to the working directory within the workspace directory. */
'qux_1000_1.php',
'qux_1002_0.php',
'qux_10_2.php',
'qux_12_0.php',
'qux_2_0.php',
]
)
,
$finder
->
in
(
self::
$tmpDir
)
->
getIterator
(
)
)
;
}
public
function
testIgnoreVCS
(
)
{
$finder
=
$this
->
buildFinder
(
)
;
$this
->
assertSame
(
$finder
,
$finder
->
ignoreVCS
(
false
)
->
ignoreDotFiles
(
false
)
)
;
$this
->
assertIterator
(
$this
->
toAbsolute
(
[
'.git',
'foo',
'foo/bar.tmp',
'test.php',
'test.py',
'toto',
'toto/.git',
'.bar',
'.foo',
'.foo/.bar',