Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
D
doctrine-dbal
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Tomáš Trávníček
doctrine-dbal
Commits
dc0c08aa
Commit
dc0c08aa
authored
Sep 02, 2007
by
meus
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fixing to adhere to coding standards
parent
60d62da7
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
30 additions
and
30 deletions
+30
-30
Test.php
tests/Test.php
+3
-3
run.php
tests/run.php
+27
-27
No files found.
tests/Test.php
View file @
dc0c08aa
...
...
@@ -20,14 +20,14 @@ class GroupTest extends UnitTestCase
}
public
function
shouldBeRun
(
$testCase
,
$filter
){
if
(
!
is_array
(
$filter
)){
if
(
!
is_array
(
$filter
))
{
return
true
;
}
foreach
(
$filter
as
$subFilter
){
foreach
(
$filter
as
$subFilter
)
{
$name
=
strtolower
(
get_class
(
$testCase
));
$pos
=
strpos
(
$name
,
strtolower
(
$subFilter
));
//it can be 0 so we have to use === to see if false
if
(
$pos
===
false
)
{
if
(
$pos
===
false
)
{
return
false
;
}
}
...
...
tests/run.php
View file @
dc0c08aa
...
...
@@ -3,11 +3,11 @@
ini_set
(
'max_execution_time'
,
900
);
function
parseOptions
(
$array
)
{
$currentName
=
""
;
$currentName
=
''
;
$options
=
array
();
foreach
(
$array
as
$name
)
{
if
(
strpos
(
$name
,
"-"
)
===
0
)
{
$name
=
str_replace
(
"-"
,
""
,
$name
);
if
(
strpos
(
$name
,
'-'
)
===
0
)
{
$name
=
str_replace
(
'-'
,
''
,
$name
);
$currentName
=
$name
;
if
(
!
isset
(
$options
[
$currentName
]))
{
$options
[
$currentName
]
=
array
();
...
...
@@ -415,39 +415,39 @@ class MyReporter extends HtmlReporter {
public
function
paintFooter
()
{
print
"<pre>"
;
print
'<pre>'
;
foreach
(
$this
->
_test
->
getMessages
()
as
$message
)
{
print
$message
.
"
\n
"
;
print
$message
.
'\n'
;
}
print
"</pre>"
;
$colour
=
(
$this
->
_test
->
getFailCount
()
>
0
?
"red"
:
"green"
);
print
"<div style=
\"
"
;
print
"padding: 8px; margin-top: 1em; background-color:
$colour
; color: white;"
;
print
"
\"
>"
;
print
'</pre>'
;
$colour
=
(
$this
->
_test
->
getFailCount
()
>
0
?
'red'
:
'green'
);
print
'<div style=\''
;
print
'padding: 8px; margin-top: 1em; background-color: $colour; color: white;'
;
print
'\'>'
;
print
$this
->
_test
->
getTestCaseCount
()
.
' test cases'
;
print
" test cases complete:
\n
"
;
print
"<strong>"
.
$this
->
_test
->
getPassCount
()
.
"</strong> passes and "
;
print
"<strong>"
.
$this
->
_test
->
getFailCount
()
.
"</strong> fails."
;
print
"</div>
\n
"
;
print
' test cases complete:\n'
;
print
'<strong>'
.
$this
->
_test
->
getPassCount
()
.
'</strong> passes and '
;
print
'<strong>'
.
$this
->
_test
->
getFailCount
()
.
'</strong> fails.'
;
print
'</div>'
;
}
}
?>
<?php
if
(
PHP_SAPI
===
"cli"
)
{
if
(
PHP_SAPI
===
'cli'
)
{
$reporter
=
new
CliReporter
();
}
else
{
$reporter
=
new
MyReporter
();
}
$argv
=
$_SERVER
[
"argv"
];
$argv
=
$_SERVER
[
'argv'
];
array_shift
(
$argv
);
$options
=
parseOptions
(
$argv
);
if
(
isset
(
$options
[
"group"
]))
{
$testGroup
=
new
GroupTest
(
"Custom"
);
foreach
(
$options
[
"group"
]
as
$group
)
{
if
(
isset
(
$options
[
'group'
]))
{
$testGroup
=
new
GroupTest
(
'Custom'
);
foreach
(
$options
[
'group'
]
as
$group
)
{
if
(
!
isset
(
$$group
))
{
if
(
class_exists
(
$group
))
{
$testGroup
->
addTestCase
(
new
$group
);
...
...
@@ -459,12 +459,12 @@ if( isset($options["group"])) {
}
else
{
$testGroup
=
$test
;
}
$filter
=
""
;
if
(
isset
(
$options
[
"filter"
]))
{
$filter
=
$options
[
"filter"
];
$filter
=
''
;
if
(
isset
(
$options
[
'filter'
]))
{
$filter
=
$options
[
'filter'
];
}
if
(
isset
(
$options
[
"help"
]))
{
if
(
isset
(
$options
[
'help'
]))
{
echo
"Doctrine test runner help
\n
"
;
echo
"===========================
\n
"
;
echo
" To run all tests simply run this script without arguments.
\n
"
;
...
...
@@ -476,13 +476,13 @@ if (isset($options["help"])) {
die
();
}
if
(
isset
(
$options
[
"coverage"
]))
{
if
(
isset
(
$options
[
'coverage'
]))
{
xdebug_start_code_coverage
(
XDEBUG_CC_UNUSED
|
XDEBUG_CC_DEAD_CODE
);
$testGroup
->
run
(
$reporter
,
$filter
);
$result
[
"path"
]
=
Doctrine
::
getPath
()
.
DIRECTORY_SEPARATOR
;
$result
[
"coverage"
]
=
xdebug_get_code_coverage
();
$result
[
'path'
]
=
Doctrine
::
getPath
()
.
DIRECTORY_SEPARATOR
;
$result
[
'coverage'
]
=
xdebug_get_code_coverage
();
xdebug_stop_code_coverage
();
file_put_contents
(
"coverage.txt"
,
serialize
(
$result
));
file_put_contents
(
'coverage.txt'
,
serialize
(
$result
));
}
else
{
$testGroup
->
run
(
$reporter
,
$filter
);
}
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment