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:
parent
4cded011ff
commit
cbdcacd1c3
27 changed files with 49 additions and 37 deletions
|
@ -3,7 +3,7 @@ declare(strict_types=1);
|
||||||
namespace JKingWeb\Arsse;
|
namespace JKingWeb\Arsse;
|
||||||
use org\bovigo\vfs\vfsStream;
|
use org\bovigo\vfs\vfsStream;
|
||||||
|
|
||||||
|
/** @covers \JKingWeb\Arsse\Conf */
|
||||||
class TestConf extends Test\AbstractTest {
|
class TestConf extends Test\AbstractTest {
|
||||||
static $vfs;
|
static $vfs;
|
||||||
static $path;
|
static $path;
|
||||||
|
@ -33,9 +33,7 @@ class TestConf extends Test\AbstractTest {
|
||||||
$this->assertInstanceOf(Conf::class, new Conf());
|
$this->assertInstanceOf(Conf::class, new Conf());
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/** @depends testLoadDefaultValues */
|
||||||
* @depends testLoadDefaultValues
|
|
||||||
*/
|
|
||||||
function testImportFromArray() {
|
function testImportFromArray() {
|
||||||
$arr = ['lang' => "xx"];
|
$arr = ['lang' => "xx"];
|
||||||
$conf = new Conf();
|
$conf = new Conf();
|
||||||
|
@ -43,9 +41,7 @@ class TestConf extends Test\AbstractTest {
|
||||||
$this->assertEquals("xx", $conf->lang);
|
$this->assertEquals("xx", $conf->lang);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/** @depends testImportFromArray */
|
||||||
* @depends testImportFromArray
|
|
||||||
*/
|
|
||||||
function testImportFromFile() {
|
function testImportFromFile() {
|
||||||
$conf = new Conf();
|
$conf = new Conf();
|
||||||
$conf->importFile(self::$path."confGood");
|
$conf->importFile(self::$path."confGood");
|
||||||
|
@ -54,50 +50,38 @@ class TestConf extends Test\AbstractTest {
|
||||||
$this->assertEquals("xx", $conf->lang);
|
$this->assertEquals("xx", $conf->lang);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/** @depends testImportFromFile */
|
||||||
* @depends testImportFromFile
|
|
||||||
*/
|
|
||||||
function testImportFromMissingFile() {
|
function testImportFromMissingFile() {
|
||||||
$this->assertException("fileMissing", "Conf");
|
$this->assertException("fileMissing", "Conf");
|
||||||
$conf = new Conf(self::$path."confMissing");
|
$conf = new Conf(self::$path."confMissing");
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/** @depends testImportFromFile */
|
||||||
* @depends testImportFromFile
|
|
||||||
*/
|
|
||||||
function testImportFromEmptyFile() {
|
function testImportFromEmptyFile() {
|
||||||
$this->assertException("fileCorrupt", "Conf");
|
$this->assertException("fileCorrupt", "Conf");
|
||||||
$conf = new Conf(self::$path."confEmpty");
|
$conf = new Conf(self::$path."confEmpty");
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/** @depends testImportFromFile */
|
||||||
* @depends testImportFromFile
|
|
||||||
*/
|
|
||||||
function testImportFromFileWithoutReadPermission() {
|
function testImportFromFileWithoutReadPermission() {
|
||||||
$this->assertException("fileUnreadable", "Conf");
|
$this->assertException("fileUnreadable", "Conf");
|
||||||
$conf = new Conf(self::$path."confUnreadable");
|
$conf = new Conf(self::$path."confUnreadable");
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/** @depends testImportFromFile */
|
||||||
* @depends testImportFromFile
|
|
||||||
*/
|
|
||||||
function testImportFromFileWhichIsNotAnArray() {
|
function testImportFromFileWhichIsNotAnArray() {
|
||||||
$this->assertException("fileCorrupt", "Conf");
|
$this->assertException("fileCorrupt", "Conf");
|
||||||
$conf = new Conf(self::$path."confNotArray");
|
$conf = new Conf(self::$path."confNotArray");
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/** @depends testImportFromFile */
|
||||||
* @depends testImportFromFile
|
|
||||||
*/
|
|
||||||
function testImportFromFileWhichIsNotPhp() {
|
function testImportFromFileWhichIsNotPhp() {
|
||||||
$this->assertException("fileCorrupt", "Conf");
|
$this->assertException("fileCorrupt", "Conf");
|
||||||
// this should not print the output of the non-PHP file
|
// this should not print the output of the non-PHP file
|
||||||
$conf = new Conf(self::$path."confNotPHP");
|
$conf = new Conf(self::$path."confNotPHP");
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/** @depends testImportFromFile */
|
||||||
* @depends testImportFromFile
|
|
||||||
*/
|
|
||||||
function testImportFromCorruptFile() {
|
function testImportFromCorruptFile() {
|
||||||
$this->assertException("fileCorrupt", "Conf");
|
$this->assertException("fileCorrupt", "Conf");
|
||||||
$conf = new Conf(self::$path."confCorrupt");
|
$conf = new Conf(self::$path."confCorrupt");
|
||||||
|
|
|
@ -2,6 +2,7 @@
|
||||||
declare(strict_types=1);
|
declare(strict_types=1);
|
||||||
namespace JKingWeb\Arsse;
|
namespace JKingWeb\Arsse;
|
||||||
|
|
||||||
|
/** @covers \JKingWeb\Arsse\Database */
|
||||||
class TestDatabaseArticleSQLite3 extends Test\AbstractTest {
|
class TestDatabaseArticleSQLite3 extends Test\AbstractTest {
|
||||||
use Test\Database\Setup;
|
use Test\Database\Setup;
|
||||||
use Test\Database\DriverSQLite3;
|
use Test\Database\DriverSQLite3;
|
||||||
|
|
|
@ -2,6 +2,7 @@
|
||||||
declare(strict_types=1);
|
declare(strict_types=1);
|
||||||
namespace JKingWeb\Arsse;
|
namespace JKingWeb\Arsse;
|
||||||
|
|
||||||
|
/** @covers \JKingWeb\Arsse\Database */
|
||||||
class TestDatabaseFeedSQLite3 extends Test\AbstractTest {
|
class TestDatabaseFeedSQLite3 extends Test\AbstractTest {
|
||||||
use Test\Database\Setup;
|
use Test\Database\Setup;
|
||||||
use Test\Database\DriverSQLite3;
|
use Test\Database\DriverSQLite3;
|
||||||
|
|
|
@ -2,6 +2,7 @@
|
||||||
declare(strict_types=1);
|
declare(strict_types=1);
|
||||||
namespace JKingWeb\Arsse;
|
namespace JKingWeb\Arsse;
|
||||||
|
|
||||||
|
/** @covers \JKingWeb\Arsse\Database */
|
||||||
class TestDatabaseFolderSQLite3 extends Test\AbstractTest {
|
class TestDatabaseFolderSQLite3 extends Test\AbstractTest {
|
||||||
use Test\Database\Setup;
|
use Test\Database\Setup;
|
||||||
use Test\Database\DriverSQLite3;
|
use Test\Database\DriverSQLite3;
|
||||||
|
|
|
@ -2,6 +2,7 @@
|
||||||
declare(strict_types=1);
|
declare(strict_types=1);
|
||||||
namespace JKingWeb\Arsse;
|
namespace JKingWeb\Arsse;
|
||||||
|
|
||||||
|
/** @covers \JKingWeb\Arsse\Database */
|
||||||
class TestDatabaseMetaSQLite3 extends Test\AbstractTest {
|
class TestDatabaseMetaSQLite3 extends Test\AbstractTest {
|
||||||
use Test\Database\Setup;
|
use Test\Database\Setup;
|
||||||
use Test\Database\DriverSQLite3;
|
use Test\Database\DriverSQLite3;
|
||||||
|
|
|
@ -2,6 +2,7 @@
|
||||||
declare(strict_types=1);
|
declare(strict_types=1);
|
||||||
namespace JKingWeb\Arsse;
|
namespace JKingWeb\Arsse;
|
||||||
|
|
||||||
|
/** @covers \JKingWeb\Arsse\Database */
|
||||||
class TestDatabaseSubscriptionSQLite3 extends Test\AbstractTest {
|
class TestDatabaseSubscriptionSQLite3 extends Test\AbstractTest {
|
||||||
use Test\Database\Setup;
|
use Test\Database\Setup;
|
||||||
use Test\Database\DriverSQLite3;
|
use Test\Database\DriverSQLite3;
|
||||||
|
|
|
@ -2,6 +2,7 @@
|
||||||
declare(strict_types=1);
|
declare(strict_types=1);
|
||||||
namespace JKingWeb\Arsse;
|
namespace JKingWeb\Arsse;
|
||||||
|
|
||||||
|
/** @covers \JKingWeb\Arsse\Database */
|
||||||
class TestDatabaseUserSQLite3 extends Test\AbstractTest {
|
class TestDatabaseUserSQLite3 extends Test\AbstractTest {
|
||||||
use Test\Database\Setup;
|
use Test\Database\Setup;
|
||||||
use Test\Database\DriverSQLite3;
|
use Test\Database\DriverSQLite3;
|
||||||
|
|
|
@ -2,7 +2,9 @@
|
||||||
declare(strict_types=1);
|
declare(strict_types=1);
|
||||||
namespace JKingWeb\Arsse;
|
namespace JKingWeb\Arsse;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @covers \JKingWeb\Arsse\Db\SQLite3\Driver<extended>
|
||||||
|
* @covers \JKingWeb\Arsse\Db\SQLite3\ExceptionBuilder */
|
||||||
class TestDbDriverSQLite3 extends Test\AbstractTest {
|
class TestDbDriverSQLite3 extends Test\AbstractTest {
|
||||||
protected $data;
|
protected $data;
|
||||||
protected $drv;
|
protected $drv;
|
||||||
|
|
|
@ -2,7 +2,7 @@
|
||||||
declare(strict_types=1);
|
declare(strict_types=1);
|
||||||
namespace JKingWeb\Arsse;
|
namespace JKingWeb\Arsse;
|
||||||
|
|
||||||
|
/** @covers \JKingWeb\Arsse\Db\SQLite3\Result<extended> */
|
||||||
class TestDbResultSQLite3 extends Test\AbstractTest {
|
class TestDbResultSQLite3 extends Test\AbstractTest {
|
||||||
|
|
||||||
protected $c;
|
protected $c;
|
||||||
|
|
|
@ -4,6 +4,9 @@ namespace JKingWeb\Arsse;
|
||||||
use JKingWeb\Arsse\Db\Statement;
|
use JKingWeb\Arsse\Db\Statement;
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @covers \JKingWeb\Arsse\Db\SQLite3\Statement<extended>
|
||||||
|
* @covers \JKingWeb\Arsse\Db\SQLite3\ExceptionBuilder */
|
||||||
class TestDbStatementSQLite3 extends Test\AbstractTest {
|
class TestDbStatementSQLite3 extends Test\AbstractTest {
|
||||||
use Test\Db\BindingTests;
|
use Test\Db\BindingTests;
|
||||||
|
|
||||||
|
@ -11,6 +14,7 @@ class TestDbStatementSQLite3 extends Test\AbstractTest {
|
||||||
static protected $imp = Db\SQLite3\Statement::class;
|
static protected $imp = Db\SQLite3\Statement::class;
|
||||||
|
|
||||||
function setUp() {
|
function setUp() {
|
||||||
|
$this->clearData();
|
||||||
if(!extension_loaded("sqlite3")) {
|
if(!extension_loaded("sqlite3")) {
|
||||||
$this->markTestSkipped("SQLite extension not loaded");
|
$this->markTestSkipped("SQLite extension not loaded");
|
||||||
}
|
}
|
||||||
|
|
|
@ -4,6 +4,9 @@ namespace JKingWeb\Arsse;
|
||||||
use org\bovigo\vfs\vfsStream;
|
use org\bovigo\vfs\vfsStream;
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @covers \JKingWeb\Arsse\Db\SQLite3\Driver<extended>
|
||||||
|
* @covers \JKingWeb\Arsse\Db\SQLite3\ExceptionBuilder */
|
||||||
class TestDbUpdateSQLite3 extends Test\AbstractTest {
|
class TestDbUpdateSQLite3 extends Test\AbstractTest {
|
||||||
protected $data;
|
protected $data;
|
||||||
protected $drv;
|
protected $drv;
|
||||||
|
|
|
@ -4,6 +4,7 @@ namespace JKingWeb\Arsse;
|
||||||
Use Phake;
|
Use Phake;
|
||||||
|
|
||||||
|
|
||||||
|
/** @covers \JKingWeb\Arsse\AbstractException */
|
||||||
class TestException extends Test\AbstractTest {
|
class TestException extends Test\AbstractTest {
|
||||||
function setUp() {
|
function setUp() {
|
||||||
$this->clearData(false);
|
$this->clearData(false);
|
||||||
|
|
|
@ -5,6 +5,7 @@ use JKingWeb\Arsse\Misc\Date;
|
||||||
use Phake;
|
use Phake;
|
||||||
|
|
||||||
|
|
||||||
|
/** @covers \JKingWeb\Arsse\Feed */
|
||||||
class TestFeed extends Test\AbstractTest {
|
class TestFeed extends Test\AbstractTest {
|
||||||
protected static $host = "http://localhost:8000/";
|
protected static $host = "http://localhost:8000/";
|
||||||
protected $base = "";
|
protected $base = "";
|
||||||
|
|
|
@ -4,6 +4,7 @@ namespace JKingWeb\Arsse;
|
||||||
Use Phake;
|
Use Phake;
|
||||||
|
|
||||||
|
|
||||||
|
/** @covers \JKingWeb\Arsse\Feed */
|
||||||
class TestFeedFetching extends Test\AbstractTest {
|
class TestFeedFetching extends Test\AbstractTest {
|
||||||
protected static $host = "http://localhost:8000/";
|
protected static $host = "http://localhost:8000/";
|
||||||
protected $base = "";
|
protected $base = "";
|
||||||
|
|
|
@ -3,7 +3,7 @@ declare(strict_types=1);
|
||||||
namespace JKingWeb\Arsse;
|
namespace JKingWeb\Arsse;
|
||||||
use org\bovigo\vfs\vfsStream;
|
use org\bovigo\vfs\vfsStream;
|
||||||
|
|
||||||
|
/** @covers \JKingWeb\Arsse\Lang */
|
||||||
class TestLang extends Test\AbstractTest {
|
class TestLang extends Test\AbstractTest {
|
||||||
use Test\Lang\Setup;
|
use Test\Lang\Setup;
|
||||||
|
|
||||||
|
|
|
@ -3,7 +3,7 @@ declare(strict_types=1);
|
||||||
namespace JKingWeb\Arsse;
|
namespace JKingWeb\Arsse;
|
||||||
use org\bovigo\vfs\vfsStream;
|
use org\bovigo\vfs\vfsStream;
|
||||||
|
|
||||||
|
/** @covers \JKingWeb\Arsse\Lang */
|
||||||
class TestLangErrors extends Test\AbstractTest {
|
class TestLangErrors extends Test\AbstractTest {
|
||||||
use Test\Lang\Setup;
|
use Test\Lang\Setup;
|
||||||
|
|
||||||
|
|
|
@ -3,7 +3,7 @@ declare(strict_types=1);
|
||||||
namespace JKingWeb\Arsse;
|
namespace JKingWeb\Arsse;
|
||||||
use org\bovigo\vfs\vfsStream;
|
use org\bovigo\vfs\vfsStream;
|
||||||
|
|
||||||
|
/** @covers \JKingWeb\Arsse\Lang */
|
||||||
class TestLangComplex extends Test\AbstractTest {
|
class TestLangComplex extends Test\AbstractTest {
|
||||||
use Test\Lang\Setup;
|
use Test\Lang\Setup;
|
||||||
|
|
||||||
|
|
|
@ -4,6 +4,7 @@ namespace JKingWeb\Arsse;
|
||||||
use JKingWeb\Arsse\Misc\Context;
|
use JKingWeb\Arsse\Misc\Context;
|
||||||
|
|
||||||
|
|
||||||
|
/** @covers \JKingWeb\Arsse\Misc\Context */
|
||||||
class TestContext extends Test\AbstractTest {
|
class TestContext extends Test\AbstractTest {
|
||||||
function testVerifyInitialState() {
|
function testVerifyInitialState() {
|
||||||
$c = new Context;
|
$c = new Context;
|
||||||
|
|
|
@ -10,7 +10,7 @@ use JKingWeb\Arsse\Db\ExceptionInput;
|
||||||
use JKingWeb\Arsse\Db\Transaction;
|
use JKingWeb\Arsse\Db\Transaction;
|
||||||
use Phake;
|
use Phake;
|
||||||
|
|
||||||
|
/** @covers \JKingWeb\Arsse\REST\NextCloudNews\V1_2 */
|
||||||
class TestNCNV1_2 extends Test\AbstractTest {
|
class TestNCNV1_2 extends Test\AbstractTest {
|
||||||
protected $h;
|
protected $h;
|
||||||
protected $feeds = [ // expected sample output of a feed list from the database, and the resultant expected transformation by the REST handler
|
protected $feeds = [ // expected sample output of a feed list from the database, and the resultant expected transformation by the REST handler
|
||||||
|
|
|
@ -4,7 +4,7 @@ namespace JKingWeb\Arsse;
|
||||||
use JKingWeb\Arsse\REST\Request;
|
use JKingWeb\Arsse\REST\Request;
|
||||||
use JKingWeb\Arsse\REST\Response;
|
use JKingWeb\Arsse\REST\Response;
|
||||||
|
|
||||||
|
/** @covers \JKingWeb\Arsse\REST\NextCloudNews\Versions */
|
||||||
class TestNCNVersionDiscovery extends Test\AbstractTest {
|
class TestNCNVersionDiscovery extends Test\AbstractTest {
|
||||||
function setUp() {
|
function setUp() {
|
||||||
$this->clearData();
|
$this->clearData();
|
||||||
|
|
|
@ -4,7 +4,7 @@ namespace JKingWeb\Arsse;
|
||||||
use JKingWeb\Arsse\Misc\Date;
|
use JKingWeb\Arsse\Misc\Date;
|
||||||
use Phake;
|
use Phake;
|
||||||
|
|
||||||
|
/** @covers \JKingWeb\Arsse\Service */
|
||||||
class TestService extends Test\AbstractTest {
|
class TestService extends Test\AbstractTest {
|
||||||
protected $srv;
|
protected $srv;
|
||||||
|
|
||||||
|
|
|
@ -3,7 +3,7 @@ declare(strict_types=1);
|
||||||
namespace JKingWeb\Arsse;
|
namespace JKingWeb\Arsse;
|
||||||
use Phake;
|
use Phake;
|
||||||
|
|
||||||
|
/** @covers \JKingWeb\Arsse\User */
|
||||||
class TestAuthorization extends Test\AbstractTest {
|
class TestAuthorization extends Test\AbstractTest {
|
||||||
const USERS = [
|
const USERS = [
|
||||||
'user@example.com' => User\Driver::RIGHTS_NONE,
|
'user@example.com' => User\Driver::RIGHTS_NONE,
|
||||||
|
|
|
@ -2,7 +2,9 @@
|
||||||
declare(strict_types=1);
|
declare(strict_types=1);
|
||||||
namespace JKingWeb\Arsse;
|
namespace JKingWeb\Arsse;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @covers \JKingWeb\Arsse\User
|
||||||
|
* @covers \JKingWeb\Arsse\User\Internal\Driver */
|
||||||
class TestUserInternalDriver extends Test\AbstractTest {
|
class TestUserInternalDriver extends Test\AbstractTest {
|
||||||
use Test\User\CommonTests;
|
use Test\User\CommonTests;
|
||||||
|
|
||||||
|
|
|
@ -2,7 +2,7 @@
|
||||||
declare(strict_types=1);
|
declare(strict_types=1);
|
||||||
namespace JKingWeb\Arsse;
|
namespace JKingWeb\Arsse;
|
||||||
|
|
||||||
|
/** @covers \JKingWeb\Arsse\User */
|
||||||
class TestUserMockExternal extends Test\AbstractTest {
|
class TestUserMockExternal extends Test\AbstractTest {
|
||||||
use Test\User\CommonTests;
|
use Test\User\CommonTests;
|
||||||
|
|
||||||
|
|
|
@ -2,7 +2,7 @@
|
||||||
declare(strict_types=1);
|
declare(strict_types=1);
|
||||||
namespace JKingWeb\Arsse;
|
namespace JKingWeb\Arsse;
|
||||||
|
|
||||||
|
/** @covers \JKingWeb\Arsse\User */
|
||||||
class TestUserMockInternal extends Test\AbstractTest {
|
class TestUserMockInternal extends Test\AbstractTest {
|
||||||
use Test\User\CommonTests;
|
use Test\User\CommonTests;
|
||||||
|
|
||||||
|
|
|
@ -5,6 +5,7 @@ use JKingWeb\Arsse\Exception;
|
||||||
use JKingWeb\Arsse\Arsse;
|
use JKingWeb\Arsse\Arsse;
|
||||||
use JKingWeb\Arsse\Misc\Date;
|
use JKingWeb\Arsse\Misc\Date;
|
||||||
|
|
||||||
|
/** @coversNothing */
|
||||||
abstract class AbstractTest extends \PHPUnit\Framework\TestCase {
|
abstract class AbstractTest extends \PHPUnit\Framework\TestCase {
|
||||||
|
|
||||||
function assertException(string $msg = "", string $prefix = "", string $type = "Exception") {
|
function assertException(string $msg = "", string $prefix = "", string $type = "Exception") {
|
||||||
|
|
|
@ -10,6 +10,12 @@
|
||||||
beStrictAboutTestSize="true"
|
beStrictAboutTestSize="true"
|
||||||
stopOnError="true">
|
stopOnError="true">
|
||||||
|
|
||||||
|
<filter>
|
||||||
|
<whitelist processUncoveredFilesFromWhitelist="true">
|
||||||
|
<directory suffix=".php">../lib</directory>
|
||||||
|
</whitelist>
|
||||||
|
</filter>
|
||||||
|
|
||||||
<testsuites>
|
<testsuites>
|
||||||
<testsuite name="Exceptions">
|
<testsuite name="Exceptions">
|
||||||
<file>Exception/TestException.php</file>
|
<file>Exception/TestException.php</file>
|
||||||
|
|
Loading…
Reference in a new issue