Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

- Add code_line.code_line_covered column back in.

  • Loading branch information...
commit 46b20044c8332fb47302cb5648c50f18743e2544 1 parent 0d9f4ae
@sebastianbergmann authored
View
29 PHPUnit/Util/Database.php
@@ -202,13 +202,15 @@ public function storeCodeCoverage(PHPUnit_Framework_TestResult $result, $revisio
sprintf(
'INSERT INTO code_line
(code_file_id, code_method_id,
- code_line_number, code_line)
- VALUES(%d, %d, %d, "%s");',
+ code_line_number, code_line,
+ code_line_covered)
+ VALUES(%d, %d, %d, "%s", %d);',
$fileId,
isset($methodMap[$i]) ? $methodMap[$i] : 0,
$i,
- trim($line)
+ trim($line),
+ isset($summary[$file][$i]) ? $summary[$file][$i] : 0
)
);
@@ -224,7 +226,7 @@ public function storeCodeCoverage(PHPUnit_Framework_TestResult $result, $revisio
if (is_array($coveringTests)) {
$stmt = $this->dbh->query(
sprintf(
- 'SELECT code_line_id
+ 'SELECT code_line_id, code_line_covered
FROM code_line
WHERE code_file_id = %d
AND code_line_number = %d;',
@@ -234,9 +236,26 @@ public function storeCodeCoverage(PHPUnit_Framework_TestResult $result, $revisio
)
);
- $codeLineId = (int)$stmt->fetchColumn();
+ $codeLineId = (int)$stmt->fetchColumn(0);
+ $oldCoverageFlag = (int)$stmt->fetchColumn(1);
unset($stmt);
+ $newCoverageFlag = $summary[$file][$lineNumber];
+
+ if (($oldCoverageFlag == 0 && $newCoverageFlag != 0) ||
+ ($oldCoverageFlag < 0 && $newCoverageFlag > 0)) {
+ $this->dbh->exec(
+ sprintf(
+ 'UPDATE code_line
+ SET code_line_covered = %d
+ WHERE code_line_id = %d;',
+
+ $newCoverageFlag,
+ $codeLineId
+ )
+ );
+ }
+
foreach ($coveringTests as $test) {
$this->dbh->exec(
sprintf(
View
1  PHPUnit/Util/Database/MySQL.sql
@@ -96,6 +96,7 @@ CREATE TABLE IF NOT EXISTS code_line(
code_line_id INTEGER UNSIGNED NOT NULL PRIMARY KEY AUTO_INCREMENT,
code_line_number INTEGER UNSIGNED NOT NULL,
code_line TEXT,
+ code_line_covered TINYINT UNSIGNED NOT NULL,
INDEX (code_file_id),
INDEX (code_method_id)
View
3  PHPUnit/Util/Database/SQLite3.sql
@@ -95,7 +95,8 @@ CREATE TABLE IF NOT EXISTS code_line(
code_method_id INTEGER,
code_line_id INTEGER PRIMARY KEY AUTOINCREMENT,
code_line_number INTEGER,
- code_line TEXT
+ code_line TEXT,
+ code_line_covered INTEGER
);
CREATE INDEX IF NOT EXISTS code_line_code_file_id ON code_line (code_file_id);
Please sign in to comment.
Something went wrong with that request. Please try again.