Browse Source

Added basic code coverage annotations

microsub
J. King 7 years ago
parent
commit
cbdcacd1c3
  1. 34
      tests/Conf/TestConf.php
  2. 1
      tests/Db/SQLite3/Database/TestDatabaseArticleSQLite3.php
  3. 1
      tests/Db/SQLite3/Database/TestDatabaseFeedSQLite3.php
  4. 1
      tests/Db/SQLite3/Database/TestDatabaseFolderSQLite3.php
  5. 1
      tests/Db/SQLite3/Database/TestDatabaseMetaSQLite3.php
  6. 1
      tests/Db/SQLite3/Database/TestDatabaseSubscriptionSQLite3.php
  7. 1
      tests/Db/SQLite3/Database/TestDatabaseUserSQLite3.php
  8. 4
      tests/Db/SQLite3/TestDbDriverSQLite3.php
  9. 2
      tests/Db/SQLite3/TestDbResultSQLite3.php
  10. 4
      tests/Db/SQLite3/TestDbStatementSQLite3.php
  11. 3
      tests/Db/SQLite3/TestDbUpdateSQLite3.php
  12. 1
      tests/Exception/TestException.php
  13. 1
      tests/Feed/TestFeed.php
  14. 1
      tests/Feed/TestFeedFetching.php
  15. 2
      tests/Lang/TestLang.php
  16. 2
      tests/Lang/TestLangErrors.php
  17. 2
      tests/Lang/testLangComplex.php
  18. 1
      tests/Misc/TestContext.php
  19. 2
      tests/REST/NextCloudNews/TestNCNV1_2.php
  20. 2
      tests/REST/NextCloudNews/TestNCNVersionDiscovery.php
  21. 2
      tests/Service/TestService.php
  22. 2
      tests/User/TestAuthorization.php
  23. 4
      tests/User/TestUserInternalDriver.php
  24. 2
      tests/User/TestUserMockExternal.php
  25. 2
      tests/User/TestUserMockInternal.php
  26. 1
      tests/lib/AbstractTest.php
  27. 6
      tests/phpunit.xml

34
tests/Conf/TestConf.php

