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
362b844c
Commit
362b844c
authored
Jul 06, 2007
by
zYne
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
--no commit message
--no commit message
parent
95b5bc1a
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
75 additions
and
9 deletions
+75
-9
Test.php
tests/Test.php
+7
-0
UnitTestCase.php
tests/UnitTestCase.php
+19
-6
run.php
tests/run.php
+49
-3
No files found.
tests/Test.php
View file @
362b844c
...
...
@@ -3,6 +3,13 @@ class GroupTest
{
protected
$_testCases
=
array
();
public
function
__construct
()
{
if
(
extension_loaded
(
'xdebug'
))
{
//xdebug_start_code_coverage(XDEBUG_CC_DEAD_CODE | XDEBUG_CC_UNUSED);
}
}
public
function
addTestCase
(
UnitTestCase
$testCase
)
{
$this
->
_testCases
[]
=
$testCase
;
...
...
tests/UnitTestCase.php
View file @
362b844c
...
...
@@ -101,6 +101,8 @@ class Doctrine_UnitTestCase extends UnitTestCase
break
;
}
$module
=
$e
[
1
];
if
(
count
(
$e
)
>
3
)
{
$driver
=
$e
[
2
];
switch
(
$e
[
2
])
{
...
...
@@ -148,12 +150,23 @@ class Doctrine_UnitTestCase extends UnitTestCase
$this
->
manager
->
setAttribute
(
Doctrine
::
ATTR_LISTENER
,
$this
->
listener
);
}
if
(
$this
->
driverName
!==
'main'
)
{
$this
->
export
=
$this
->
connection
->
export
;
$this
->
transaction
=
$this
->
connection
->
transaction
;
if
(
isset
(
$module
))
{
switch
(
$module
)
{
case
'Export'
:
case
'Import'
:
case
'Transaction'
:
case
'Sequence'
:
case
'Expression'
:
$lower
=
strtolower
(
$module
);
$this
->
$lower
=
$this
->
connection
->
$lower
;
break
;
case
'DataDict'
:
$this
->
dataDict
=
$this
->
connection
->
dataDict
;
$this
->
expr
=
$this
->
connection
->
expression
;
$this
->
sequence
=
$this
->
connection
->
sequence
;
$this
->
import
=
$this
->
connection
->
import
;
break
;
}
}
}
$this
->
unitOfWork
=
$this
->
connection
->
unitOfWork
;
$this
->
connection
->
setListener
(
new
Doctrine_EventListener
());
...
...
tests/run.php
View file @
362b844c
...
...
@@ -3,8 +3,9 @@
ini_set
(
'max_execution_time'
,
900
);
function
autoload
(
$class
)
{
if
(
strpos
(
$class
,
'TestCase'
)
===
false
)
if
(
strpos
(
$class
,
'TestCase'
)
===
false
)
{
return
false
;
}
$e
=
explode
(
'_'
,
$class
);
$count
=
count
(
$e
);
...
...
@@ -63,7 +64,6 @@ $test = new GroupTest('Doctrine Framework Unit Tests');
// DATABASE ABSTRACTION tests
/** */
// Temp tests
/**
...
...
@@ -323,7 +323,7 @@ $test->addTestCase(new Doctrine_Record_SaveBlankRecord_TestCase());
$test
->
addTestCase
(
new
Doctrine_Template_TestCase
());
/** */
//$test->addTestCase(new Doctrine_IntegrityAction_TestCase());
//$test->addTestCase(new Doctrine_AuditLog_TestCase());
...
...
@@ -375,7 +375,53 @@ class MyReporter extends HtmlReporter {
<?php
$test
->
run
(
new
MyReporter
());
$path
=
Doctrine
::
getPath
()
.
DIRECTORY_SEPARATOR
;
?>
<?php
/**
<table>
<tr>
<td>class</td>
<td>coverage</td>
</tr>
$coverage = xdebug_get_code_coverage();
ksort($coverage);
foreach ($coverage as $file => $lines) {
$pos = strpos($file, $path);
$values = array_values($lines);
$i = count($values);
$covered = 0;
while ($i--) {
if ($values[$i] > 0) {
$covered++;
}
}
if ($pos !== false) {
$class = str_replace(DIRECTORY_SEPARATOR, '_', substr($file, strlen($path), -4));
if (strpos($class, '_Interface')) {
continue;
}
$refl = new ReflectionClass($class);
$total = 0;
foreach ($refl->getMethods() as $method) {
$total += ($method->getEndLine() - $method->getStartLine());
}
if ($total === 0) {
$total = 1;
}
print "<tr><td>" . $class . "</td><td>" . round(($covered / $total) * 100, 2) . " % </td></tr>";
}
}
*/
?>
</table>
</body>
</html>
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