1
1
Fork 0
mirror of https://code.mensbeam.com/MensBeam/Arsse.git synced 2025-01-03 14:32:40 +00:00

Added basic code coverage annotations

This commit is contained in:
J. King 2017-07-20 18:36:03 -04:00
parent 4cded011ff
commit cbdcacd1c3
27 changed files with 49 additions and 37 deletions

View file

@ -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");

View file

@ -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;

View file

@ -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;

View file

@ -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;

View file

@ -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;

View file

@ -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;

View file

@ -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;

View file

@ -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;

View file

@ -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;

View file

@ -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");
}

View file

@ -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;

View file

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

View file

@ -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 = "";

View file

@ -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 = "";

View file

@ -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;

View file

@ -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;

View file

@ -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;

View file

@ -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;

View file

@ -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

View file

@ -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();

View file

@ -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;

View file

@ -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,

View file

@ -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;

View file

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

View file

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

View file

@ -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") {

View file

@ -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>