Browse Source

Restore complete Database coverage

Also suppress PostgreSQL database function tests from normal coverage,
and add a "coverage:full" task to run them if needed.
tags/0.6.0
J. King 1 year ago
parent
commit
f2245861e3
3 changed files with 25 additions and 0 deletions
  1. 18
    0
      RoboFile.php
  2. 6
    0
      tests/cases/Database/SeriesArticle.php
  3. 1
    0
      tests/cases/Db/PostgreSQL/TestDatabase.php

+ 18
- 0
RoboFile.php View File

@@ -50,6 +50,21 @@ class RoboFile extends \Robo\Tasks {
* recommended if debugging facilities are not otherwise needed.
*/
public function coverage(array $args): Result {
// run tests with code coverage reporting enabled
$exec = $this->findCoverageEngine();
return $this->runTests($exec, "coverage", array_merge(["--coverage-html", self::BASE_TEST."coverage"], $args));
}

/** Produces a code coverage report, with redundant tests
*
* Depending on the environment, some tests that normally provide
* coverage may be skipped, while working alternatives are normally
* suppressed for reasons of time. This coverage report will try to
* run all tests which may cover code.
*
* See also help for the "coverage" task for more details.
*/
public function coverageFull(array $args): Result {
// run tests with code coverage reporting enabled
$exec = $this->findCoverageEngine();
return $this->runTests($exec, "typical", array_merge(["--coverage-html", self::BASE_TEST."coverage"], $args));
@@ -88,6 +103,9 @@ class RoboFile extends \Robo\Tasks {
case "quick":
$set = ["--exclude-group", "optional,slow"];
break;
case "coverage":
$set = ["--exclude-group", "optional,excludeFromCoverage"];
break;
case "full":
$set = [];
break;

+ 6
- 0
tests/cases/Database/SeriesArticle.php View File

@@ -772,6 +772,12 @@ trait SeriesArticle {
$this->compareExpectations($state);
}

public function testMarkMultipleMissingEditions() {
$this->assertSame(0, Arsse::$db->articleMark($this->user, ['starred'=>true], (new Context)->editions([500,501])));
$state = $this->primeExpectations($this->data, $this->checkTables);
$this->compareExpectations($state);
}

public function testMarkMultipleEditionsUnread() {
Arsse::$db->articleMark($this->user, ['read'=>false], (new Context)->editions([2,4,7,1001]));
$now = Date::transform(time(), "sql");

+ 1
- 0
tests/cases/Db/PostgreSQL/TestDatabase.php View File

@@ -7,6 +7,7 @@ declare(strict_types=1);
namespace JKingWeb\Arsse\TestCase\Db\PosgreSQL;

/**
* @group excludeFromCoverage
* @covers \JKingWeb\Arsse\Database<extended>
* @covers \JKingWeb\Arsse\Misc\Query<extended>
*/

Loading…
Cancel
Save