Browse files

- Merge [890].

  • Loading branch information...
1 parent 2c8129f commit c3016ab7233fdbcc732744070484bc979ad0572e @sebastianbergmann committed Aug 2, 2007
View
19 PHPUnit/Util/Log/CodeCoverage/Database.php
@@ -149,8 +149,9 @@ public function storeCodeCoverage(PHPUnit_Framework_TestResult $result, $revisio
$stmt = $this->dbh->prepare(
'INSERT INTO code_class
(code_file_id, code_class_name,
- code_class_start_line, code_class_end_line)
- VALUES(:fileId, :className, :startLine, :endLine);'
+ code_class_start_line, code_class_end_line,
+ code_class_wmc)
+ VALUES(:fileId, :className, :startLine, :endLine, 0);'
);
foreach ($classes as $class) {
@@ -174,6 +175,8 @@ public function storeCodeCoverage(PHPUnit_Framework_TestResult $result, $revisio
VALUES(:classId, :methodName, :startLine, :endLine, :ccn);'
);
+ $wmc = 0;
+
foreach ($class->getMethods() as $method) {
if ($class->getName() != $method->getDeclaringClass()->getName()) {
continue;
@@ -190,12 +193,24 @@ public function storeCodeCoverage(PHPUnit_Framework_TestResult $result, $revisio
$stmt2->bindParam(':endLine', $endLine, PDO::PARAM_INT);
$stmt2->bindParam(':ccn', $ccn, PDO::PARAM_INT);
$stmt2->execute();
+
+ $wmc += $ccn;
}
unset($stmt2);
}
$stmt = $this->dbh->prepare(
+ 'UPDATE code_class
+ SET code_class_wmc = :wmc
+ WHERE code_class_id = :classId;'
+ );
+
+ $stmt->bindParam(':classId', $classId, PDO::PARAM_INT);
+ $stmt->bindParam(':wmc', $wmc, PDO::PARAM_INT);
+ $stmt->execute();
+
+ $stmt = $this->dbh->prepare(
'INSERT INTO code_line
(code_file_id, code_line_number, code_line,
code_line_covered)
View
1 PHPUnit/Util/Log/Database/MySQL.sql
@@ -79,6 +79,7 @@ CREATE TABLE IF NOT EXISTS code_class(
code_class_name CHAR(255),
code_class_start_line INTEGER UNSIGNED NOT NULL,
code_class_end_line INTEGER UNSIGNED NOT NULL,
+ code_class_wmc INTEGER UNSIGNED NOT NULL,
INDEX (code_file_id)
) ENGINE=InnoDB;
View
3 PHPUnit/Util/Log/Database/SQLite3.sql
@@ -78,7 +78,8 @@ CREATE TABLE IF NOT EXISTS code_class(
code_class_id INTEGER PRIMARY KEY AUTOINCREMENT,
code_class_name TEXT,
code_class_start_line INTEGER,
- code_class_end_line INTEGER
+ code_class_end_line INTEGER,
+ code_class_wmc INTEGER
);
CREATE INDEX IF NOT EXISTS code_file_id ON code_class (code_file_id);

0 comments on commit c3016ab

Please sign in to comment.