@ -3,7 +3,7 @@ declare(strict_types=1);
namespace JKingWeb\Arsse;
use org\bovigo\vfs\vfsStream;
/** @covers \JKingWeb\Arsse\Conf */
class TestConf extends Test\AbstractTest {
static $vfs;
static $path;
@ -33,9 +33,7 @@ class TestConf extends Test\AbstractTest {
$this->assertInstanceOf(Conf::class, new Conf());
}
/**
* @depends testLoadDefaultValues
*/
/** @depends testLoadDefaultValues */
function testImportFromArray() {
$arr = ['lang' => "xx"];
$conf = new Conf();
@ -43,9 +41,7 @@ class TestConf extends Test\AbstractTest {
$this->assertEquals("xx", $conf->lang);
}
/**
* @depends testImportFromArray
*/
/** @depends testImportFromArray */
function testImportFromFile() {
$conf = new Conf();
$conf->importFile(self::$path."confGood");
@ -54,50 +50,38 @@ class TestConf extends Test\AbstractTest {
$this->assertEquals("xx", $conf->lang);
}
/**
* @depends testImportFromFile
*/
/** @depends testImportFromFile */
function testImportFromMissingFile() {
$this->assertException("fileMissing", "Conf");
$conf = new Conf(self::$path."confMissing");
}
/**
* @depends testImportFromFile
*/
/** @depends testImportFromFile */
function testImportFromEmptyFile() {
$this->assertException("fileCorrupt", "Conf");
$conf = new Conf(self::$path."confEmpty");
}
/**
* @depends testImportFromFile
*/
/** @depends testImportFromFile */
function testImportFromFileWithoutReadPermission() {
$this->assertException("fileUnreadable", "Conf");
$conf = new Conf(self::$path."confUnreadable");
}
/**
* @depends testImportFromFile
*/
/** @depends testImportFromFile */
function testImportFromFileWhichIsNotAnArray() {
$this->assertException("fileCorrupt", "Conf");
$conf = new Conf(self::$path."confNotArray");
}
/**
* @depends testImportFromFile
*/
/** @depends testImportFromFile */
function testImportFromFileWhichIsNotPhp() {
$this->assertException("fileCorrupt", "Conf");
// this should not print the output of the non-PHP file
$conf = new Conf(self::$path."confNotPHP");
}
/**
* @depends testImportFromFile
*/
/** @depends testImportFromFile */
function testImportFromCorruptFile() {
$this->assertException("fileCorrupt", "Conf");
$conf = new Conf(self::$path."confCorrupt");

1
tests/Db/SQLite3/Database/TestDatabaseArticleSQLite3.php

@ -2,6 +2,7 @@
declare(strict_types=1);
namespace JKingWeb\Arsse;
/** @covers \JKingWeb\Arsse\Database */
class TestDatabaseArticleSQLite3 extends Test\AbstractTest {
use Test\Database\Setup;
use Test\Database\DriverSQLite3;

1
tests/Db/SQLite3/Database/TestDatabaseFeedSQLite3.php

@ -2,6 +2,7 @@
declare(strict_types=1);
namespace JKingWeb\Arsse;
/** @covers \JKingWeb\Arsse\Database */
class TestDatabaseFeedSQLite3 extends Test\AbstractTest {
use Test\Database\Setup;
use Test\Database\DriverSQLite3;

1
tests/Db/SQLite3/Database/TestDatabaseFolderSQLite3.php

@ -2,6 +2,7 @@
declare(strict_types=1);
namespace JKingWeb\Arsse;
/** @covers \JKingWeb\Arsse\Database */
class TestDatabaseFolderSQLite3 extends Test\AbstractTest {
use Test\Database\Setup;
use Test\Database\DriverSQLite3;

1
tests/Db/SQLite3/Database/TestDatabaseMetaSQLite3.php

@ -2,6 +2,7 @@
declare(strict_types=1);
namespace JKingWeb\Arsse;
/** @covers \JKingWeb\Arsse\Database */
class TestDatabaseMetaSQLite3 extends Test\AbstractTest {
use Test\Database\Setup;
use Test\Database\DriverSQLite3;

1
tests/Db/SQLite3/Database/TestDatabaseSubscriptionSQLite3.php

@ -2,6 +2,7 @@
declare(strict_types=1);
namespace JKingWeb\Arsse;
/** @covers \JKingWeb\Arsse\Database */
class TestDatabaseSubscriptionSQLite3 extends Test\AbstractTest {
use Test\Database\Setup;
use Test\Database\DriverSQLite3;

1
tests/Db/SQLite3/Database/TestDatabaseUserSQLite3.php

@ -2,6 +2,7 @@
declare(strict_types=1);
namespace JKingWeb\Arsse;
/** @covers \JKingWeb\Arsse\Database */
class TestDatabaseUserSQLite3 extends Test\AbstractTest {
use Test\Database\Setup;
use Test\Database\DriverSQLite3;

4
tests/Db/SQLite3/TestDbDriverSQLite3.php

@ -2,7 +2,9 @@
declare(strict_types=1);
namespace JKingWeb\Arsse;
/**
* @covers \JKingWeb\Arsse\Db\SQLite3\Driver<extended>
* @covers \JKingWeb\Arsse\Db\SQLite3\ExceptionBuilder */
class TestDbDriverSQLite3 extends Test\AbstractTest {
protected $data;
protected $drv;

2
tests/Db/SQLite3/TestDbResultSQLite3.php

@ -2,7 +2,7 @@
declare(strict_types=1);
namespace JKingWeb\Arsse;
/** @covers \JKingWeb\Arsse\Db\SQLite3\Result<extended> */
class TestDbResultSQLite3 extends Test\AbstractTest {
protected $c;

4
tests/Db/SQLite3/TestDbStatementSQLite3.php

@ -4,6 +4,9 @@ namespace JKingWeb\Arsse;
use JKingWeb\Arsse\Db\Statement;
/**
* @covers \JKingWeb\Arsse\Db\SQLite3\Statement<extended>
* @covers \JKingWeb\Arsse\Db\SQLite3\ExceptionBuilder */
class TestDbStatementSQLite3 extends Test\AbstractTest {
use Test\Db\BindingTests;
@ -11,6 +14,7 @@ class TestDbStatementSQLite3 extends Test\AbstractTest {
static protected $imp = Db\SQLite3\Statement::class;
function setUp() {
$this->clearData();
if(!extension_loaded("sqlite3")) {
$this->markTestSkipped("SQLite extension not loaded");
}

3
tests/Db/SQLite3/TestDbUpdateSQLite3.php

@ -4,6 +4,9 @@ namespace JKingWeb\Arsse;
use org\bovigo\vfs\vfsStream;
/**
* @covers \JKingWeb\Arsse\Db\SQLite3\Driver<extended>
* @covers \JKingWeb\Arsse\Db\SQLite3\ExceptionBuilder */
class TestDbUpdateSQLite3 extends Test\AbstractTest {
protected $data;
protected $drv;

1
tests/Exception/TestException.php

@ -4,6 +4,7 @@ namespace JKingWeb\Arsse;
Use Phake;
/** @covers \JKingWeb\Arsse\AbstractException */
class TestException extends Test\AbstractTest {
function setUp() {
$this->clearData(false);

1
tests/Feed/TestFeed.php

@ -5,6 +5,7 @@ use JKingWeb\Arsse\Misc\Date;
use Phake;
/** @covers \JKingWeb\Arsse\Feed */
class TestFeed extends Test\AbstractTest {
protected static $host = "http://localhost:8000/";
protected $base = "";

1
tests/Feed/TestFeedFetching.php

@ -4,6 +4,7 @@ namespace JKingWeb\Arsse;
Use Phake;
/** @covers \JKingWeb\Arsse\Feed */
class TestFeedFetching extends Test\AbstractTest {
protected static $host = "http://localhost:8000/";
protected $base = "";

2
tests/Lang/TestLang.php

@ -3,7 +3,7 @@ declare(strict_types=1);
namespace JKingWeb\Arsse;
use org\bovigo\vfs\vfsStream;
/** @covers \JKingWeb\Arsse\Lang */
class TestLang extends Test\AbstractTest {
use Test\Lang\Setup;

2
tests/Lang/TestLangErrors.php

@ -3,7 +3,7 @@ declare(strict_types=1);
namespace JKingWeb\Arsse;
use org\bovigo\vfs\vfsStream;
/** @covers \JKingWeb\Arsse\Lang */
class TestLangErrors extends Test\AbstractTest {
use Test\Lang\Setup;

2
tests/Lang/testLangComplex.php

@ -3,7 +3,7 @@ declare(strict_types=1);
namespace JKingWeb\Arsse;
use org\bovigo\vfs\vfsStream;
/** @covers \JKingWeb\Arsse\Lang */
class TestLangComplex extends Test\AbstractTest {
use Test\Lang\Setup;

1
tests/Misc/TestContext.php

@ -4,6 +4,7 @@ namespace JKingWeb\Arsse;
use JKingWeb\Arsse\Misc\Context;
/** @covers \JKingWeb\Arsse\Misc\Context */
class TestContext extends Test\AbstractTest {
function testVerifyInitialState() {
$c = new Context;

2
tests/REST/NextCloudNews/TestNCNV1_2.php

@ -10,7 +10,7 @@ use JKingWeb\Arsse\Db\ExceptionInput;
use JKingWeb\Arsse\Db\Transaction;
use Phake;
/** @covers \JKingWeb\Arsse\REST\NextCloudNews\V1_2 */
class TestNCNV1_2 extends Test\AbstractTest {
protected $h;
protected $feeds = [ // expected sample output of a feed list from the database, and the resultant expected transformation by the REST handler

2
tests/REST/NextCloudNews/TestNCNVersionDiscovery.php

@ -4,7 +4,7 @@ namespace JKingWeb\Arsse;
use JKingWeb\Arsse\REST\Request;
use JKingWeb\Arsse\REST\Response;
/** @covers \JKingWeb\Arsse\REST\NextCloudNews\Versions */
class TestNCNVersionDiscovery extends Test\AbstractTest {
function setUp() {
$this->clearData();

2
tests/Service/TestService.php

@ -4,7 +4,7 @@ namespace JKingWeb\Arsse;
use JKingWeb\Arsse\Misc\Date;
use Phake;
/** @covers \JKingWeb\Arsse\Service */
class TestService extends Test\AbstractTest {
protected $srv;

2
tests/User/TestAuthorization.php

@ -3,7 +3,7 @@ declare(strict_types=1);
namespace JKingWeb\Arsse;
use Phake;
/** @covers \JKingWeb\Arsse\User */
class TestAuthorization extends Test\AbstractTest {
const USERS = [
'user@example.com' => User\Driver::RIGHTS_NONE,

4
tests/User/TestUserInternalDriver.php

@ -2,7 +2,9 @@
declare(strict_types=1);
namespace JKingWeb\Arsse;
/**
* @covers \JKingWeb\Arsse\User
* @covers \JKingWeb\Arsse\User\Internal\Driver */
class TestUserInternalDriver extends Test\AbstractTest {
use Test\User\CommonTests;

2
tests/User/TestUserMockExternal.php

@ -2,7 +2,7 @@
declare(strict_types=1);
namespace JKingWeb\Arsse;
/** @covers \JKingWeb\Arsse\User */
class TestUserMockExternal extends Test\AbstractTest {
use Test\User\CommonTests;

2
tests/User/TestUserMockInternal.php

@ -2,7 +2,7 @@
declare(strict_types=1);
namespace JKingWeb\Arsse;
/** @covers \JKingWeb\Arsse\User */
class TestUserMockInternal extends Test\AbstractTest {
use Test\User\CommonTests;

1
tests/lib/AbstractTest.php

@ -5,6 +5,7 @@ use JKingWeb\Arsse\Exception;
use JKingWeb\Arsse\Arsse;
use JKingWeb\Arsse\Misc\Date;
/** @coversNothing */
abstract class AbstractTest extends \PHPUnit\Framework\TestCase {
function assertException(string $msg = "", string $prefix = "", string $type = "Exception") {

6
tests/phpunit.xml

@ -10,6 +10,12 @@
beStrictAboutTestSize="true"
stopOnError="true">
<filter>
<whitelist processUncoveredFilesFromWhitelist="true">
<directory suffix=".php">../lib</directory>
</whitelist>
</filter>
<testsuites>
<testsuite name="Exceptions">
<file>Exception/TestException.php</file>

Loading…
Cancel
Save