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

Method coverage no longer works in PHPUnit 11

This commit is contained in:
J. King 2024-12-27 23:39:44 -05:00
parent 2aa4fc9215
commit f066aa6649
72 changed files with 1164 additions and 1088 deletions

1
.gitignore vendored
View file

@ -12,6 +12,7 @@
/.php_cs.cache
/.php-cs-fixer.cache
/tests/.phpunit.result.cache
/tests/.phpunit.cache
# Dependencies

File diff suppressed because it is too large Load diff

View file

@ -173,7 +173,7 @@ trait SeriesCleanup {
unset($this->data);
}
#[CoversMethod(Database::class, "feedCleanup")]
//#[CoversMethod(Database::class, "feedCleanup")]
public function testCleanUpOrphanedFeeds(): void {
Arsse::$db->feedCleanup();
$now = gmdate("Y-m-d H:i:s");
@ -186,7 +186,7 @@ trait SeriesCleanup {
$this->compareExpectations(static::$drv, $state);
}
#[CoversMethod(Database::class, "feedCleanup")]
//#[CoversMethod(Database::class, "feedCleanup")]
public function testCleanUpOrphanedFeedsWithUnlimitedRetention(): void {
Arsse::$conf->import([
'purgeFeeds' => null,
@ -201,7 +201,7 @@ trait SeriesCleanup {
$this->compareExpectations(static::$drv, $state);
}
#[CoversMethod(Database::class, "iconCleanup")]
//#[CoversMethod(Database::class, "iconCleanup")]
public function testCleanUpOrphanedIcons(): void {
Arsse::$db->iconCleanup();
$now = gmdate("Y-m-d H:i:s");
@ -214,7 +214,7 @@ trait SeriesCleanup {
$this->compareExpectations(static::$drv, $state);
}
#[CoversMethod(Database::class, "iconCleanup")]
//#[CoversMethod(Database::class, "iconCleanup")]
public function testCleanUpOrphanedIconsWithUnlimitedRetention(): void {
Arsse::$conf->import([
'purgeFeeds' => null,
@ -229,7 +229,7 @@ trait SeriesCleanup {
$this->compareExpectations(static::$drv, $state);
}
#[CoversMethod(Database::class, "articleCleanup")]
//#[CoversMethod(Database::class, "articleCleanup")]
public function testCleanUpOldArticlesWithStandardRetention(): void {
Arsse::$db->articleCleanup();
$state = $this->primeExpectations($this->data, [
@ -241,7 +241,7 @@ trait SeriesCleanup {
$this->compareExpectations(static::$drv, $state);
}
#[CoversMethod(Database::class, "articleCleanup")]
//#[CoversMethod(Database::class, "articleCleanup")]
public function testCleanUpOldArticlesWithUnlimitedReadRetention(): void {
Arsse::$conf->import([
'purgeArticlesRead' => null,
@ -256,7 +256,7 @@ trait SeriesCleanup {
$this->compareExpectations(static::$drv, $state);
}
#[CoversMethod(Database::class, "articleCleanup")]
//#[CoversMethod(Database::class, "articleCleanup")]
public function testCleanUpOldArticlesWithUnlimitedUnreadRetention(): void {
Arsse::$conf->import([
'purgeArticlesUnread' => null,
@ -271,7 +271,7 @@ trait SeriesCleanup {
$this->compareExpectations(static::$drv, $state);
}
#[CoversMethod(Database::class, "articleCleanup")]
//#[CoversMethod(Database::class, "articleCleanup")]
public function testCleanUpOldArticlesWithUnlimitedRetention(): void {
Arsse::$conf->import([
'purgeArticlesRead' => null,
@ -284,7 +284,7 @@ trait SeriesCleanup {
$this->compareExpectations(static::$drv, $state);
}
#[CoversMethod(Database::class, "sessionCleanup")]
//#[CoversMethod(Database::class, "sessionCleanup")]
public function testCleanUpExpiredSessions(): void {
Arsse::$db->sessionCleanup();
$state = $this->primeExpectations($this->data, [
@ -296,7 +296,7 @@ trait SeriesCleanup {
$this->compareExpectations(static::$drv, $state);
}
#[CoversMethod(Database::class, "tokenCleanup")]
//#[CoversMethod(Database::class, "tokenCleanup")]
public function testCleanUpExpiredTokens(): void {
Arsse::$db->tokenCleanup();
$state = $this->primeExpectations($this->data, [

View file

@ -196,12 +196,12 @@ trait SeriesFeed {
unset($this->data, $this->matches);
}
#[CoversMethod(Database::class, "feedMatchLatest")]
//#[CoversMethod(Database::class, "feedMatchLatest")]
public function testListLatestItems(): void {
$this->assertResult($this->matches, Arsse::$db->feedMatchLatest(1, 2));
}
#[CoversMethod(Database::class, "feedMatchIds")]
//#[CoversMethod(Database::class, "feedMatchIds")]
public function testMatchItemsById(): void {
$this->assertResult($this->matches, Arsse::$db->feedMatchIds(1, ['804e517d623390e71497982c77cf6823180342ebcd2e7d5e32da1e55b09dd180','db3e736c2c492f5def5c5da33ddcbea1824040e9ced2142069276b0a6e291a41']));
foreach ($this->matches as $m) {
@ -214,7 +214,7 @@ trait SeriesFeed {
}
#[DataProvider("provideFilterRules")]
#[CoversMethod(Database::class, "feedRulesGet")]
//#[CoversMethod(Database::class, "feedRulesGet")]
public function testGetRules(int $in, array $exp): void {
$this->assertSame($exp, Arsse::$db->feedRulesGet($in));
}
@ -229,7 +229,7 @@ trait SeriesFeed {
];
}
#[CoversMethod(Database::class, "feedUpdate")]
//#[CoversMethod(Database::class, "feedUpdate")]
public function testUpdateAFeed(): void {
// update a valid feed with both new and changed items
Arsse::$db->feedUpdate(1);
@ -271,25 +271,25 @@ trait SeriesFeed {
$this->compareExpectations(static::$drv, $state);
}
#[CoversMethod(Database::class, "feedUpdate")]
//#[CoversMethod(Database::class, "feedUpdate")]
public function testUpdateAMissingFeed(): void {
$this->assertException("subjectMissing", "Db", "ExceptionInput");
Arsse::$db->feedUpdate(2112);
}
#[CoversMethod(Database::class, "feedUpdate")]
//#[CoversMethod(Database::class, "feedUpdate")]
public function testUpdateAnInvalidFeed(): void {
$this->assertException("typeViolation", "Db", "ExceptionInput");
Arsse::$db->feedUpdate(-1);
}
#[CoversMethod(Database::class, "feedUpdate")]
//#[CoversMethod(Database::class, "feedUpdate")]
public function testUpdateAFeedThrowingExceptions(): void {
$this->assertException("invalidUrl", "Feed");
Arsse::$db->feedUpdate(3, true);
}
#[CoversMethod(Database::class, "feedUpdate")]
//#[CoversMethod(Database::class, "feedUpdate")]
public function testUpdateAFeedWithEnclosuresAndCategories(): void {
Arsse::$db->feedUpdate(5);
$state = $this->primeExpectations($this->data, [
@ -310,7 +310,7 @@ trait SeriesFeed {
$this->compareExpectations(static::$drv, $state);
}
#[CoversMethod(Database::class, "feedListStale")]
//#[CoversMethod(Database::class, "feedListStale")]
public function testListStaleFeeds(): void {
$this->assertEquals([1,3,4], Arsse::$db->feedListStale());
Arsse::$db->feedUpdate(3);
@ -318,7 +318,7 @@ trait SeriesFeed {
$this->assertEquals([1], Arsse::$db->feedListStale());
}
#[CoversMethod(Database::class, "feedUpdate")]
//#[CoversMethod(Database::class, "feedUpdate")]
public function testCheckIconDuringFeedUpdate(): void {
Arsse::$db->feedUpdate(6);
$state = $this->primeExpectations($this->data, [
@ -328,7 +328,7 @@ trait SeriesFeed {
$this->compareExpectations(static::$drv, $state);
}
#[CoversMethod(Database::class, "feedUpdate")]
//#[CoversMethod(Database::class, "feedUpdate")]
public function testAssignIconDuringFeedUpdate(): void {
Arsse::$db->feedUpdate(7);
$state = $this->primeExpectations($this->data, [
@ -339,7 +339,7 @@ trait SeriesFeed {
$this->compareExpectations(static::$drv, $state);
}
#[CoversMethod(Database::class, "feedUpdate")]
//#[CoversMethod(Database::class, "feedUpdate")]
public function testChangeIconDuringFeedUpdate(): void {
Arsse::$db->feedUpdate(8);
$state = $this->primeExpectations($this->data, [
@ -350,7 +350,7 @@ trait SeriesFeed {
$this->compareExpectations(static::$drv, $state);
}
#[CoversMethod(Database::class, "feedUpdate")]
//#[CoversMethod(Database::class, "feedUpdate")]
public function testAddIconDuringFeedUpdate(): void {
Arsse::$db->feedUpdate(9);
$state = $this->primeExpectations($this->data, [
@ -362,7 +362,7 @@ trait SeriesFeed {
$this->compareExpectations(static::$drv, $state);
}
#[CoversMethod(Database::class, "feedUpdate")]
//#[CoversMethod(Database::class, "feedUpdate")]
public function testUpdateUnmodifiedFeed(): void {
$this->markTestIncomplete("FIXME: there is a bug here around calculation of nextFetch date");
$state = $this->primeExpectations($this->data, [

View file

@ -102,9 +102,9 @@ trait SeriesFolder {
unset($this->data);
}
#[CoversMethod(Database::class, "folderAdd")]
#[CoversMethod(Database::class, "folderValidateId")]
#[CoversMethod(Database::class, "folderValidateName")]
//#[CoversMethod(Database::class, "folderAdd")]
//#[CoversMethod(Database::class, "folderValidateId")]
//#[CoversMethod(Database::class, "folderValidateName")]
public function testAddARootFolder(): void {
$user = "john.doe@example.com";
$folderID = $this->nextID("arsse_folders");
@ -114,17 +114,17 @@ trait SeriesFolder {
$this->compareExpectations(static::$drv, $state);
}
#[CoversMethod(Database::class, "folderAdd")]
#[CoversMethod(Database::class, "folderValidateId")]
#[CoversMethod(Database::class, "folderValidateName")]
//#[CoversMethod(Database::class, "folderAdd")]
//#[CoversMethod(Database::class, "folderValidateId")]
//#[CoversMethod(Database::class, "folderValidateName")]
public function testAddADuplicateRootFolder(): void {
$this->assertException("constraintViolation", "Db", "ExceptionInput");
Arsse::$db->folderAdd("john.doe@example.com", ['name' => "Politics"]);
}
#[CoversMethod(Database::class, "folderAdd")]
#[CoversMethod(Database::class, "folderValidateId")]
#[CoversMethod(Database::class, "folderValidateName")]
//#[CoversMethod(Database::class, "folderAdd")]
//#[CoversMethod(Database::class, "folderValidateId")]
//#[CoversMethod(Database::class, "folderValidateName")]
public function testAddANestedFolder(): void {
$user = "john.doe@example.com";
$folderID = $this->nextID("arsse_folders");
@ -134,56 +134,56 @@ trait SeriesFolder {
$this->compareExpectations(static::$drv, $state);
}
#[CoversMethod(Database::class, "folderAdd")]
#[CoversMethod(Database::class, "folderValidateId")]
#[CoversMethod(Database::class, "folderValidateName")]
//#[CoversMethod(Database::class, "folderAdd")]
//#[CoversMethod(Database::class, "folderValidateId")]
//#[CoversMethod(Database::class, "folderValidateName")]
public function testAddANestedFolderToAMissingParent(): void {
$this->assertException("idMissing", "Db", "ExceptionInput");
Arsse::$db->folderAdd("john.doe@example.com", ['name' => "Sociology", 'parent' => 2112]);
}
#[CoversMethod(Database::class, "folderAdd")]
#[CoversMethod(Database::class, "folderValidateId")]
#[CoversMethod(Database::class, "folderValidateName")]
//#[CoversMethod(Database::class, "folderAdd")]
//#[CoversMethod(Database::class, "folderValidateId")]
//#[CoversMethod(Database::class, "folderValidateName")]
public function testAddANestedFolderToAnInvalidParent(): void {
$this->assertException("typeViolation", "Db", "ExceptionInput");
Arsse::$db->folderAdd("john.doe@example.com", ['name' => "Sociology", 'parent' => "stringFolderId"]);
}
#[CoversMethod(Database::class, "folderAdd")]
#[CoversMethod(Database::class, "folderValidateId")]
#[CoversMethod(Database::class, "folderValidateName")]
//#[CoversMethod(Database::class, "folderAdd")]
//#[CoversMethod(Database::class, "folderValidateId")]
//#[CoversMethod(Database::class, "folderValidateName")]
public function testAddANestedFolderForTheWrongOwner(): void {
$this->assertException("idMissing", "Db", "ExceptionInput");
Arsse::$db->folderAdd("john.doe@example.com", ['name' => "Sociology", 'parent' => 4]); // folder ID 4 belongs to Jane
}
#[CoversMethod(Database::class, "folderAdd")]
#[CoversMethod(Database::class, "folderValidateId")]
#[CoversMethod(Database::class, "folderValidateName")]
//#[CoversMethod(Database::class, "folderAdd")]
//#[CoversMethod(Database::class, "folderValidateId")]
//#[CoversMethod(Database::class, "folderValidateName")]
public function testAddAFolderWithAMissingName(): void {
$this->assertException("missing", "Db", "ExceptionInput");
Arsse::$db->folderAdd("john.doe@example.com", []);
}
#[CoversMethod(Database::class, "folderAdd")]
#[CoversMethod(Database::class, "folderValidateId")]
#[CoversMethod(Database::class, "folderValidateName")]
//#[CoversMethod(Database::class, "folderAdd")]
//#[CoversMethod(Database::class, "folderValidateId")]
//#[CoversMethod(Database::class, "folderValidateName")]
public function testAddAFolderWithABlankName(): void {
$this->assertException("missing", "Db", "ExceptionInput");
Arsse::$db->folderAdd("john.doe@example.com", ['name' => ""]);
}
#[CoversMethod(Database::class, "folderAdd")]
#[CoversMethod(Database::class, "folderValidateId")]
#[CoversMethod(Database::class, "folderValidateName")]
//#[CoversMethod(Database::class, "folderAdd")]
//#[CoversMethod(Database::class, "folderValidateId")]
//#[CoversMethod(Database::class, "folderValidateName")]
public function testAddAFolderWithAWhitespaceName(): void {
$this->assertException("whitespace", "Db", "ExceptionInput");
Arsse::$db->folderAdd("john.doe@example.com", ['name' => " "]);
}
#[CoversMethod(Database::class, "folderList")]
#[CoversMethod(Database::class, "folderValidateId")]
//#[CoversMethod(Database::class, "folderList")]
//#[CoversMethod(Database::class, "folderValidateId")]
public function testListRootFolders(): void {
$exp = [
['id' => 5, 'name' => "Politics", 'parent' => null, 'children' => 0, 'feeds' => 2],
@ -198,8 +198,8 @@ trait SeriesFolder {
$this->assertResult($exp, Arsse::$db->folderList("admin@example.net", null, false));
}
#[CoversMethod(Database::class, "folderList")]
#[CoversMethod(Database::class, "folderValidateId")]
//#[CoversMethod(Database::class, "folderList")]
//#[CoversMethod(Database::class, "folderValidateId")]
public function testListFoldersRecursively(): void {
$exp = [
['id' => 5, 'name' => "Politics", 'parent' => null, 'children' => 0, 'feeds' => 2],
@ -219,21 +219,21 @@ trait SeriesFolder {
$this->assertResult($exp, Arsse::$db->folderList("jane.doe@example.com", 4, true));
}
#[CoversMethod(Database::class, "folderList")]
#[CoversMethod(Database::class, "folderValidateId")]
//#[CoversMethod(Database::class, "folderList")]
//#[CoversMethod(Database::class, "folderValidateId")]
public function testListFoldersOfAMissingParent(): void {
$this->assertException("idMissing", "Db", "ExceptionInput");
Arsse::$db->folderList("john.doe@example.com", 2112);
}
#[CoversMethod(Database::class, "folderList")]
#[CoversMethod(Database::class, "folderValidateId")]
//#[CoversMethod(Database::class, "folderList")]
//#[CoversMethod(Database::class, "folderValidateId")]
public function testListFoldersOfTheWrongOwner(): void {
$this->assertException("idMissing", "Db", "ExceptionInput");
Arsse::$db->folderList("john.doe@example.com", 4); // folder ID 4 belongs to Jane
}
#[CoversMethod(Database::class, "folderRemove")]
//#[CoversMethod(Database::class, "folderRemove")]
public function testRemoveAFolder(): void {
$this->assertTrue(Arsse::$db->folderRemove("john.doe@example.com", 6));
$state = $this->primeExpectations($this->data, ['arsse_folders' => ['id','owner', 'parent', 'name']]);
@ -241,7 +241,7 @@ trait SeriesFolder {
$this->compareExpectations(static::$drv, $state);
}
#[CoversMethod(Database::class, "folderRemove")]
//#[CoversMethod(Database::class, "folderRemove")]
public function testRemoveAFolderTree(): void {
$this->assertTrue(Arsse::$db->folderRemove("john.doe@example.com", 1));
$state = $this->primeExpectations($this->data, ['arsse_folders' => ['id','owner', 'parent', 'name']]);
@ -251,25 +251,25 @@ trait SeriesFolder {
$this->compareExpectations(static::$drv, $state);
}
#[CoversMethod(Database::class, "folderRemove")]
//#[CoversMethod(Database::class, "folderRemove")]
public function testRemoveAMissingFolder(): void {
$this->assertException("subjectMissing", "Db", "ExceptionInput");
Arsse::$db->folderRemove("john.doe@example.com", 2112);
}
#[CoversMethod(Database::class, "folderRemove")]
//#[CoversMethod(Database::class, "folderRemove")]
public function testRemoveAnInvalidFolder(): void {
$this->assertException("typeViolation", "Db", "ExceptionInput");
Arsse::$db->folderRemove("john.doe@example.com", -1);
}
#[CoversMethod(Database::class, "folderRemove")]
//#[CoversMethod(Database::class, "folderRemove")]
public function testRemoveAFolderOfTheWrongOwner(): void {
$this->assertException("subjectMissing", "Db", "ExceptionInput");
Arsse::$db->folderRemove("john.doe@example.com", 4); // folder ID 4 belongs to Jane
}
#[CoversMethod(Database::class, "folderPropertiesGet")]
//#[CoversMethod(Database::class, "folderPropertiesGet")]
public function testGetThePropertiesOfAFolder(): void {
$exp = [
'id' => 6,
@ -279,31 +279,31 @@ trait SeriesFolder {
$this->assertArraySubset($exp, Arsse::$db->folderPropertiesGet("john.doe@example.com", 6));
}
#[CoversMethod(Database::class, "folderPropertiesGet")]
//#[CoversMethod(Database::class, "folderPropertiesGet")]
public function testGetThePropertiesOfAMissingFolder(): void {
$this->assertException("subjectMissing", "Db", "ExceptionInput");
Arsse::$db->folderPropertiesGet("john.doe@example.com", 2112);
}
#[CoversMethod(Database::class, "folderPropertiesGet")]
//#[CoversMethod(Database::class, "folderPropertiesGet")]
public function testGetThePropertiesOfAnInvalidFolder(): void {
$this->assertException("typeViolation", "Db", "ExceptionInput");
Arsse::$db->folderPropertiesGet("john.doe@example.com", -1);
}
#[CoversMethod(Database::class, "folderPropertiesGet")]
//#[CoversMethod(Database::class, "folderPropertiesGet")]
public function testGetThePropertiesOfAFolderOfTheWrongOwner(): void {
$this->assertException("subjectMissing", "Db", "ExceptionInput");
Arsse::$db->folderPropertiesGet("john.doe@example.com", 4); // folder ID 4 belongs to Jane
}
#[CoversMethod(Database::class, "folderPropertiesSet")]
//#[CoversMethod(Database::class, "folderPropertiesSet")]
public function testMakeNoChangesToAFolder(): void {
$this->assertFalse(Arsse::$db->folderPropertiesSet("john.doe@example.com", 6, []));
}
#[CoversMethod(Database::class, "folderPropertiesSet")]
#[CoversMethod(Database::class, "folderValidateName")]
//#[CoversMethod(Database::class, "folderPropertiesSet")]
//#[CoversMethod(Database::class, "folderValidateName")]
public function testRenameAFolder(): void {
$this->assertTrue(Arsse::$db->folderPropertiesSet("john.doe@example.com", 6, ['name' => "Opinion"]));
$state = $this->primeExpectations($this->data, ['arsse_folders' => ['id','owner', 'parent', 'name']]);
@ -311,35 +311,35 @@ trait SeriesFolder {
$this->compareExpectations(static::$drv, $state);
}
#[CoversMethod(Database::class, "folderPropertiesSet")]
#[CoversMethod(Database::class, "folderValidateName")]
//#[CoversMethod(Database::class, "folderPropertiesSet")]
//#[CoversMethod(Database::class, "folderValidateName")]
public function testRenameTheRootFolder(): void {
$this->assertFalse(Arsse::$db->folderPropertiesSet("john.doe@example.com", null, ['name' => "Opinion"]));
}
#[CoversMethod(Database::class, "folderPropertiesSet")]
#[CoversMethod(Database::class, "folderValidateName")]
//#[CoversMethod(Database::class, "folderPropertiesSet")]
//#[CoversMethod(Database::class, "folderValidateName")]
public function testRenameAFolderToTheEmptyString(): void {
$this->assertException("missing", "Db", "ExceptionInput");
$this->assertTrue(Arsse::$db->folderPropertiesSet("john.doe@example.com", 6, ['name' => ""]));
}
#[CoversMethod(Database::class, "folderPropertiesSet")]
#[CoversMethod(Database::class, "folderValidateName")]
//#[CoversMethod(Database::class, "folderPropertiesSet")]
//#[CoversMethod(Database::class, "folderValidateName")]
public function testRenameAFolderToWhitespaceOnly(): void {
$this->assertException("whitespace", "Db", "ExceptionInput");
$this->assertTrue(Arsse::$db->folderPropertiesSet("john.doe@example.com", 6, ['name' => " "]));
}
#[CoversMethod(Database::class, "folderPropertiesSet")]
#[CoversMethod(Database::class, "folderValidateName")]
//#[CoversMethod(Database::class, "folderPropertiesSet")]
//#[CoversMethod(Database::class, "folderValidateName")]
public function testRenameAFolderToAnInvalidValue(): void {
$this->assertException("typeViolation", "Db", "ExceptionInput");
$this->assertTrue(Arsse::$db->folderPropertiesSet("john.doe@example.com", 6, ['name' => []]));
}
#[CoversMethod(Database::class, "folderPropertiesSet")]
#[CoversMethod(Database::class, "folderValidateMove")]
//#[CoversMethod(Database::class, "folderPropertiesSet")]
//#[CoversMethod(Database::class, "folderValidateMove")]
public function testMoveAFolder(): void {
$this->assertTrue(Arsse::$db->folderPropertiesSet("john.doe@example.com", 6, ['parent' => 5]));
$state = $this->primeExpectations($this->data, ['arsse_folders' => ['id','owner', 'parent', 'name']]);
@ -347,69 +347,69 @@ trait SeriesFolder {
$this->compareExpectations(static::$drv, $state);
}
#[CoversMethod(Database::class, "folderPropertiesSet")]
#[CoversMethod(Database::class, "folderValidateMove")]
//#[CoversMethod(Database::class, "folderPropertiesSet")]
//#[CoversMethod(Database::class, "folderValidateMove")]
public function testMoveTheRootFolder(): void {
$this->assertException("circularDependence", "Db", "ExceptionInput");
Arsse::$db->folderPropertiesSet("john.doe@example.com", 0, ['parent' => 1]);
}
#[CoversMethod(Database::class, "folderPropertiesSet")]
#[CoversMethod(Database::class, "folderValidateMove")]
//#[CoversMethod(Database::class, "folderPropertiesSet")]
//#[CoversMethod(Database::class, "folderValidateMove")]
public function testMoveAFolderToItsDescendant(): void {
$this->assertException("circularDependence", "Db", "ExceptionInput");
Arsse::$db->folderPropertiesSet("john.doe@example.com", 1, ['parent' => 3]);
}
#[CoversMethod(Database::class, "folderPropertiesSet")]
#[CoversMethod(Database::class, "folderValidateMove")]
//#[CoversMethod(Database::class, "folderPropertiesSet")]
//#[CoversMethod(Database::class, "folderValidateMove")]
public function testMoveAFolderToItself(): void {
$this->assertException("circularDependence", "Db", "ExceptionInput");
Arsse::$db->folderPropertiesSet("john.doe@example.com", 1, ['parent' => 1]);
}
#[CoversMethod(Database::class, "folderPropertiesSet")]
#[CoversMethod(Database::class, "folderValidateMove")]
//#[CoversMethod(Database::class, "folderPropertiesSet")]
//#[CoversMethod(Database::class, "folderValidateMove")]
public function testMoveAFolderToAMissingParent(): void {
$this->assertException("idMissing", "Db", "ExceptionInput");
Arsse::$db->folderPropertiesSet("john.doe@example.com", 1, ['parent' => 2112]);
}
#[CoversMethod(Database::class, "folderPropertiesSet")]
#[CoversMethod(Database::class, "folderValidateMove")]
//#[CoversMethod(Database::class, "folderPropertiesSet")]
//#[CoversMethod(Database::class, "folderValidateMove")]
public function testMoveAFolderToAnInvalidParent(): void {
$this->assertException("idMissing", "Db", "ExceptionInput");
Arsse::$db->folderPropertiesSet("john.doe@example.com", 1, ['parent' => "ThisFolderDoesNotExist"]);
}
#[CoversMethod(Database::class, "folderPropertiesSet")]
#[CoversMethod(Database::class, "folderValidateMove")]
//#[CoversMethod(Database::class, "folderPropertiesSet")]
//#[CoversMethod(Database::class, "folderValidateMove")]
public function testCauseAFolderCollision(): void {
$this->assertException("constraintViolation", "Db", "ExceptionInput");
Arsse::$db->folderPropertiesSet("john.doe@example.com", 6, ['parent' => null]);
}
#[CoversMethod(Database::class, "folderPropertiesSet")]
#[CoversMethod(Database::class, "folderValidateName")]
#[CoversMethod(Database::class, "folderValidateMove")]
//#[CoversMethod(Database::class, "folderPropertiesSet")]
//#[CoversMethod(Database::class, "folderValidateName")]
//#[CoversMethod(Database::class, "folderValidateMove")]
public function testCauseACompoundFolderCollision(): void {
$this->assertException("constraintViolation", "Db", "ExceptionInput");
Arsse::$db->folderPropertiesSet("john.doe@example.com", 3, ['parent' => null, 'name' => "Technology"]);
}
#[CoversMethod(Database::class, "folderPropertiesSet")]
//#[CoversMethod(Database::class, "folderPropertiesSet")]
public function testSetThePropertiesOfAMissingFolder(): void {
$this->assertException("subjectMissing", "Db", "ExceptionInput");
Arsse::$db->folderPropertiesSet("john.doe@example.com", 2112, ['parent' => null]);
}
#[CoversMethod(Database::class, "folderPropertiesSet")]
//#[CoversMethod(Database::class, "folderPropertiesSet")]
public function testSetThePropertiesOfAnInvalidFolder(): void {
$this->assertException("typeViolation", "Db", "ExceptionInput");
Arsse::$db->folderPropertiesSet("john.doe@example.com", -1, ['parent' => null]);
}
#[CoversMethod(Database::class, "folderPropertiesSet")]
//#[CoversMethod(Database::class, "folderPropertiesSet")]
public function testSetThePropertiesOfAFolderForTheWrongOwner(): void {
$this->assertException("subjectMissing", "Db", "ExceptionInput");
Arsse::$db->folderPropertiesSet("john.doe@example.com", 4, ['parent' => null]); // folder ID 4 belongs to Jane

View file

@ -86,7 +86,7 @@ trait SeriesIcon {
unset($this->data);
}
#[CoversMethod(Database::class, "iconList")]
//#[CoversMethod(Database::class, "iconList")]
public function testListTheIconsOfAUser() {
$exp = [
['id' => 1,'url' => 'http://localhost:8000/Icon/PNG', 'type' => 'image/png', 'data' => base64_decode("iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAYAAAAfFcSJAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8YQUAAAAJcEhZcwAADsMAAA7DAcdvqGQAAAAZdEVYdFNvZnR3YXJlAHBhaW50Lm5ldCA0LjAuMjHxIGmVAAAADUlEQVQYV2NgYGBgAAAABQABijPjAAAAAABJRU5ErkJggg==")],

View file

@ -257,8 +257,8 @@ trait SeriesLabel {
unset($this->data, $this->checkLabels, $this->checkMembers, $this->user);
}
#[CoversMethod(Database::class, "labelAdd")]
#[CoversMethod(Database::class, "labelValidateName")]
//#[CoversMethod(Database::class, "labelAdd")]
//#[CoversMethod(Database::class, "labelValidateName")]
public function testAddALabel(): void {
$user = "john.doe@example.com";
$labelID = $this->nextID("arsse_labels");
@ -268,35 +268,35 @@ trait SeriesLabel {
$this->compareExpectations(static::$drv, $state);
}
#[CoversMethod(Database::class, "labelAdd")]
#[CoversMethod(Database::class, "labelValidateName")]
//#[CoversMethod(Database::class, "labelAdd")]
//#[CoversMethod(Database::class, "labelValidateName")]
public function testAddADuplicateLabel(): void {
$this->assertException("constraintViolation", "Db", "ExceptionInput");
Arsse::$db->labelAdd("john.doe@example.com", ['name' => "Interesting"]);
}
#[CoversMethod(Database::class, "labelAdd")]
#[CoversMethod(Database::class, "labelValidateName")]
//#[CoversMethod(Database::class, "labelAdd")]
//#[CoversMethod(Database::class, "labelValidateName")]
public function testAddALabelWithAMissingName(): void {
$this->assertException("missing", "Db", "ExceptionInput");
Arsse::$db->labelAdd("john.doe@example.com", []);
}
#[CoversMethod(Database::class, "labelAdd")]
#[CoversMethod(Database::class, "labelValidateName")]
//#[CoversMethod(Database::class, "labelAdd")]
//#[CoversMethod(Database::class, "labelValidateName")]
public function testAddALabelWithABlankName(): void {
$this->assertException("missing", "Db", "ExceptionInput");
Arsse::$db->labelAdd("john.doe@example.com", ['name' => ""]);
}
#[CoversMethod(Database::class, "labelAdd")]
#[CoversMethod(Database::class, "labelValidateName")]
//#[CoversMethod(Database::class, "labelAdd")]
//#[CoversMethod(Database::class, "labelValidateName")]
public function testAddALabelWithAWhitespaceName(): void {
$this->assertException("whitespace", "Db", "ExceptionInput");
Arsse::$db->labelAdd("john.doe@example.com", ['name' => " "]);
}
#[CoversMethod(Database::class, "labelList")]
//#[CoversMethod(Database::class, "labelList")]
public function testListLabels(): void {
$exp = [
['id' => 2, 'name' => "Fascinating", 'articles' => 3, 'read' => 1],
@ -312,8 +312,8 @@ trait SeriesLabel {
$this->assertResult($exp, Arsse::$db->labelList("jane.doe@example.com", false));
}
#[CoversMethod(Database::class, "labelRemove")]
#[CoversMethod(Database::class, "labelValidateId")]
//#[CoversMethod(Database::class, "labelRemove")]
//#[CoversMethod(Database::class, "labelValidateId")]
public function testRemoveALabel(): void {
$this->assertTrue(Arsse::$db->labelRemove("john.doe@example.com", 1));
$state = $this->primeExpectations($this->data, $this->checkLabels);
@ -321,8 +321,8 @@ trait SeriesLabel {
$this->compareExpectations(static::$drv, $state);
}
#[CoversMethod(Database::class, "labelRemove")]
#[CoversMethod(Database::class, "labelValidateId")]
//#[CoversMethod(Database::class, "labelRemove")]
//#[CoversMethod(Database::class, "labelValidateId")]
public function testRemoveALabelByName(): void {
$this->assertTrue(Arsse::$db->labelRemove("john.doe@example.com", "Interesting", true));
$state = $this->primeExpectations($this->data, $this->checkLabels);
@ -330,36 +330,36 @@ trait SeriesLabel {
$this->compareExpectations(static::$drv, $state);
}
#[CoversMethod(Database::class, "labelRemove")]
#[CoversMethod(Database::class, "labelValidateId")]
//#[CoversMethod(Database::class, "labelRemove")]
//#[CoversMethod(Database::class, "labelValidateId")]
public function testRemoveAMissingLabel(): void {
$this->assertException("subjectMissing", "Db", "ExceptionInput");
Arsse::$db->labelRemove("john.doe@example.com", 2112);
}
#[CoversMethod(Database::class, "labelRemove")]
#[CoversMethod(Database::class, "labelValidateId")]
//#[CoversMethod(Database::class, "labelRemove")]
//#[CoversMethod(Database::class, "labelValidateId")]
public function testRemoveAnInvalidLabel(): void {
$this->assertException("typeViolation", "Db", "ExceptionInput");
Arsse::$db->labelRemove("john.doe@example.com", -1);
}
#[CoversMethod(Database::class, "labelRemove")]
#[CoversMethod(Database::class, "labelValidateId")]
//#[CoversMethod(Database::class, "labelRemove")]
//#[CoversMethod(Database::class, "labelValidateId")]
public function testRemoveAnInvalidLabelByName(): void {
$this->assertException("typeViolation", "Db", "ExceptionInput");
Arsse::$db->labelRemove("john.doe@example.com", [], true);
}
#[CoversMethod(Database::class, "labelRemove")]
#[CoversMethod(Database::class, "labelValidateId")]
//#[CoversMethod(Database::class, "labelRemove")]
//#[CoversMethod(Database::class, "labelValidateId")]
public function testRemoveALabelOfTheWrongOwner(): void {
$this->assertException("subjectMissing", "Db", "ExceptionInput");
Arsse::$db->labelRemove("john.doe@example.com", 3); // label ID 3 belongs to Jane
}
#[CoversMethod(Database::class, "labelPropertiesGet")]
#[CoversMethod(Database::class, "labelValidateId")]
//#[CoversMethod(Database::class, "labelPropertiesGet")]
//#[CoversMethod(Database::class, "labelValidateId")]
public function testGetThePropertiesOfALabel(): void {
$exp = [
'id' => 2,
@ -371,44 +371,44 @@ trait SeriesLabel {
$this->assertArraySubset($exp, Arsse::$db->labelPropertiesGet("john.doe@example.com", "Fascinating", true));
}
#[CoversMethod(Database::class, "labelPropertiesGet")]
#[CoversMethod(Database::class, "labelValidateId")]
//#[CoversMethod(Database::class, "labelPropertiesGet")]
//#[CoversMethod(Database::class, "labelValidateId")]
public function testGetThePropertiesOfAMissingLabel(): void {
$this->assertException("subjectMissing", "Db", "ExceptionInput");
Arsse::$db->labelPropertiesGet("john.doe@example.com", 2112);
}
#[CoversMethod(Database::class, "labelPropertiesGet")]
#[CoversMethod(Database::class, "labelValidateId")]
//#[CoversMethod(Database::class, "labelPropertiesGet")]
//#[CoversMethod(Database::class, "labelValidateId")]
public function testGetThePropertiesOfAnInvalidLabel(): void {
$this->assertException("typeViolation", "Db", "ExceptionInput");
Arsse::$db->labelPropertiesGet("john.doe@example.com", -1);
}
#[CoversMethod(Database::class, "labelPropertiesGet")]
#[CoversMethod(Database::class, "labelValidateId")]
//#[CoversMethod(Database::class, "labelPropertiesGet")]
//#[CoversMethod(Database::class, "labelValidateId")]
public function testGetThePropertiesOfAnInvalidLabelByName(): void {
$this->assertException("typeViolation", "Db", "ExceptionInput");
Arsse::$db->labelPropertiesGet("john.doe@example.com", [], true);
}
#[CoversMethod(Database::class, "labelPropertiesGet")]
#[CoversMethod(Database::class, "labelValidateId")]
//#[CoversMethod(Database::class, "labelPropertiesGet")]
//#[CoversMethod(Database::class, "labelValidateId")]
public function testGetThePropertiesOfALabelOfTheWrongOwner(): void {
$this->assertException("subjectMissing", "Db", "ExceptionInput");
Arsse::$db->labelPropertiesGet("john.doe@example.com", 3); // label ID 3 belongs to Jane
}
#[CoversMethod(Database::class, "labelPropertiesSet")]
#[CoversMethod(Database::class, "labelValidateId")]
#[CoversMethod(Database::class, "labelValidateName")]
//#[CoversMethod(Database::class, "labelPropertiesSet")]
//#[CoversMethod(Database::class, "labelValidateId")]
//#[CoversMethod(Database::class, "labelValidateName")]
public function testMakeNoChangesToALabel(): void {
$this->assertFalse(Arsse::$db->labelPropertiesSet("john.doe@example.com", 1, []));
}
#[CoversMethod(Database::class, "labelPropertiesSet")]
#[CoversMethod(Database::class, "labelValidateId")]
#[CoversMethod(Database::class, "labelValidateName")]
//#[CoversMethod(Database::class, "labelPropertiesSet")]
//#[CoversMethod(Database::class, "labelValidateId")]
//#[CoversMethod(Database::class, "labelValidateName")]
public function testRenameALabel(): void {
$this->assertTrue(Arsse::$db->labelPropertiesSet("john.doe@example.com", 1, ['name' => "Curious"]));
$state = $this->primeExpectations($this->data, $this->checkLabels);
@ -416,9 +416,9 @@ trait SeriesLabel {
$this->compareExpectations(static::$drv, $state);
}
#[CoversMethod(Database::class, "labelPropertiesSet")]
#[CoversMethod(Database::class, "labelValidateId")]
#[CoversMethod(Database::class, "labelValidateName")]
//#[CoversMethod(Database::class, "labelPropertiesSet")]
//#[CoversMethod(Database::class, "labelValidateId")]
//#[CoversMethod(Database::class, "labelValidateName")]
public function testRenameALabelByName(): void {
$this->assertTrue(Arsse::$db->labelPropertiesSet("john.doe@example.com", "Interesting", ['name' => "Curious"], true));
$state = $this->primeExpectations($this->data, $this->checkLabels);
@ -426,72 +426,72 @@ trait SeriesLabel {
$this->compareExpectations(static::$drv, $state);
}
#[CoversMethod(Database::class, "labelPropertiesSet")]
#[CoversMethod(Database::class, "labelValidateId")]
#[CoversMethod(Database::class, "labelValidateName")]
//#[CoversMethod(Database::class, "labelPropertiesSet")]
//#[CoversMethod(Database::class, "labelValidateId")]
//#[CoversMethod(Database::class, "labelValidateName")]
public function testRenameALabelToTheEmptyString(): void {
$this->assertException("missing", "Db", "ExceptionInput");
$this->assertTrue(Arsse::$db->labelPropertiesSet("john.doe@example.com", 1, ['name' => ""]));
}
#[CoversMethod(Database::class, "labelPropertiesSet")]
#[CoversMethod(Database::class, "labelValidateId")]
#[CoversMethod(Database::class, "labelValidateName")]
//#[CoversMethod(Database::class, "labelPropertiesSet")]
//#[CoversMethod(Database::class, "labelValidateId")]
//#[CoversMethod(Database::class, "labelValidateName")]
public function testRenameALabelToWhitespaceOnly(): void {
$this->assertException("whitespace", "Db", "ExceptionInput");
$this->assertTrue(Arsse::$db->labelPropertiesSet("john.doe@example.com", 1, ['name' => " "]));
}
#[CoversMethod(Database::class, "labelPropertiesSet")]
#[CoversMethod(Database::class, "labelValidateId")]
#[CoversMethod(Database::class, "labelValidateName")]
//#[CoversMethod(Database::class, "labelPropertiesSet")]
//#[CoversMethod(Database::class, "labelValidateId")]
//#[CoversMethod(Database::class, "labelValidateName")]
public function testRenameALabelToAnInvalidValue(): void {
$this->assertException("typeViolation", "Db", "ExceptionInput");
$this->assertTrue(Arsse::$db->labelPropertiesSet("john.doe@example.com", 1, ['name' => []]));
}
#[CoversMethod(Database::class, "labelPropertiesSet")]
#[CoversMethod(Database::class, "labelValidateId")]
#[CoversMethod(Database::class, "labelValidateName")]
//#[CoversMethod(Database::class, "labelPropertiesSet")]
//#[CoversMethod(Database::class, "labelValidateId")]
//#[CoversMethod(Database::class, "labelValidateName")]
public function testCauseALabelCollision(): void {
$this->assertException("constraintViolation", "Db", "ExceptionInput");
Arsse::$db->labelPropertiesSet("john.doe@example.com", 1, ['name' => "Fascinating"]);
}
#[CoversMethod(Database::class, "labelPropertiesSet")]
#[CoversMethod(Database::class, "labelValidateId")]
#[CoversMethod(Database::class, "labelValidateName")]
//#[CoversMethod(Database::class, "labelPropertiesSet")]
//#[CoversMethod(Database::class, "labelValidateId")]
//#[CoversMethod(Database::class, "labelValidateName")]
public function testSetThePropertiesOfAMissingLabel(): void {
$this->assertException("subjectMissing", "Db", "ExceptionInput");
Arsse::$db->labelPropertiesSet("john.doe@example.com", 2112, ['name' => "Exciting"]);
}
#[CoversMethod(Database::class, "labelPropertiesSet")]
#[CoversMethod(Database::class, "labelValidateId")]
#[CoversMethod(Database::class, "labelValidateName")]
//#[CoversMethod(Database::class, "labelPropertiesSet")]
//#[CoversMethod(Database::class, "labelValidateId")]
//#[CoversMethod(Database::class, "labelValidateName")]
public function testSetThePropertiesOfAnInvalidLabel(): void {
$this->assertException("typeViolation", "Db", "ExceptionInput");
Arsse::$db->labelPropertiesSet("john.doe@example.com", -1, ['name' => "Exciting"]);
}
#[CoversMethod(Database::class, "labelPropertiesSet")]
#[CoversMethod(Database::class, "labelValidateId")]
#[CoversMethod(Database::class, "labelValidateName")]
//#[CoversMethod(Database::class, "labelPropertiesSet")]
//#[CoversMethod(Database::class, "labelValidateId")]
//#[CoversMethod(Database::class, "labelValidateName")]
public function testSetThePropertiesOfAnInvalidLabelByName(): void {
$this->assertException("typeViolation", "Db", "ExceptionInput");
Arsse::$db->labelPropertiesSet("john.doe@example.com", [], ['name' => "Exciting"], true);
}
#[CoversMethod(Database::class, "labelPropertiesSet")]
#[CoversMethod(Database::class, "labelValidateId")]
#[CoversMethod(Database::class, "labelValidateName")]
//#[CoversMethod(Database::class, "labelPropertiesSet")]
//#[CoversMethod(Database::class, "labelValidateId")]
//#[CoversMethod(Database::class, "labelValidateName")]
public function testSetThePropertiesOfALabelForTheWrongOwner(): void {
$this->assertException("subjectMissing", "Db", "ExceptionInput");
Arsse::$db->labelPropertiesSet("john.doe@example.com", 3, ['name' => "Exciting"]); // label ID 3 belongs to Jane
}
#[CoversMethod(Database::class, "labelArticlesGet")]
#[CoversMethod(Database::class, "labelValidateId")]
//#[CoversMethod(Database::class, "labelArticlesGet")]
//#[CoversMethod(Database::class, "labelValidateId")]
public function testListLabelledArticles(): void {
$exp = [1,19];
$this->assertEquals($exp, Arsse::$db->labelArticlesGet("john.doe@example.com", 1));
@ -504,22 +504,22 @@ trait SeriesLabel {
$this->assertEquals($exp, Arsse::$db->labelArticlesGet("john.doe@example.com", "Lonely", true));
}
#[CoversMethod(Database::class, "labelArticlesGet")]
#[CoversMethod(Database::class, "labelValidateId")]
//#[CoversMethod(Database::class, "labelArticlesGet")]
//#[CoversMethod(Database::class, "labelValidateId")]
public function testListLabelledArticlesForAMissingLabel(): void {
$this->assertException("subjectMissing", "Db", "ExceptionInput");
Arsse::$db->labelArticlesGet("john.doe@example.com", 3);
}
#[CoversMethod(Database::class, "labelArticlesGet")]
#[CoversMethod(Database::class, "labelValidateId")]
//#[CoversMethod(Database::class, "labelArticlesGet")]
//#[CoversMethod(Database::class, "labelValidateId")]
public function testListLabelledArticlesForAnInvalidLabel(): void {
$this->assertException("typeViolation", "Db", "ExceptionInput");
Arsse::$db->labelArticlesGet("john.doe@example.com", -1);
}
#[CoversMethod(Database::class, "labelArticlesSet")]
#[CoversMethod(Database::class, "labelValidateId")]
//#[CoversMethod(Database::class, "labelArticlesSet")]
//#[CoversMethod(Database::class, "labelValidateId")]
public function testApplyALabelToArticles(): void {
Arsse::$db->labelArticlesSet("john.doe@example.com", 1, (new Context)->articles([2,5]));
$state = $this->primeExpectations($this->data, $this->checkMembers);
@ -528,8 +528,8 @@ trait SeriesLabel {
$this->compareExpectations(static::$drv, $state);
}
#[CoversMethod(Database::class, "labelArticlesSet")]
#[CoversMethod(Database::class, "labelValidateId")]
//#[CoversMethod(Database::class, "labelArticlesSet")]
//#[CoversMethod(Database::class, "labelValidateId")]
public function testClearALabelFromArticles(): void {
Arsse::$db->labelArticlesSet("john.doe@example.com", 1, (new Context)->articles([1,5]), Database::ASSOC_REMOVE);
$state = $this->primeExpectations($this->data, $this->checkMembers);
@ -537,8 +537,8 @@ trait SeriesLabel {
$this->compareExpectations(static::$drv, $state);
}
#[CoversMethod(Database::class, "labelArticlesSet")]
#[CoversMethod(Database::class, "labelValidateId")]
//#[CoversMethod(Database::class, "labelArticlesSet")]
//#[CoversMethod(Database::class, "labelValidateId")]
public function testApplyALabelToArticlesByName(): void {
Arsse::$db->labelArticlesSet("john.doe@example.com", "Interesting", (new Context)->articles([2,5]), Database::ASSOC_ADD, true);
$state = $this->primeExpectations($this->data, $this->checkMembers);
@ -547,8 +547,8 @@ trait SeriesLabel {
$this->compareExpectations(static::$drv, $state);
}
#[CoversMethod(Database::class, "labelArticlesSet")]
#[CoversMethod(Database::class, "labelValidateId")]
//#[CoversMethod(Database::class, "labelArticlesSet")]
//#[CoversMethod(Database::class, "labelValidateId")]
public function testClearALabelFromArticlesByName(): void {
Arsse::$db->labelArticlesSet("john.doe@example.com", "Interesting", (new Context)->articles([1,5]), Database::ASSOC_REMOVE, true);
$state = $this->primeExpectations($this->data, $this->checkMembers);
@ -556,24 +556,24 @@ trait SeriesLabel {
$this->compareExpectations(static::$drv, $state);
}
#[CoversMethod(Database::class, "labelArticlesSet")]
#[CoversMethod(Database::class, "labelValidateId")]
//#[CoversMethod(Database::class, "labelArticlesSet")]
//#[CoversMethod(Database::class, "labelValidateId")]
public function testApplyALabelToNoArticles(): void {
Arsse::$db->labelArticlesSet("john.doe@example.com", 1, (new Context)->articles([10000]));
$state = $this->primeExpectations($this->data, $this->checkMembers);
$this->compareExpectations(static::$drv, $state);
}
#[CoversMethod(Database::class, "labelArticlesSet")]
#[CoversMethod(Database::class, "labelValidateId")]
//#[CoversMethod(Database::class, "labelArticlesSet")]
//#[CoversMethod(Database::class, "labelValidateId")]
public function testClearALabelFromNoArticles(): void {
Arsse::$db->labelArticlesSet("john.doe@example.com", 1, (new Context)->articles([10000]), Database::ASSOC_REMOVE);
$state = $this->primeExpectations($this->data, $this->checkMembers);
$this->compareExpectations(static::$drv, $state);
}
#[CoversMethod(Database::class, "labelArticlesSet")]
#[CoversMethod(Database::class, "labelValidateId")]
//#[CoversMethod(Database::class, "labelArticlesSet")]
//#[CoversMethod(Database::class, "labelValidateId")]
public function testReplaceArticlesOfALabel(): void {
Arsse::$db->labelArticlesSet("john.doe@example.com", 1, (new Context)->articles([2,5]), Database::ASSOC_REPLACE);
$state = $this->primeExpectations($this->data, $this->checkMembers);
@ -584,8 +584,8 @@ trait SeriesLabel {
$this->compareExpectations(static::$drv, $state);
}
#[CoversMethod(Database::class, "labelArticlesSet")]
#[CoversMethod(Database::class, "labelValidateId")]
//#[CoversMethod(Database::class, "labelArticlesSet")]
//#[CoversMethod(Database::class, "labelValidateId")]
public function testPurgeArticlesOfALabel(): void {
Arsse::$db->labelArticlesSet("john.doe@example.com", 1, (new Context)->articles([10000]), Database::ASSOC_REPLACE);
$state = $this->primeExpectations($this->data, $this->checkMembers);

View file

@ -38,7 +38,7 @@ trait SeriesMeta {
unset($this->data);
}
#[CoversMethod(Database::class, "metaSet")]
//#[CoversMethod(Database::class, "metaSet")]
public function testAddANewValue(): void {
$this->assertTrue(Arsse::$db->metaSet("favourite", "Cygnus X-1"));
$state = $this->primeExpectations($this->data, ['arsse_meta' => ['key','value']]);
@ -46,7 +46,7 @@ trait SeriesMeta {
$this->compareExpectations(static::$drv, $state);
}
#[CoversMethod(Database::class, "metaSet")]
//#[CoversMethod(Database::class, "metaSet")]
public function testAddANewTypedValue(): void {
$this->assertTrue(Arsse::$db->metaSet("answer", 42, "int"));
$this->assertTrue(Arsse::$db->metaSet("true", true, "bool"));
@ -60,7 +60,7 @@ trait SeriesMeta {
$this->compareExpectations(static::$drv, $state);
}
#[CoversMethod(Database::class, "metaSet")]
//#[CoversMethod(Database::class, "metaSet")]
public function testChangeAnExistingValue(): void {
$this->assertTrue(Arsse::$db->metaSet("album", "Hemispheres"));
$state = $this->primeExpectations($this->data, ['arsse_meta' => ['key','value']]);
@ -68,7 +68,7 @@ trait SeriesMeta {
$this->compareExpectations(static::$drv, $state);
}
#[CoversMethod(Database::class, "metaRemove")]
//#[CoversMethod(Database::class, "metaRemove")]
public function testRemoveAValue(): void {
$this->assertTrue(Arsse::$db->metaRemove("album"));
$this->assertFalse(Arsse::$db->metaRemove("album"));
@ -77,7 +77,7 @@ trait SeriesMeta {
$this->compareExpectations(static::$drv, $state);
}
#[CoversMethod(Database::class, "metaGet")]
//#[CoversMethod(Database::class, "metaGet")]
public function testRetrieveAValue(): void {
$this->assertSame("".Database::SCHEMA_VERSION, Arsse::$db->metaGet("schema_version"));
$this->assertSame("A Farewell to Kings", Arsse::$db->metaGet("album"));

View file

@ -22,18 +22,18 @@ trait SeriesMiscellany {
protected function tearDownSeriesMiscellany(): void {
}
#[CoversMethod(Database::class, "__construct")]
#[CoversMethod(Database::class, "driverSchemaVersion")]
#[CoversMethod(Database::class, "driverSchemaUpdate")]
//#[CoversMethod(Database::class, "__construct")]
//#[CoversMethod(Database::class, "driverSchemaVersion")]
//#[CoversMethod(Database::class, "driverSchemaUpdate")]
public function testInitializeDatabase(): void {
static::dbRaze(static::$drv);
$d = new Database(true);
$this->assertSame(Database::SCHEMA_VERSION, $d->driverSchemaVersion());
}
#[CoversMethod(Database::class, "__construct")]
#[CoversMethod(Database::class, "driverSchemaVersion")]
#[CoversMethod(Database::class, "driverSchemaUpdate")]
//#[CoversMethod(Database::class, "__construct")]
//#[CoversMethod(Database::class, "driverSchemaVersion")]
//#[CoversMethod(Database::class, "driverSchemaUpdate")]
public function testManuallyInitializeDatabase(): void {
static::dbRaze(static::$drv);
$d = new Database(false);
@ -43,12 +43,12 @@ trait SeriesMiscellany {
$this->assertFalse($d->driverSchemaUpdate());
}
#[CoversMethod(Database::class, "driverCharsetAcceptable")]
//#[CoversMethod(Database::class, "driverCharsetAcceptable")]
public function testCheckCharacterSetAcceptability(): void {
$this->assertIsBool(Arsse::$db->driverCharsetAcceptable());
}
#[CoversMethod(Database::class, "driverMaintenance")]
//#[CoversMethod(Database::class, "driverMaintenance")]
public function testPerformMaintenance(): void {
$this->assertTrue(Arsse::$db->driverMaintenance());
}

View file

@ -58,8 +58,8 @@ trait SeriesSession {
unset($this->data);
}
#[CoversMethod(Database::class, "sessionResume")]
#[CoversMethod(Database::class, "sessionExpiringSoon")]
//#[CoversMethod(Database::class, "sessionResume")]
//#[CoversMethod(Database::class, "sessionExpiringSoon")]
public function testResumeAValidSession(): void {
$exp1 = [
'id' => "80fa94c1a11f11e78667001e673b2560",
@ -78,28 +78,28 @@ trait SeriesSession {
$this->compareExpectations(static::$drv, $state);
}
#[CoversMethod(Database::class, "sessionResume")]
#[CoversMethod(Database::class, "sessionExpiringSoon")]
//#[CoversMethod(Database::class, "sessionResume")]
//#[CoversMethod(Database::class, "sessionExpiringSoon")]
public function testResumeAMissingSession(): void {
$this->assertException("invalid", "User", "ExceptionSession");
Arsse::$db->sessionResume("thisSessionDoesNotExist");
}
#[CoversMethod(Database::class, "sessionResume")]
#[CoversMethod(Database::class, "sessionExpiringSoon")]
//#[CoversMethod(Database::class, "sessionResume")]
//#[CoversMethod(Database::class, "sessionExpiringSoon")]
public function testResumeAnExpiredSession(): void {
$this->assertException("invalid", "User", "ExceptionSession");
Arsse::$db->sessionResume("27c6de8da13311e78667001e673b2560");
}
#[CoversMethod(Database::class, "sessionResume")]
#[CoversMethod(Database::class, "sessionExpiringSoon")]
//#[CoversMethod(Database::class, "sessionResume")]
//#[CoversMethod(Database::class, "sessionExpiringSoon")]
public function testResumeAStaleSession(): void {
$this->assertException("invalid", "User", "ExceptionSession");
Arsse::$db->sessionResume("ab3b3eb8a13311e78667001e673b2560");
}
#[CoversMethod(Database::class, "sessionCreate")]
//#[CoversMethod(Database::class, "sessionCreate")]
public function testCreateASession(): void {
$user = "jane.doe@example.com";
$id = Arsse::$db->sessionCreate($user);
@ -109,7 +109,7 @@ trait SeriesSession {
$this->compareExpectations(static::$drv, $state);
}
#[CoversMethod(Database::class, "sessionDestroy")]
//#[CoversMethod(Database::class, "sessionDestroy")]
public function testDestroyASession(): void {
$user = "jane.doe@example.com";
$id = "80fa94c1a11f11e78667001e673b2560";
@ -121,7 +121,7 @@ trait SeriesSession {
$this->assertFalse(Arsse::$db->sessionDestroy($user, $id));
}
#[CoversMethod(Database::class, "sessionDestroy")]
//#[CoversMethod(Database::class, "sessionDestroy")]
public function testDestroyAllSessions(): void {
$user = "jane.doe@example.com";
$this->assertTrue(Arsse::$db->sessionDestroy($user));
@ -132,7 +132,7 @@ trait SeriesSession {
$this->compareExpectations(static::$drv, $state);
}
#[CoversMethod(Database::class, "sessionDestroy")]
//#[CoversMethod(Database::class, "sessionDestroy")]
public function testDestroyASessionForTheWrongUser(): void {
$user = "john.doe@example.com";
$id = "80fa94c1a11f11e78667001e673b2560";

View file

@ -207,8 +207,8 @@ trait SeriesSubscription {
unset($this->data, $this->user);
}
#[CoversMethod(Database::class, "subscriptionAdd")]
#[CoversMethod(Database::class, "feedAdd")]
//#[CoversMethod(Database::class, "subscriptionAdd")]
//#[CoversMethod(Database::class, "feedAdd")]
public function testAddASubscriptionToAnExistingFeed(): void {
$url = "http://example.com/feed1";
$subID = $this->nextID("arsse_subscriptions");
@ -224,8 +224,8 @@ trait SeriesSubscription {
$this->compareExpectations(static::$drv, $state);
}
#[CoversMethod(Database::class, "subscriptionAdd")]
#[CoversMethod(Database::class, "feedAdd")]
//#[CoversMethod(Database::class, "subscriptionAdd")]
//#[CoversMethod(Database::class, "feedAdd")]
public function testAddASubscriptionToANewFeed(): void {
$url = "http://example.org/feed1";
$feedID = $this->nextID("arsse_feeds");
@ -243,8 +243,8 @@ trait SeriesSubscription {
$this->compareExpectations(static::$drv, $state);
}
#[CoversMethod(Database::class, "subscriptionAdd")]
#[CoversMethod(Database::class, "feedAdd")]
//#[CoversMethod(Database::class, "subscriptionAdd")]
//#[CoversMethod(Database::class, "feedAdd")]
public function testAddASubscriptionToANewFeedViaDiscovery(): void {
$url = "http://localhost:8000/Feed/Discovery/Valid";
$discovered = "http://localhost:8000/Feed/Discovery/Feed";
@ -263,8 +263,8 @@ trait SeriesSubscription {
$this->compareExpectations(static::$drv, $state);
}
#[CoversMethod(Database::class, "subscriptionAdd")]
#[CoversMethod(Database::class, "feedAdd")]
//#[CoversMethod(Database::class, "subscriptionAdd")]
//#[CoversMethod(Database::class, "feedAdd")]
public function testAddASubscriptionToAnInvalidFeed(): void {
$url = "http://example.org/feed1";
$feedID = $this->nextID("arsse_feeds");
@ -283,24 +283,24 @@ trait SeriesSubscription {
}
}
#[CoversMethod(Database::class, "subscriptionAdd")]
#[CoversMethod(Database::class, "feedAdd")]
//#[CoversMethod(Database::class, "subscriptionAdd")]
//#[CoversMethod(Database::class, "feedAdd")]
public function testAddADuplicateSubscription(): void {
$url = "http://example.com/feed2";
$this->assertException("constraintViolation", "Db", "ExceptionInput");
Arsse::$db->subscriptionAdd($this->user, $url);
}
#[CoversMethod(Database::class, "subscriptionAdd")]
#[CoversMethod(Database::class, "feedAdd")]
//#[CoversMethod(Database::class, "subscriptionAdd")]
//#[CoversMethod(Database::class, "feedAdd")]
public function testAddADuplicateSubscriptionWithEquivalentUrl(): void {
$url = "http://EXAMPLE.COM/feed2";
$this->assertException("constraintViolation", "Db", "ExceptionInput");
Arsse::$db->subscriptionAdd($this->user, $url);
}
#[CoversMethod(Database::class, "subscriptionAdd")]
#[CoversMethod(Database::class, "feedAdd")]
//#[CoversMethod(Database::class, "subscriptionAdd")]
//#[CoversMethod(Database::class, "feedAdd")]
public function testAddADuplicateSubscriptionViaRedirection(): void {
$url = "http://localhost:8000/Feed/Parsing/Valid";
Arsse::$db->subscriptionAdd($this->user, $url);
@ -309,7 +309,7 @@ trait SeriesSubscription {
$this->assertSame($subID, Arsse::$db->subscriptionAdd($this->user, $url));
}
#[CoversMethod(Database::class, "subscriptionRemove")]
//#[CoversMethod(Database::class, "subscriptionRemove")]
public function testRemoveASubscription(): void {
$this->assertTrue(Arsse::$db->subscriptionRemove($this->user, 1));
$state = $this->primeExpectations($this->data, [
@ -320,27 +320,27 @@ trait SeriesSubscription {
$this->compareExpectations(static::$drv, $state);
}
#[CoversMethod(Database::class, "subscriptionRemove")]
//#[CoversMethod(Database::class, "subscriptionRemove")]
public function testRemoveAMissingSubscription(): void {
$this->assertException("subjectMissing", "Db", "ExceptionInput");
Arsse::$db->subscriptionRemove($this->user, 2112);
}
#[CoversMethod(Database::class, "subscriptionRemove")]
//#[CoversMethod(Database::class, "subscriptionRemove")]
public function testRemoveAnInvalidSubscription(): void {
$this->assertException("typeViolation", "Db", "ExceptionInput");
Arsse::$db->subscriptionRemove($this->user, -1);
}
#[CoversMethod(Database::class, "subscriptionRemove")]
//#[CoversMethod(Database::class, "subscriptionRemove")]
public function testRemoveASubscriptionForTheWrongOwner(): void {
$this->user = "jane.doe@example.com";
$this->assertException("subjectMissing", "Db", "ExceptionInput");
Arsse::$db->subscriptionRemove($this->user, 1);
}
#[CoversMethod(Database::class, "subscriptionList")]
#[CoversMethod(Database::class, "subscriptionPropertiesGet")]
//#[CoversMethod(Database::class, "subscriptionList")]
//#[CoversMethod(Database::class, "subscriptionPropertiesGet")]
public function testListSubscriptions(): void {
$exp = [
[
@ -401,7 +401,7 @@ trait SeriesSubscription {
$this->assertResult($exp, Arsse::$db->subscriptionList("jill.doe@example.com"));
}
#[CoversMethod(Database::class, "subscriptionList")]
//#[CoversMethod(Database::class, "subscriptionList")]
public function testListSubscriptionsInAFolder(): void {
$exp = [
[
@ -417,7 +417,7 @@ trait SeriesSubscription {
$this->assertResult($exp, Arsse::$db->subscriptionList($this->user, null, false));
}
#[CoversMethod(Database::class, "subscriptionList")]
//#[CoversMethod(Database::class, "subscriptionList")]
public function testListSubscriptionsWithRecursion(): void {
$exp = [
[
@ -433,39 +433,39 @@ trait SeriesSubscription {
$this->assertResult($exp, Arsse::$db->subscriptionList($this->user, 2));
}
#[CoversMethod(Database::class, "subscriptionList")]
//#[CoversMethod(Database::class, "subscriptionList")]
public function testListSubscriptionsInAMissingFolder(): void {
$this->assertException("idMissing", "Db", "ExceptionInput");
Arsse::$db->subscriptionList($this->user, 4);
}
#[CoversMethod(Database::class, "subscriptionCount")]
//#[CoversMethod(Database::class, "subscriptionCount")]
public function testCountSubscriptions(): void {
$this->assertSame(3, Arsse::$db->subscriptionCount($this->user));
$this->assertSame(1, Arsse::$db->subscriptionCount($this->user, 2));
}
#[CoversMethod(Database::class, "subscriptionCount")]
//#[CoversMethod(Database::class, "subscriptionCount")]
public function testCountSubscriptionsInAMissingFolder(): void {
$this->assertException("idMissing", "Db", "ExceptionInput");
Arsse::$db->subscriptionCount($this->user, 4);
}
#[CoversMethod(Database::class, "subscriptionPropertiesGet")]
//#[CoversMethod(Database::class, "subscriptionPropertiesGet")]
public function testGetThePropertiesOfAMissingSubscription(): void {
$this->assertException("subjectMissing", "Db", "ExceptionInput");
Arsse::$db->subscriptionPropertiesGet($this->user, 2112);
}
#[CoversMethod(Database::class, "subscriptionPropertiesGet")]
//#[CoversMethod(Database::class, "subscriptionPropertiesGet")]
public function testGetThePropertiesOfAnInvalidSubscription(): void {
$this->assertException("typeViolation", "Db", "ExceptionInput");
Arsse::$db->subscriptionPropertiesGet($this->user, -1);
}
#[CoversMethod(Database::class, "subscriptionPropertiesSet")]
#[CoversMethod(Database::class, "subscriptionValidateId")]
#[CoversMethod(Database::class, "subscriptionRulesApply")]
//#[CoversMethod(Database::class, "subscriptionPropertiesSet")]
//#[CoversMethod(Database::class, "subscriptionValidateId")]
//#[CoversMethod(Database::class, "subscriptionRulesApply")]
public function testSetThePropertiesOfASubscription(): void {
Arsse::$db->subscriptionPropertiesSet($this->user, 1, [
'title' => "Ook Ook",
@ -494,25 +494,25 @@ trait SeriesSubscription {
$this->compareExpectations(static::$drv, $state);
}
#[CoversMethod(Database::class, "subscriptionPropertiesSet")]
#[CoversMethod(Database::class, "subscriptionValidateId")]
#[CoversMethod(Database::class, "subscriptionRulesApply")]
//#[CoversMethod(Database::class, "subscriptionPropertiesSet")]
//#[CoversMethod(Database::class, "subscriptionValidateId")]
//#[CoversMethod(Database::class, "subscriptionRulesApply")]
public function testMoveASubscriptionToAMissingFolder(): void {
$this->assertException("idMissing", "Db", "ExceptionInput");
Arsse::$db->subscriptionPropertiesSet($this->user, 1, ['folder' => 4]);
}
#[CoversMethod(Database::class, "subscriptionPropertiesSet")]
#[CoversMethod(Database::class, "subscriptionValidateId")]
#[CoversMethod(Database::class, "subscriptionRulesApply")]
//#[CoversMethod(Database::class, "subscriptionPropertiesSet")]
//#[CoversMethod(Database::class, "subscriptionValidateId")]
//#[CoversMethod(Database::class, "subscriptionRulesApply")]
public function testMoveASubscriptionToTheRootFolder(): void {
$this->assertTrue(Arsse::$db->subscriptionPropertiesSet($this->user, 3, ['folder' => null]));
}
#[DataProvider("provideInvalidSubscriptionProperties")]
#[CoversMethod(Database::class, "subscriptionPropertiesSet")]
#[CoversMethod(Database::class, "subscriptionValidateId")]
#[CoversMethod(Database::class, "subscriptionRulesApply")]
//#[CoversMethod(Database::class, "subscriptionPropertiesSet")]
//#[CoversMethod(Database::class, "subscriptionValidateId")]
//#[CoversMethod(Database::class, "subscriptionRulesApply")]
public function testSetThePropertiesOfASubscriptionToInvalidValues(array $data, string $exp): void {
$this->assertException($exp, "Db", "ExceptionInput");
Arsse::$db->subscriptionPropertiesSet($this->user, 1, $data);
@ -530,30 +530,30 @@ trait SeriesSubscription {
];
}
#[CoversMethod(Database::class, "subscriptionPropertiesSet")]
#[CoversMethod(Database::class, "subscriptionValidateId")]
#[CoversMethod(Database::class, "subscriptionRulesApply")]
//#[CoversMethod(Database::class, "subscriptionPropertiesSet")]
//#[CoversMethod(Database::class, "subscriptionValidateId")]
//#[CoversMethod(Database::class, "subscriptionRulesApply")]
public function testRenameASubscriptionToZero(): void {
$this->assertTrue(Arsse::$db->subscriptionPropertiesSet($this->user, 1, ['title' => 0]));
}
#[CoversMethod(Database::class, "subscriptionPropertiesSet")]
#[CoversMethod(Database::class, "subscriptionValidateId")]
#[CoversMethod(Database::class, "subscriptionRulesApply")]
//#[CoversMethod(Database::class, "subscriptionPropertiesSet")]
//#[CoversMethod(Database::class, "subscriptionValidateId")]
//#[CoversMethod(Database::class, "subscriptionRulesApply")]
public function testSetThePropertiesOfAMissingSubscription(): void {
$this->assertException("subjectMissing", "Db", "ExceptionInput");
Arsse::$db->subscriptionPropertiesSet($this->user, 2112, ['folder' => null]);
}
#[CoversMethod(Database::class, "subscriptionPropertiesSet")]
#[CoversMethod(Database::class, "subscriptionValidateId")]
#[CoversMethod(Database::class, "subscriptionRulesApply")]
//#[CoversMethod(Database::class, "subscriptionPropertiesSet")]
//#[CoversMethod(Database::class, "subscriptionValidateId")]
//#[CoversMethod(Database::class, "subscriptionRulesApply")]
public function testSetThePropertiesOfAnInvalidSubscription(): void {
$this->assertException("typeViolation", "Db", "ExceptionInput");
Arsse::$db->subscriptionPropertiesSet($this->user, -1, ['folder' => null]);
}
#[CoversMethod(Database::class, "subscriptionIcon")]
//#[CoversMethod(Database::class, "subscriptionIcon")]
public function testRetrieveTheFaviconOfASubscription(): void {
$exp = "http://example.com/favicon.ico";
$this->assertSame($exp, Arsse::$db->subscriptionIcon(null, 1)['url']);
@ -561,13 +561,13 @@ trait SeriesSubscription {
$this->assertSame(null, Arsse::$db->subscriptionIcon(null, 6));
}
#[CoversMethod(Database::class, "subscriptionIcon")]
//#[CoversMethod(Database::class, "subscriptionIcon")]
public function testRetrieveTheFaviconOfAMissingSubscription(): void {
$this->assertException("subjectMissing", "Db", "ExceptionInput");
Arsse::$db->subscriptionIcon(null, -2112);
}
#[CoversMethod(Database::class, "subscriptionIcon")]
//#[CoversMethod(Database::class, "subscriptionIcon")]
public function testRetrieveTheFaviconOfASubscriptionWithUser(): void {
$exp = "http://example.com/favicon.ico";
$user = "john.doe@example.com";
@ -577,14 +577,14 @@ trait SeriesSubscription {
$this->assertSame($exp, Arsse::$db->subscriptionIcon($user, 2)['url']);
}
#[CoversMethod(Database::class, "subscriptionIcon")]
//#[CoversMethod(Database::class, "subscriptionIcon")]
public function testRetrieveTheFaviconOfASubscriptionOfTheWrongUser(): void {
$user = "john.doe@example.com";
$this->assertException("subjectMissing", "Db", "ExceptionInput");
Arsse::$db->subscriptionIcon($user, 2);
}
#[CoversMethod(Database::class, "subscriptionTagsGet")]
//#[CoversMethod(Database::class, "subscriptionTagsGet")]
public function testListTheTagsOfASubscription(): void {
$this->assertEquals([1,2], Arsse::$db->subscriptionTagsGet("john.doe@example.com", 1));
$this->assertEquals([2], Arsse::$db->subscriptionTagsGet("john.doe@example.com", 3));
@ -592,28 +592,28 @@ trait SeriesSubscription {
$this->assertEquals(["Fascinating"], Arsse::$db->subscriptionTagsGet("john.doe@example.com", 3, true));
}
#[CoversMethod(Database::class, "subscriptionTagsGet")]
//#[CoversMethod(Database::class, "subscriptionTagsGet")]
public function testListTheTagsOfAMissingSubscription(): void {
$this->assertException("subjectMissing", "Db", "ExceptionInput");
Arsse::$db->subscriptionTagsGet($this->user, 101);
}
#[CoversMethod(Database::class, "subscriptionRefreshed")]
//#[CoversMethod(Database::class, "subscriptionRefreshed")]
public function testGetRefreshTimeOfASubscription(): void {
$user = "john.doe@example.com";
$this->assertTime(strtotime("now + 1 hour"), Arsse::$db->subscriptionRefreshed($user));
$this->assertTime(strtotime("now - 1 hour"), Arsse::$db->subscriptionRefreshed($user, 1));
}
#[CoversMethod(Database::class, "subscriptionRefreshed")]
//#[CoversMethod(Database::class, "subscriptionRefreshed")]
public function testGetRefreshTimeOfAMissingSubscription(): void {
$this->assertException("subjectMissing", "Db", "ExceptionInput");
$this->assertTime(strtotime("now - 1 hour"), Arsse::$db->subscriptionRefreshed("john.doe@example.com", 2));
}
#[CoversMethod(Database::class, "subscriptionPropertiesSet")]
#[CoversMethod(Database::class, "subscriptionValidateId")]
#[CoversMethod(Database::class, "subscriptionRulesApply")]
//#[CoversMethod(Database::class, "subscriptionPropertiesSet")]
//#[CoversMethod(Database::class, "subscriptionValidateId")]
//#[CoversMethod(Database::class, "subscriptionRulesApply")]
public function testSetTheFilterRulesOfASubscriptionCheckingMarks(): void {
Arsse::$db->subscriptionPropertiesSet("jack.doe@example.com", 5, ['keep_rule' => "1|B|3|D", 'block_rule' => "4"]);
$state = $this->primeExpectations($this->data, ['arsse_marks' => ['article', 'subscription', 'hidden']]);

View file

@ -115,8 +115,8 @@ trait SeriesTag {
unset($this->data, $this->checkTags, $this->checkMembers, $this->user);
}
#[CoversMethod(Database::class, "tagAdd")]
#[CoversMethod(Database::class, "tagValidateName")]
//#[CoversMethod(Database::class, "tagAdd")]
//#[CoversMethod(Database::class, "tagValidateName")]
public function testAddATag(): void {
$user = "john.doe@example.com";
$tagID = $this->nextID("arsse_tags");
@ -126,35 +126,35 @@ trait SeriesTag {
$this->compareExpectations(static::$drv, $state);
}
#[CoversMethod(Database::class, "tagAdd")]
#[CoversMethod(Database::class, "tagValidateName")]
//#[CoversMethod(Database::class, "tagAdd")]
//#[CoversMethod(Database::class, "tagValidateName")]
public function testAddADuplicateTag(): void {
$this->assertException("constraintViolation", "Db", "ExceptionInput");
Arsse::$db->tagAdd("john.doe@example.com", ['name' => "Interesting"]);
}
#[CoversMethod(Database::class, "tagAdd")]
#[CoversMethod(Database::class, "tagValidateName")]
//#[CoversMethod(Database::class, "tagAdd")]
//#[CoversMethod(Database::class, "tagValidateName")]
public function testAddATagWithAMissingName(): void {
$this->assertException("missing", "Db", "ExceptionInput");
Arsse::$db->tagAdd("john.doe@example.com", []);
}
#[CoversMethod(Database::class, "tagAdd")]
#[CoversMethod(Database::class, "tagValidateName")]
//#[CoversMethod(Database::class, "tagAdd")]
//#[CoversMethod(Database::class, "tagValidateName")]
public function testAddATagWithABlankName(): void {
$this->assertException("missing", "Db", "ExceptionInput");
Arsse::$db->tagAdd("john.doe@example.com", ['name' => ""]);
}
#[CoversMethod(Database::class, "tagAdd")]
#[CoversMethod(Database::class, "tagValidateName")]
//#[CoversMethod(Database::class, "tagAdd")]
//#[CoversMethod(Database::class, "tagValidateName")]
public function testAddATagWithAWhitespaceName(): void {
$this->assertException("whitespace", "Db", "ExceptionInput");
Arsse::$db->tagAdd("john.doe@example.com", ['name' => " "]);
}
#[CoversMethod(Database::class, "tagList")]
//#[CoversMethod(Database::class, "tagList")]
public function testListTags(): void {
$exp = [
['id' => 2, 'name' => "Fascinating"],
@ -170,8 +170,8 @@ trait SeriesTag {
$this->assertResult($exp, Arsse::$db->tagList("jane.doe@example.com", false));
}
#[CoversMethod(Database::class, "tagRemove")]
#[CoversMethod(Database::class, "tagValidateId")]
//#[CoversMethod(Database::class, "tagRemove")]
//#[CoversMethod(Database::class, "tagValidateId")]
public function testRemoveATag(): void {
$this->assertTrue(Arsse::$db->tagRemove("john.doe@example.com", 1));
$state = $this->primeExpectations($this->data, $this->checkTags);
@ -179,8 +179,8 @@ trait SeriesTag {
$this->compareExpectations(static::$drv, $state);
}
#[CoversMethod(Database::class, "tagRemove")]
#[CoversMethod(Database::class, "tagValidateId")]
//#[CoversMethod(Database::class, "tagRemove")]
//#[CoversMethod(Database::class, "tagValidateId")]
public function testRemoveATagByName(): void {
$this->assertTrue(Arsse::$db->tagRemove("john.doe@example.com", "Interesting", true));
$state = $this->primeExpectations($this->data, $this->checkTags);
@ -188,36 +188,36 @@ trait SeriesTag {
$this->compareExpectations(static::$drv, $state);
}
#[CoversMethod(Database::class, "tagRemove")]
#[CoversMethod(Database::class, "tagValidateId")]
//#[CoversMethod(Database::class, "tagRemove")]
//#[CoversMethod(Database::class, "tagValidateId")]
public function testRemoveAMissingTag(): void {
$this->assertException("subjectMissing", "Db", "ExceptionInput");
Arsse::$db->tagRemove("john.doe@example.com", 2112);
}
#[CoversMethod(Database::class, "tagRemove")]
#[CoversMethod(Database::class, "tagValidateId")]
//#[CoversMethod(Database::class, "tagRemove")]
//#[CoversMethod(Database::class, "tagValidateId")]
public function testRemoveAnInvalidTag(): void {
$this->assertException("typeViolation", "Db", "ExceptionInput");
Arsse::$db->tagRemove("john.doe@example.com", -1);
}
#[CoversMethod(Database::class, "tagRemove")]
#[CoversMethod(Database::class, "tagValidateId")]
//#[CoversMethod(Database::class, "tagRemove")]
//#[CoversMethod(Database::class, "tagValidateId")]
public function testRemoveAnInvalidTagByName(): void {
$this->assertException("typeViolation", "Db", "ExceptionInput");
Arsse::$db->tagRemove("john.doe@example.com", [], true);
}
#[CoversMethod(Database::class, "tagRemove")]
#[CoversMethod(Database::class, "tagValidateId")]
//#[CoversMethod(Database::class, "tagRemove")]
//#[CoversMethod(Database::class, "tagValidateId")]
public function testRemoveATagOfTheWrongOwner(): void {
$this->assertException("subjectMissing", "Db", "ExceptionInput");
Arsse::$db->tagRemove("john.doe@example.com", 3); // tag ID 3 belongs to Jane
}
#[CoversMethod(Database::class, "tagPropertiesGet")]
#[CoversMethod(Database::class, "tagValidateId")]
//#[CoversMethod(Database::class, "tagPropertiesGet")]
//#[CoversMethod(Database::class, "tagValidateId")]
public function testGetThePropertiesOfATag(): void {
$exp = [
'id' => 2,
@ -227,44 +227,44 @@ trait SeriesTag {
$this->assertArraySubset($exp, Arsse::$db->tagPropertiesGet("john.doe@example.com", "Fascinating", true));
}
#[CoversMethod(Database::class, "tagPropertiesGet")]
#[CoversMethod(Database::class, "tagValidateId")]
//#[CoversMethod(Database::class, "tagPropertiesGet")]
//#[CoversMethod(Database::class, "tagValidateId")]
public function testGetThePropertiesOfAMissingTag(): void {
$this->assertException("subjectMissing", "Db", "ExceptionInput");
Arsse::$db->tagPropertiesGet("john.doe@example.com", 2112);
}
#[CoversMethod(Database::class, "tagPropertiesGet")]
#[CoversMethod(Database::class, "tagValidateId")]
//#[CoversMethod(Database::class, "tagPropertiesGet")]
//#[CoversMethod(Database::class, "tagValidateId")]
public function testGetThePropertiesOfAnInvalidTag(): void {
$this->assertException("typeViolation", "Db", "ExceptionInput");
Arsse::$db->tagPropertiesGet("john.doe@example.com", -1);
}
#[CoversMethod(Database::class, "tagPropertiesGet")]
#[CoversMethod(Database::class, "tagValidateId")]
//#[CoversMethod(Database::class, "tagPropertiesGet")]
//#[CoversMethod(Database::class, "tagValidateId")]
public function testGetThePropertiesOfAnInvalidTagByName(): void {
$this->assertException("typeViolation", "Db", "ExceptionInput");
Arsse::$db->tagPropertiesGet("john.doe@example.com", [], true);
}
#[CoversMethod(Database::class, "tagPropertiesGet")]
#[CoversMethod(Database::class, "tagValidateId")]
//#[CoversMethod(Database::class, "tagPropertiesGet")]
//#[CoversMethod(Database::class, "tagValidateId")]
public function testGetThePropertiesOfATagOfTheWrongOwner(): void {
$this->assertException("subjectMissing", "Db", "ExceptionInput");
Arsse::$db->tagPropertiesGet("john.doe@example.com", 3); // tag ID 3 belongs to Jane
}
#[CoversMethod(Database::class, "tagPropertiesSet")]
#[CoversMethod(Database::class, "tagValidateId")]
#[CoversMethod(Database::class, "tagValidateName")]
//#[CoversMethod(Database::class, "tagPropertiesSet")]
//#[CoversMethod(Database::class, "tagValidateId")]
//#[CoversMethod(Database::class, "tagValidateName")]
public function testMakeNoChangesToATag(): void {
$this->assertFalse(Arsse::$db->tagPropertiesSet("john.doe@example.com", 1, []));
}
#[CoversMethod(Database::class, "tagPropertiesSet")]
#[CoversMethod(Database::class, "tagValidateId")]
#[CoversMethod(Database::class, "tagValidateName")]
//#[CoversMethod(Database::class, "tagPropertiesSet")]
//#[CoversMethod(Database::class, "tagValidateId")]
//#[CoversMethod(Database::class, "tagValidateName")]
public function testRenameATag(): void {
$this->assertTrue(Arsse::$db->tagPropertiesSet("john.doe@example.com", 1, ['name' => "Curious"]));
$state = $this->primeExpectations($this->data, $this->checkTags);
@ -272,9 +272,9 @@ trait SeriesTag {
$this->compareExpectations(static::$drv, $state);
}
#[CoversMethod(Database::class, "tagPropertiesSet")]
#[CoversMethod(Database::class, "tagValidateId")]
#[CoversMethod(Database::class, "tagValidateName")]
//#[CoversMethod(Database::class, "tagPropertiesSet")]
//#[CoversMethod(Database::class, "tagValidateId")]
//#[CoversMethod(Database::class, "tagValidateName")]
public function testRenameATagByName(): void {
$this->assertTrue(Arsse::$db->tagPropertiesSet("john.doe@example.com", "Interesting", ['name' => "Curious"], true));
$state = $this->primeExpectations($this->data, $this->checkTags);
@ -282,72 +282,72 @@ trait SeriesTag {
$this->compareExpectations(static::$drv, $state);
}
#[CoversMethod(Database::class, "tagPropertiesSet")]
#[CoversMethod(Database::class, "tagValidateId")]
#[CoversMethod(Database::class, "tagValidateName")]
//#[CoversMethod(Database::class, "tagPropertiesSet")]
//#[CoversMethod(Database::class, "tagValidateId")]
//#[CoversMethod(Database::class, "tagValidateName")]
public function testRenameATagToTheEmptyString(): void {
$this->assertException("missing", "Db", "ExceptionInput");
$this->assertTrue(Arsse::$db->tagPropertiesSet("john.doe@example.com", 1, ['name' => ""]));
}
#[CoversMethod(Database::class, "tagPropertiesSet")]
#[CoversMethod(Database::class, "tagValidateId")]
#[CoversMethod(Database::class, "tagValidateName")]
//#[CoversMethod(Database::class, "tagPropertiesSet")]
//#[CoversMethod(Database::class, "tagValidateId")]
//#[CoversMethod(Database::class, "tagValidateName")]
public function testRenameATagToWhitespaceOnly(): void {
$this->assertException("whitespace", "Db", "ExceptionInput");
$this->assertTrue(Arsse::$db->tagPropertiesSet("john.doe@example.com", 1, ['name' => " "]));
}
#[CoversMethod(Database::class, "tagPropertiesSet")]
#[CoversMethod(Database::class, "tagValidateId")]
#[CoversMethod(Database::class, "tagValidateName")]
//#[CoversMethod(Database::class, "tagPropertiesSet")]
//#[CoversMethod(Database::class, "tagValidateId")]
//#[CoversMethod(Database::class, "tagValidateName")]
public function testRenameATagToAnInvalidValue(): void {
$this->assertException("typeViolation", "Db", "ExceptionInput");
$this->assertTrue(Arsse::$db->tagPropertiesSet("john.doe@example.com", 1, ['name' => []]));
}
#[CoversMethod(Database::class, "tagPropertiesSet")]
#[CoversMethod(Database::class, "tagValidateId")]
#[CoversMethod(Database::class, "tagValidateName")]
//#[CoversMethod(Database::class, "tagPropertiesSet")]
//#[CoversMethod(Database::class, "tagValidateId")]
//#[CoversMethod(Database::class, "tagValidateName")]
public function testCauseATagCollision(): void {
$this->assertException("constraintViolation", "Db", "ExceptionInput");
Arsse::$db->tagPropertiesSet("john.doe@example.com", 1, ['name' => "Fascinating"]);
}
#[CoversMethod(Database::class, "tagPropertiesSet")]
#[CoversMethod(Database::class, "tagValidateId")]
#[CoversMethod(Database::class, "tagValidateName")]
//#[CoversMethod(Database::class, "tagPropertiesSet")]
//#[CoversMethod(Database::class, "tagValidateId")]
//#[CoversMethod(Database::class, "tagValidateName")]
public function testSetThePropertiesOfAMissingTag(): void {
$this->assertException("subjectMissing", "Db", "ExceptionInput");
Arsse::$db->tagPropertiesSet("john.doe@example.com", 2112, ['name' => "Exciting"]);
}
#[CoversMethod(Database::class, "tagPropertiesSet")]
#[CoversMethod(Database::class, "tagValidateId")]
#[CoversMethod(Database::class, "tagValidateName")]
//#[CoversMethod(Database::class, "tagPropertiesSet")]
//#[CoversMethod(Database::class, "tagValidateId")]
//#[CoversMethod(Database::class, "tagValidateName")]
public function testSetThePropertiesOfAnInvalidTag(): void {
$this->assertException("typeViolation", "Db", "ExceptionInput");
Arsse::$db->tagPropertiesSet("john.doe@example.com", -1, ['name' => "Exciting"]);
}
#[CoversMethod(Database::class, "tagPropertiesSet")]
#[CoversMethod(Database::class, "tagValidateId")]
#[CoversMethod(Database::class, "tagValidateName")]
//#[CoversMethod(Database::class, "tagPropertiesSet")]
//#[CoversMethod(Database::class, "tagValidateId")]
//#[CoversMethod(Database::class, "tagValidateName")]
public function testSetThePropertiesOfAnInvalidTagByName(): void {
$this->assertException("typeViolation", "Db", "ExceptionInput");
Arsse::$db->tagPropertiesSet("john.doe@example.com", [], ['name' => "Exciting"], true);
}
#[CoversMethod(Database::class, "tagPropertiesSet")]
#[CoversMethod(Database::class, "tagValidateId")]
#[CoversMethod(Database::class, "tagValidateName")]
//#[CoversMethod(Database::class, "tagPropertiesSet")]
//#[CoversMethod(Database::class, "tagValidateId")]
//#[CoversMethod(Database::class, "tagValidateName")]
public function testSetThePropertiesOfATagForTheWrongOwner(): void {
$this->assertException("subjectMissing", "Db", "ExceptionInput");
Arsse::$db->tagPropertiesSet("john.doe@example.com", 3, ['name' => "Exciting"]); // tag ID 3 belongs to Jane
}
#[CoversMethod(Database::class, "tagSubscriptionsGet")]
#[CoversMethod(Database::class, "tagValidateId")]
//#[CoversMethod(Database::class, "tagSubscriptionsGet")]
//#[CoversMethod(Database::class, "tagValidateId")]
public function testListTaggedSubscriptions(): void {
$exp = [1,5];
$this->assertEquals($exp, Arsse::$db->tagSubscriptionsGet("john.doe@example.com", 1));
@ -360,22 +360,22 @@ trait SeriesTag {
$this->assertEquals($exp, Arsse::$db->tagSubscriptionsGet("john.doe@example.com", "Lonely", true));
}
#[CoversMethod(Database::class, "tagSubscriptionsGet")]
#[CoversMethod(Database::class, "tagValidateId")]
//#[CoversMethod(Database::class, "tagSubscriptionsGet")]
//#[CoversMethod(Database::class, "tagValidateId")]
public function testListTaggedSubscriptionsForAMissingTag(): void {
$this->assertException("subjectMissing", "Db", "ExceptionInput");
Arsse::$db->tagSubscriptionsGet("john.doe@example.com", 3);
}
#[CoversMethod(Database::class, "tagSubscriptionsGet")]
#[CoversMethod(Database::class, "tagValidateId")]
//#[CoversMethod(Database::class, "tagSubscriptionsGet")]
//#[CoversMethod(Database::class, "tagValidateId")]
public function testListTaggedSubscriptionsForAnInvalidTag(): void {
$this->assertException("typeViolation", "Db", "ExceptionInput");
Arsse::$db->tagSubscriptionsGet("john.doe@example.com", -1);
}
#[CoversMethod(Database::class, "tagSubscriptionsSet")]
#[CoversMethod(Database::class, "tagValidateId")]
//#[CoversMethod(Database::class, "tagSubscriptionsSet")]
//#[CoversMethod(Database::class, "tagValidateId")]
public function testApplyATagToSubscriptions(): void {
Arsse::$db->tagSubscriptionsSet("john.doe@example.com", 1, [3,4]);
$state = $this->primeExpectations($this->data, $this->checkMembers);
@ -384,8 +384,8 @@ trait SeriesTag {
$this->compareExpectations(static::$drv, $state);
}
#[CoversMethod(Database::class, "tagSubscriptionsSet")]
#[CoversMethod(Database::class, "tagValidateId")]
//#[CoversMethod(Database::class, "tagSubscriptionsSet")]
//#[CoversMethod(Database::class, "tagValidateId")]
public function testClearATagFromSubscriptions(): void {
Arsse::$db->tagSubscriptionsSet("john.doe@example.com", 1, [1,3], Database::ASSOC_REMOVE);
$state = $this->primeExpectations($this->data, $this->checkMembers);
@ -393,8 +393,8 @@ trait SeriesTag {
$this->compareExpectations(static::$drv, $state);
}
#[CoversMethod(Database::class, "tagSubscriptionsSet")]
#[CoversMethod(Database::class, "tagValidateId")]
//#[CoversMethod(Database::class, "tagSubscriptionsSet")]
//#[CoversMethod(Database::class, "tagValidateId")]
public function testApplyATagToSubscriptionsByName(): void {
Arsse::$db->tagSubscriptionsSet("john.doe@example.com", "Interesting", [3,4], Database::ASSOC_ADD, true);
$state = $this->primeExpectations($this->data, $this->checkMembers);
@ -403,8 +403,8 @@ trait SeriesTag {
$this->compareExpectations(static::$drv, $state);
}
#[CoversMethod(Database::class, "tagSubscriptionsSet")]
#[CoversMethod(Database::class, "tagValidateId")]
//#[CoversMethod(Database::class, "tagSubscriptionsSet")]
//#[CoversMethod(Database::class, "tagValidateId")]
public function testClearATagFromSubscriptionsByName(): void {
Arsse::$db->tagSubscriptionsSet("john.doe@example.com", "Interesting", [1,3], Database::ASSOC_REMOVE, true);
$state = $this->primeExpectations($this->data, $this->checkMembers);
@ -412,24 +412,24 @@ trait SeriesTag {
$this->compareExpectations(static::$drv, $state);
}
#[CoversMethod(Database::class, "tagSubscriptionsSet")]
#[CoversMethod(Database::class, "tagValidateId")]
//#[CoversMethod(Database::class, "tagSubscriptionsSet")]
//#[CoversMethod(Database::class, "tagValidateId")]
public function testApplyATagToNoSubscriptionsByName(): void {
Arsse::$db->tagSubscriptionsSet("john.doe@example.com", "Interesting", [], Database::ASSOC_ADD, true);
$state = $this->primeExpectations($this->data, $this->checkMembers);
$this->compareExpectations(static::$drv, $state);
}
#[CoversMethod(Database::class, "tagSubscriptionsSet")]
#[CoversMethod(Database::class, "tagValidateId")]
//#[CoversMethod(Database::class, "tagSubscriptionsSet")]
//#[CoversMethod(Database::class, "tagValidateId")]
public function testClearATagFromNoSubscriptionsByName(): void {
Arsse::$db->tagSubscriptionsSet("john.doe@example.com", "Interesting", [], Database::ASSOC_REMOVE, true);
$state = $this->primeExpectations($this->data, $this->checkMembers);
$this->compareExpectations(static::$drv, $state);
}
#[CoversMethod(Database::class, "tagSubscriptionsSet")]
#[CoversMethod(Database::class, "tagValidateId")]
//#[CoversMethod(Database::class, "tagSubscriptionsSet")]
//#[CoversMethod(Database::class, "tagValidateId")]
public function testReplaceSubscriptionsOfATag(): void {
Arsse::$db->tagSubscriptionsSet("john.doe@example.com", 1, [3,4], Database::ASSOC_REPLACE);
$state = $this->primeExpectations($this->data, $this->checkMembers);
@ -440,8 +440,8 @@ trait SeriesTag {
$this->compareExpectations(static::$drv, $state);
}
#[CoversMethod(Database::class, "tagSubscriptionsSet")]
#[CoversMethod(Database::class, "tagValidateId")]
//#[CoversMethod(Database::class, "tagSubscriptionsSet")]
//#[CoversMethod(Database::class, "tagValidateId")]
public function testPurgeSubscriptionsOfATag(): void {
Arsse::$db->tagSubscriptionsSet("john.doe@example.com", 1, [], Database::ASSOC_REPLACE);
$state = $this->primeExpectations($this->data, $this->checkMembers);
@ -450,7 +450,7 @@ trait SeriesTag {
$this->compareExpectations(static::$drv, $state);
}
#[CoversMethod(Database::class, "tagSummarize")]
//#[CoversMethod(Database::class, "tagSummarize")]
public function testSummarizeTags(): void {
$exp = [
['id' => 1, 'name' => "Interesting", 'subscription' => 1],

View file

@ -56,7 +56,7 @@ trait SeriesToken {
unset($this->data);
}
#[CoversMethod(Database::class, "tokenLookup")]
//#[CoversMethod(Database::class, "tokenLookup")]
public function testLookUpAValidToken(): void {
$exp1 = [
'id' => "80fa94c1a11f11e78667001e673b2560",
@ -78,25 +78,25 @@ trait SeriesToken {
$this->assertArraySubset($exp3, Arsse::$db->tokenLookup("class.class", "ab3b3eb8a13311e78667001e673b2560"));
}
#[CoversMethod(Database::class, "tokenLookup")]
//#[CoversMethod(Database::class, "tokenLookup")]
public function testLookUpAMissingToken(): void {
$this->assertException("subjectMissing", "Db", "ExceptionInput");
Arsse::$db->tokenLookup("class", "thisTokenDoesNotExist");
}
#[CoversMethod(Database::class, "tokenLookup")]
//#[CoversMethod(Database::class, "tokenLookup")]
public function testLookUpAnExpiredToken(): void {
$this->assertException("subjectMissing", "Db", "ExceptionInput");
Arsse::$db->tokenLookup("fever.login", "27c6de8da13311e78667001e673b2560");
}
#[CoversMethod(Database::class, "tokenLookup")]
//#[CoversMethod(Database::class, "tokenLookup")]
public function testLookUpATokenOfTheWrongClass(): void {
$this->assertException("subjectMissing", "Db", "ExceptionInput");
Arsse::$db->tokenLookup("some.class", "80fa94c1a11f11e78667001e673b2560");
}
#[CoversMethod(Database::class, "tokenCreate")]
//#[CoversMethod(Database::class, "tokenCreate")]
public function testCreateAToken(): void {
$user = "jane.doe@example.com";
$state = $this->primeExpectations($this->data, ['arsse_tokens' => ["id", "class", "expires", "user"]]);
@ -111,13 +111,13 @@ trait SeriesToken {
$this->compareExpectations(static::$drv, $state);
}
#[CoversMethod(Database::class, "tokenCreate")]
//#[CoversMethod(Database::class, "tokenCreate")]
public function testCreateATokenForAMissingUser(): void {
$this->assertException("doesNotExist", "User", "ExceptionConflict");
Arsse::$db->tokenCreate("fever.login", "jane.doe@example.biz");
}
#[CoversMethod(Database::class, "tokenRevoke")]
//#[CoversMethod(Database::class, "tokenRevoke")]
public function testRevokeAToken(): void {
$user = "jane.doe@example.com";
$id = "80fa94c1a11f11e78667001e673b2560";
@ -129,7 +129,7 @@ trait SeriesToken {
$this->assertFalse(Arsse::$db->tokenRevoke($user, "fever.login", $id));
}
#[CoversMethod(Database::class, "tokenRevoke")]
//#[CoversMethod(Database::class, "tokenRevoke")]
public function testRevokeAllTokens(): void {
$user = "jane.doe@example.com";
$state = $this->primeExpectations($this->data, ['arsse_tokens' => ["id", "expires", "user"]]);
@ -144,7 +144,7 @@ trait SeriesToken {
$this->assertFalse(Arsse::$db->tokenRevoke($user, "unknown.class"));
}
#[CoversMethod(Database::class, "tokenList")]
//#[CoversMethod(Database::class, "tokenList")]
public function testListTokens(): void {
$user = "jane.doe@example.com";
$exp = [

View file

@ -52,27 +52,27 @@ trait SeriesUser {
unset($this->data);
}
#[CoversMethod(Database::class, "userExists")]
//#[CoversMethod(Database::class, "userExists")]
public function testCheckThatAUserExists(): void {
$this->assertTrue(Arsse::$db->userExists("jane.doe@example.com"));
$this->assertFalse(Arsse::$db->userExists("jane.doe@example.org"));
$this->compareExpectations(static::$drv, $this->data);
}
#[CoversMethod(Database::class, "userPasswordGet")]
//#[CoversMethod(Database::class, "userPasswordGet")]
public function testGetAPassword(): void {
$hash = Arsse::$db->userPasswordGet("admin@example.net");
$this->assertSame('$2y$10$PbcG2ZR3Z8TuPzM7aHTF8.v61dtCjzjK78gdZJcp4UePE8T9jEgBW', $hash);
$this->assertTrue(password_verify("secret", $hash));
}
#[CoversMethod(Database::class, "userPasswordGet")]
//#[CoversMethod(Database::class, "userPasswordGet")]
public function testGetThePasswordOfAMissingUser(): void {
$this->assertException("doesNotExist", "User", "ExceptionConflict");
Arsse::$db->userPasswordGet("john.doe@example.org");
}
#[CoversMethod(Database::class, "userAdd")]
//#[CoversMethod(Database::class, "userAdd")]
public function testAddANewUser(): void {
$this->assertTrue(Arsse::$db->userAdd("john.doe@example.org", ""));
$state = $this->primeExpectations($this->data, ['arsse_users' => ['id']]);
@ -80,13 +80,13 @@ trait SeriesUser {
$this->compareExpectations(static::$drv, $state);
}
#[CoversMethod(Database::class, "userAdd")]
//#[CoversMethod(Database::class, "userAdd")]
public function testAddAnExistingUser(): void {
$this->assertException("alreadyExists", "User", "ExceptionConflict");
Arsse::$db->userAdd("john.doe@example.com", "");
}
#[CoversMethod(Database::class, "userRemove")]
//#[CoversMethod(Database::class, "userRemove")]
public function testRemoveAUser(): void {
$this->assertTrue(Arsse::$db->userRemove("admin@example.net"));
$state = $this->primeExpectations($this->data, ['arsse_users' => ['id']]);
@ -94,19 +94,19 @@ trait SeriesUser {
$this->compareExpectations(static::$drv, $state);
}
#[CoversMethod(Database::class, "userRemove")]
//#[CoversMethod(Database::class, "userRemove")]
public function testRemoveAMissingUser(): void {
$this->assertException("doesNotExist", "User", "ExceptionConflict");
Arsse::$db->userRemove("john.doe@example.org");
}
#[CoversMethod(Database::class, "userList")]
//#[CoversMethod(Database::class, "userList")]
public function testListAllUsers(): void {
$users = ["admin@example.net", "jane.doe@example.com", "john.doe@example.com"];
$this->assertSame($users, Arsse::$db->userList());
}
#[CoversMethod(Database::class, "userPasswordSet")]
//#[CoversMethod(Database::class, "userPasswordSet")]
public function testSetAPassword(): void {
$user = "john.doe@example.com";
$pass = "secret";
@ -117,7 +117,7 @@ trait SeriesUser {
$this->assertTrue(password_verify($pass, $hash), "Failed verifying password of $user '$pass' against hash '$hash'.");
}
#[CoversMethod(Database::class, "userPasswordSet")]
//#[CoversMethod(Database::class, "userPasswordSet")]
public function testUnsetAPassword(): void {
$user = "john.doe@example.com";
$this->assertEquals("", Arsse::$db->userPasswordGet($user));
@ -125,14 +125,14 @@ trait SeriesUser {
$this->assertNull(Arsse::$db->userPasswordGet($user));
}
#[CoversMethod(Database::class, "userPasswordSet")]
//#[CoversMethod(Database::class, "userPasswordSet")]
public function testSetThePasswordOfAMissingUser(): void {
$this->assertException("doesNotExist", "User", "ExceptionConflict");
Arsse::$db->userPasswordSet("john.doe@example.org", "secret");
}
#[DataProvider("provideMetaData")]
#[CoversMethod(Database::class, "userPropertiesGet")]
//#[CoversMethod(Database::class, "userPropertiesGet")]
public function testGetMetadata(string $user, bool $includeLarge, array $exp): void {
$this->assertSame($exp, Arsse::$db->userPropertiesGet($user, $includeLarge));
}
@ -148,13 +148,13 @@ trait SeriesUser {
];
}
#[CoversMethod(Database::class, "userPropertiesGet")]
//#[CoversMethod(Database::class, "userPropertiesGet")]
public function testGetTheMetadataOfAMissingUser(): void {
$this->assertException("doesNotExist", "User", "ExceptionConflict");
Arsse::$db->userPropertiesGet("john.doe@example.org");
}
#[CoversMethod(Database::class, "userPropertiesSet")]
//#[CoversMethod(Database::class, "userPropertiesSet")]
public function testSetMetadata(): void {
$in = [
'admin' => true,
@ -171,7 +171,7 @@ trait SeriesUser {
$this->compareExpectations(static::$drv, $state);
}
#[CoversMethod(Database::class, "userPropertiesSet")]
//#[CoversMethod(Database::class, "userPropertiesSet")]
public function testSetNoMetadata(): void {
$in = [
'num' => 2112,
@ -182,26 +182,26 @@ trait SeriesUser {
$this->compareExpectations(static::$drv, $state);
}
#[CoversMethod(Database::class, "userPropertiesSet")]
//#[CoversMethod(Database::class, "userPropertiesSet")]
public function testSetTheMetadataOfAMissingUser(): void {
$this->assertException("doesNotExist", "User", "ExceptionConflict");
Arsse::$db->userPropertiesSet("john.doe@example.org", ['admin' => true]);
}
#[CoversMethod(Database::class, "userLookup")]
//#[CoversMethod(Database::class, "userLookup")]
public function testLookUpAUserByNumber(): void {
$this->assertSame("admin@example.net", Arsse::$db->userLookup(1));
$this->assertSame("jane.doe@example.com", Arsse::$db->userLookup(2));
$this->assertSame("john.doe@example.com", Arsse::$db->userLookup(3));
}
#[CoversMethod(Database::class, "userLookup")]
//#[CoversMethod(Database::class, "userLookup")]
public function testLookUpAMissingUserByNumber(): void {
$this->assertException("doesNotExist", "User", "ExceptionConflict");
Arsse::$db->userLookup(2112);
}
#[CoversMethod(Database::class, "userRename")]
//#[CoversMethod(Database::class, "userRename")]
public function testRenameAUser(): void {
$this->assertTrue(Arsse::$db->userRename("john.doe@example.com", "juan.doe@example.com"));
$state = $this->primeExpectations($this->data, [
@ -213,24 +213,24 @@ trait SeriesUser {
$this->compareExpectations(static::$drv, $state);
}
#[CoversMethod(Database::class, "userRename")]
//#[CoversMethod(Database::class, "userRename")]
public function testRenameAUserToTheSameName(): void {
$this->assertFalse(Arsse::$db->userRename("john.doe@example.com", "john.doe@example.com"));
}
#[CoversMethod(Database::class, "userRename")]
//#[CoversMethod(Database::class, "userRename")]
public function testRenameAMissingUser(): void {
$this->assertException("doesNotExist", "User", "ExceptionConflict");
Arsse::$db->userRename("juan.doe@example.com", "john.doe@example.com");
}
#[CoversMethod(Database::class, "userRename")]
//#[CoversMethod(Database::class, "userRename")]
public function testRenameAUserToADuplicateName(): void {
$this->assertException("alreadyExists", "User", "ExceptionConflict");
Arsse::$db->userRename("john.doe@example.com", "jane.doe@example.com");
}
#[CoversMethod(Database::class, "userAdd")]
//#[CoversMethod(Database::class, "userAdd")]
public function testAddFirstUser(): void {
// first truncate the users table
static::$drv->exec("DELETE FROM arsse_users");

View file

@ -10,11 +10,11 @@ namespace JKingWeb\Arsse\TestCase\Database;
use JKingWeb\Arsse\Database;
use JKingWeb\Arsse\Db\Transaction;
use PHPUnit\Framework\Attributes\CoversNothing;
use PHPUnit\Framework\Attributes\CoversClass;
use PHPUnit\Framework\Attributes\DataProvider;
use PHPUnit\Framework\Attributes\CoversMethod;
#[CoversNothing]
#[CoversClass(Database::class)]
class TestDatabase extends \JKingWeb\Arsse\Test\AbstractTest {
protected $db = null;
@ -39,7 +39,7 @@ class TestDatabase extends \JKingWeb\Arsse\Test\AbstractTest {
return $m->invoke($this->db, ...$arg);
}
#[CoversMethod(Database::class, "generateIn")]
//#[CoversMethod(Database::class, "generateIn")]
#[DataProvider('provideInClauses')]
public function testGenerateInClause(string $clause, array $values, array $inV, string $inT): void {
$types = array_fill(0, sizeof($values), $inT);
@ -74,7 +74,7 @@ class TestDatabase extends \JKingWeb\Arsse\Test\AbstractTest {
];
}
#[CoversMethod(Database::class, "generateSearch")]
//#[CoversMethod(Database::class, "generateSearch")]
#[DataProvider('provideSearchClauses')]
public function testGenerateSearchClause(string $clause, array $values, array $inV, array $inC, bool $inAny): void {
// this is not an exhaustive test; integration tests already cover the ins and outs of the functionality
@ -99,7 +99,7 @@ class TestDatabase extends \JKingWeb\Arsse\Test\AbstractTest {
];
}
#[CoversMethod(Database::class, "generateSet")]
//#[CoversMethod(Database::class, "generateSet")]
public function testGenerateSetClause(): void {
$in = [
'ook' => true,
@ -121,12 +121,12 @@ class TestDatabase extends \JKingWeb\Arsse\Test\AbstractTest {
$this->assertSame($exp, $this->invoke("generateSet", $in, $valid));
}
#[CoversMethod(Database::class, "begin")]
//#[CoversMethod(Database::class, "begin")]
public function testBeginATransaction(): void {
$this->assertInstanceOf(Transaction::class, $this->invoke("begin"));
}
#[CoversMethod(Database::class, "caller")]
//#[CoversMethod(Database::class, "caller")]
public function testReportCallingMethod(): void {
$this->assertSame("caller", $this->invoke("caller"));
}

View file

@ -8,11 +8,12 @@ declare(strict_types=1);
namespace JKingWeb\Arsse\TestCase\Db\MySQL;
use JKingWeb\Arsse\Db\MySQL\Driver as Driver;
use PHPUnit\Framework\Attributes\CoversClass;
use PHPUnit\Framework\Attributes\Group;
/**
* @group slow
* @covers \JKingWeb\Arsse\Db\MySQL\Driver<extended>
* @covers \JKingWeb\Arsse\Db\MySQL\ExceptionBuilder */
#[Group("slow")]
#[CoversClass(\JKingWeb\Arsse\Db\MySQL\Driver::class)]
#[CoversClass(\JKingWeb\Arsse\Db\MySQL\ExceptionBuilder::class)]
class TestCreation extends \JKingWeb\Arsse\Test\AbstractTest {
public function setUp(): void {
if (!Driver::requirementsMet()) {

View file

@ -8,12 +8,13 @@ declare(strict_types=1);
namespace JKingWeb\Arsse\TestCase\Db\MySQL;
use JKingWeb\Arsse\Database;
use PHPUnit\Framework\Attributes\CoversClass;
use PHPUnit\Framework\Attributes\Group;
use PHPUnit\Framework\Attributes\CoversNothing;
#[Group('slow')]
#[Group('coverageOptional')]
#[CoversNothing]
#[CoversClass(Database::class)]
class TestDatabase extends \JKingWeb\Arsse\TestCase\Database\AbstractTest {
use \JKingWeb\Arsse\Test\DatabaseDrivers\MySQL;

View file

@ -7,11 +7,13 @@ declare(strict_types=1);
namespace JKingWeb\Arsse\TestCase\Db\MySQL;
/**
* @group slow
* @covers \JKingWeb\Arsse\Db\MySQL\Driver<extended>
* @covers \JKingWeb\Arsse\Db\MySQL\ExceptionBuilder
* @covers \JKingWeb\Arsse\Db\SQLState */
use PHPUnit\Framework\Attributes\CoversClass;
use PHPUnit\Framework\Attributes\Group;
#[Group("slow")]
#[CoversClass(\JKingWeb\Arsse\Db\MySQL\Driver::class)]
#[CoversClass(\JKingWeb\Arsse\Db\MySQL\ExceptionBuilder::class)]
#[CoversClass(\JKingWeb\Arsse\Db\SQLState::class)]
class TestDriver extends \JKingWeb\Arsse\TestCase\Db\BaseDriver {
use \JKingWeb\Arsse\Test\DatabaseDrivers\MySQL;

View file

@ -7,11 +7,13 @@ declare(strict_types=1);
namespace JKingWeb\Arsse\TestCase\Db\MySQL;
/**
* @group slow
* @covers \JKingWeb\Arsse\Db\MySQL\Result<extended>
* @covers \JKingWeb\Arsse\Db\MySQL\ExceptionBuilder
* @covers \JKingWeb\Arsse\Db\SQLState */
use PHPUnit\Framework\Attributes\CoversClass;
use PHPUnit\Framework\Attributes\Group;
#[Group("slow")]
#[CoversClass(\JKingWeb\Arsse\Db\MySQL\Result::class)]
#[CoversClass(\JKingWeb\Arsse\Db\MySQL\ExceptionBuilder::class)]
#[CoversClass(\JKingWeb\Arsse\Db\SQLState::class)]
class TestResult extends \JKingWeb\Arsse\TestCase\Db\BaseResult {
use \JKingWeb\Arsse\Test\DatabaseDrivers\MySQL;

View file

@ -7,11 +7,13 @@ declare(strict_types=1);
namespace JKingWeb\Arsse\TestCase\Db\MySQL;
/**
* @group slow
* @covers \JKingWeb\Arsse\Db\MySQL\Statement<extended>
* @covers \JKingWeb\Arsse\Db\MySQL\ExceptionBuilder
* @covers \JKingWeb\Arsse\Db\SQLState */
use PHPUnit\Framework\Attributes\CoversClass;
use PHPUnit\Framework\Attributes\Group;
#[Group("slow")]
#[CoversClass(\JKingWeb\Arsse\Db\MySQL\Statement::class)]
#[CoversClass(\JKingWeb\Arsse\Db\MySQL\ExceptionBuilder::class)]
#[CoversClass(\JKingWeb\Arsse\Db\SQLState::class)]
class TestStatement extends \JKingWeb\Arsse\TestCase\Db\BaseStatement {
use \JKingWeb\Arsse\Test\DatabaseDrivers\MySQL;

View file

@ -7,11 +7,13 @@ declare(strict_types=1);
namespace JKingWeb\Arsse\TestCase\Db\MySQL;
/**
* @group slow
* @covers \JKingWeb\Arsse\Db\MySQL\Driver<extended>
* @covers \JKingWeb\Arsse\Db\MySQL\ExceptionBuilder
* @covers \JKingWeb\Arsse\Db\SQLState */
use PHPUnit\Framework\Attributes\CoversClass;
use PHPUnit\Framework\Attributes\Group;
#[Group("slow")]
#[CoversClass(\JKingWeb\Arsse\Db\MySQL\Driver::class)]
#[CoversClass(\JKingWeb\Arsse\Db\MySQL\ExceptionBuilder::class)]
#[CoversClass(\JKingWeb\Arsse\Db\SQLState::class)]
class TestUpdate extends \JKingWeb\Arsse\TestCase\Db\BaseUpdate {
use \JKingWeb\Arsse\Test\DatabaseDrivers\MySQL;

View file

@ -8,11 +8,12 @@ declare(strict_types=1);
namespace JKingWeb\Arsse\TestCase\Db\MySQLPDO;
use JKingWeb\Arsse\Db\MySQL\PDODriver as Driver;
use PHPUnit\Framework\Attributes\CoversClass;
use PHPUnit\Framework\Attributes\Group;
/**
* @group slow
* @covers \JKingWeb\Arsse\Db\MySQL\PDODriver<extended>
* @covers \JKingWeb\Arsse\Db\MySQL\ExceptionBuilder */
#[Group("slow")]
#[CoversClass(\JKingWeb\Arsse\Db\MySQL\PDODriver::class)]
#[CoversClass(\JKingWeb\Arsse\Db\MySQL\ExceptionBuilder::class)]
class TestCreation extends \JKingWeb\Arsse\Test\AbstractTest {
public function setUp(): void {
if (!Driver::requirementsMet()) {

View file

@ -8,13 +8,14 @@ declare(strict_types=1);
namespace JKingWeb\Arsse\TestCase\Db\MySQLPDO;
use JKingWeb\Arsse\Database;
use PHPUnit\Framework\Attributes\CoversClass;
use PHPUnit\Framework\Attributes\Group;
use PHPUnit\Framework\Attributes\CoversNothing;
#[Group('slow')]
#[Group('optional')]
#[Group('coverageOptional')]
#[CoversNothing]
#[CoversClass(Database::class)]
class TestDatabase extends \JKingWeb\Arsse\TestCase\Database\AbstractTest {
use \JKingWeb\Arsse\Test\DatabaseDrivers\MySQLPDO;

View file

@ -7,13 +7,15 @@ declare(strict_types=1);
namespace JKingWeb\Arsse\TestCase\Db\MySQLPDO;
/**
* @group slow
* @covers \JKingWeb\Arsse\Db\MySQL\PDODriver<extended>
* @covers \JKingWeb\Arsse\Db\MySQL\ExceptionBuilder
* @covers \JKingWeb\Arsse\Db\PDODriver
* @covers \JKingWeb\Arsse\Db\PDOError
* @covers \JKingWeb\Arsse\Db\SQLState */
use PHPUnit\Framework\Attributes\CoversClass;
use PHPUnit\Framework\Attributes\Group;
#[Group("slow")]
#[CoversClass(\JKingWeb\Arsse\Db\MySQL\PDODriver::class)]
#[CoversClass(\JKingWeb\Arsse\Db\MySQL\ExceptionBuilder::class)]
#[CoversClass(\JKingWeb\Arsse\Db\PDODriver::class)]
#[CoversClass(\JKingWeb\Arsse\Db\PDOError::class)]
#[CoversClass(\JKingWeb\Arsse\Db\SQLState::class)]
class TestDriver extends \JKingWeb\Arsse\TestCase\Db\BaseDriver {
use \JKingWeb\Arsse\Test\DatabaseDrivers\MySQLPDO;

View file

@ -7,12 +7,14 @@ declare(strict_types=1);
namespace JKingWeb\Arsse\TestCase\Db\MySQLPDO;
/**
* @group slow
* @covers \JKingWeb\Arsse\Db\PDOResult<extended>
* @covers \JKingWeb\Arsse\Db\MySQL\ExceptionBuilder
* @covers \JKingWeb\Arsse\Db\PDOError
* @covers \JKingWeb\Arsse\Db\SQLState */
use PHPUnit\Framework\Attributes\CoversClass;
use PHPUnit\Framework\Attributes\Group;
#[Group("slow")]
#[CoversClass(\JKingWeb\Arsse\Db\PDOResult::class)]
#[CoversClass(\JKingWeb\Arsse\Db\MySQL\ExceptionBuilder::class)]
#[CoversClass(\JKingWeb\Arsse\Db\PDOError::class)]
#[CoversClass(\JKingWeb\Arsse\Db\SQLState::class)]
class TestResult extends \JKingWeb\Arsse\TestCase\Db\BaseResult {
use \JKingWeb\Arsse\Test\DatabaseDrivers\MySQLPDO;

View file

@ -7,12 +7,14 @@ declare(strict_types=1);
namespace JKingWeb\Arsse\TestCase\Db\MySQLPDO;
/**
* @group slow
* @covers \JKingWeb\Arsse\Db\MySQL\PDOStatement<extended>
* @covers \JKingWeb\Arsse\Db\MySQL\ExceptionBuilder
* @covers \JKingWeb\Arsse\Db\PDOError
* @covers \JKingWeb\Arsse\Db\SQLState */
use PHPUnit\Framework\Attributes\CoversClass;
use PHPUnit\Framework\Attributes\Group;
#[Group("slow")]
#[CoversClass(\JKingWeb\Arsse\Db\MySQL\PDOStatement::class)]
#[CoversClass(\JKingWeb\Arsse\Db\MySQL\ExceptionBuilder::class)]
#[CoversClass(\JKingWeb\Arsse\Db\PDOError::class)]
#[CoversClass(\JKingWeb\Arsse\Db\SQLState::class)]
class TestStatement extends \JKingWeb\Arsse\TestCase\Db\BaseStatement {
use \JKingWeb\Arsse\Test\DatabaseDrivers\MySQLPDO;

View file

@ -7,13 +7,15 @@ declare(strict_types=1);
namespace JKingWeb\Arsse\TestCase\Db\MySQLPDO;
/**
* @group slow
* @covers \JKingWeb\Arsse\Db\MySQL\PDODriver<extended>
* @covers \JKingWeb\Arsse\Db\MySQL\ExceptionBuilder
* @covers \JKingWeb\Arsse\Db\PDODriver
* @covers \JKingWeb\Arsse\Db\PDOError
* @covers \JKingWeb\Arsse\Db\SQLState */
use PHPUnit\Framework\Attributes\CoversClass;
use PHPUnit\Framework\Attributes\Group;
#[Group("slow")]
#[CoversClass(\JKingWeb\Arsse\Db\MySQL\PDODriver::class)]
#[CoversClass(\JKingWeb\Arsse\Db\MySQL\ExceptionBuilder::class)]
#[CoversClass(\JKingWeb\Arsse\Db\PDODriver::class)]
#[CoversClass(\JKingWeb\Arsse\Db\PDOError::class)]
#[CoversClass(\JKingWeb\Arsse\Db\SQLState::class)]
class TestUpdate extends \JKingWeb\Arsse\TestCase\Db\BaseUpdate {
use \JKingWeb\Arsse\Test\DatabaseDrivers\MySQLPDO;

View file

@ -9,10 +9,12 @@ namespace JKingWeb\Arsse\TestCase\Db\PostgreSQL;
use JKingWeb\Arsse\Arsse;
use JKingWeb\Arsse\Db\PostgreSQL\Driver;
use PHPUnit\Framework\Attributes\CoversClass;
use PHPUnit\Framework\Attributes\DataProvider;
use PHPUnit\Framework\Attributes\Group;
/**
* @group slow
* @covers \JKingWeb\Arsse\Db\PostgreSQL\Driver<extended> */
#[Group("slow")]
#[CoversClass(\JKingWeb\Arsse\Db\PostgreSQL\Driver::class)]
class TestCreation extends \JKingWeb\Arsse\Test\AbstractTest {
public function setUp(): void {
if (!Driver::requirementsMet()) {
@ -20,7 +22,7 @@ class TestCreation extends \JKingWeb\Arsse\Test\AbstractTest {
}
}
/** @dataProvider provideConnectionStrings */
#[DataProvider("provideConnectionStrings")]
public function testGenerateConnectionString(bool $pdo, string $user, string $pass, string $db, string $host, int $port, string $service, string $exp): void {
self::setConf();
$timeout = (string) ceil(Arsse::$conf->dbTimeoutConnect ?? 0);

View file

@ -8,12 +8,13 @@ declare(strict_types=1);
namespace JKingWeb\Arsse\TestCase\Db\PostgreSQL;
use JKingWeb\Arsse\Database;
use PHPUnit\Framework\Attributes\CoversClass;
use PHPUnit\Framework\Attributes\Group;
use PHPUnit\Framework\Attributes\CoversNothing;
#[Group('slow')]
#[Group('coverageOptional')]
#[CoversNothing]
#[CoversClass(Database::class)]
class TestDatabase extends \JKingWeb\Arsse\TestCase\Database\AbstractTest {
use \JKingWeb\Arsse\Test\DatabaseDrivers\PostgreSQL;

View file

@ -7,11 +7,13 @@ declare(strict_types=1);
namespace JKingWeb\Arsse\TestCase\Db\PostgreSQL;
/**
* @group slow
* @covers \JKingWeb\Arsse\Db\PostgreSQL\Driver<extended>
* @covers \JKingWeb\Arsse\Db\PostgreSQL\Dispatch
* @covers \JKingWeb\Arsse\Db\SQLState */
use PHPUnit\Framework\Attributes\CoversClass;
use PHPUnit\Framework\Attributes\Group;
#[Group("slow")]
#[CoversClass(\JKingWeb\Arsse\Db\PostgreSQL\Driver::class)]
#[CoversClass(\JKingWeb\Arsse\Db\PostgreSQL\Dispatch::class)]
#[CoversClass(\JKingWeb\Arsse\Db\SQLState::class)]
class TestDriver extends \JKingWeb\Arsse\TestCase\Db\BaseDriver {
use \JKingWeb\Arsse\Test\DatabaseDrivers\PostgreSQL;

View file

@ -7,10 +7,11 @@ declare(strict_types=1);
namespace JKingWeb\Arsse\TestCase\Db\PostgreSQL;
/**
* @group slow
* @covers \JKingWeb\Arsse\Db\PostgreSQL\Result<extended>
*/
use PHPUnit\Framework\Attributes\CoversClass;
use PHPUnit\Framework\Attributes\Group;
#[Group("slow")]
#[CoversClass(\JKingWeb\Arsse\Db\PostgreSQL\Result::class)]
class TestResult extends \JKingWeb\Arsse\TestCase\Db\BaseResult {
use \JKingWeb\Arsse\Test\DatabaseDrivers\PostgreSQL;

View file

@ -7,11 +7,13 @@ declare(strict_types=1);
namespace JKingWeb\Arsse\TestCase\Db\PostgreSQL;
/**
* @group slow
* @covers \JKingWeb\Arsse\Db\PostgreSQL\Statement<extended>
* @covers \JKingWeb\Arsse\Db\PostgreSQL\Dispatch
* @covers \JKingWeb\Arsse\Db\SQLState */
use PHPUnit\Framework\Attributes\CoversClass;
use PHPUnit\Framework\Attributes\Group;
#[Group("slow")]
#[CoversClass(\JKingWeb\Arsse\Db\PostgreSQL\Statement::class)]
#[CoversClass(\JKingWeb\Arsse\Db\PostgreSQL\Dispatch::class)]
#[CoversClass(\JKingWeb\Arsse\Db\SQLState::class)]
class TestStatement extends \JKingWeb\Arsse\TestCase\Db\BaseStatement {
use \JKingWeb\Arsse\Test\DatabaseDrivers\PostgreSQL;

View file

@ -7,10 +7,12 @@ declare(strict_types=1);
namespace JKingWeb\Arsse\TestCase\Db\PostgreSQL;
/**
* @group slow
* @covers \JKingWeb\Arsse\Db\PostgreSQL\Driver<extended>
* @covers \JKingWeb\Arsse\Db\SQLState */
use PHPUnit\Framework\Attributes\CoversClass;
use PHPUnit\Framework\Attributes\Group;
#[Group("slow")]
#[CoversClass(\JKingWeb\Arsse\Db\PostgreSQL\Driver::class)]
#[CoversClass(\JKingWeb\Arsse\Db\SQLState::class)]
class TestUpdate extends \JKingWeb\Arsse\TestCase\Db\BaseUpdate {
use \JKingWeb\Arsse\Test\DatabaseDrivers\PostgreSQL;

View file

@ -9,10 +9,12 @@ namespace JKingWeb\Arsse\TestCase\Db\PostgreSQLPDO;
use JKingWeb\Arsse\Arsse;
use JKingWeb\Arsse\Db\PostgreSQL\PDODriver as Driver;
use PHPUnit\Framework\Attributes\CoversClass;
use PHPUnit\Framework\Attributes\DataProvider;
use PHPUnit\Framework\Attributes\Group;
/**
* @group slow
* @covers \JKingWeb\Arsse\Db\PostgreSQL\PDODriver<extended> */
#[Group("slow")]
#[CoversClass(\JKingWeb\Arsse\Db\PostgreSQL\PDODriver::class)]
class TestCreation extends \JKingWeb\Arsse\Test\AbstractTest {
public function setUp(): void {
if (!Driver::requirementsMet()) {
@ -20,7 +22,7 @@ class TestCreation extends \JKingWeb\Arsse\Test\AbstractTest {
}
}
/** @dataProvider provideConnectionStrings */
#[DataProvider("provideConnectionStrings")]
public function testGenerateConnectionString(bool $pdo, string $user, string $pass, string $db, string $host, int $port, string $service, string $exp): void {
self::setConf();
$timeout = (string) ceil(Arsse::$conf->dbTimeoutConnect ?? 0);

View file

@ -8,13 +8,14 @@ declare(strict_types=1);
namespace JKingWeb\Arsse\TestCase\Db\PostgreSQLPDO;
use JKingWeb\Arsse\Database;
use PHPUnit\Framework\Attributes\CoversClass;
use PHPUnit\Framework\Attributes\Group;
use PHPUnit\Framework\Attributes\CoversNothing;
#[Group('slow')]
#[Group('optional')]
#[Group('coverageOptional')]
#[CoversNothing]
#[CoversClass(Database::class)]
class TestDatabase extends \JKingWeb\Arsse\TestCase\Database\AbstractTest {
use \JKingWeb\Arsse\Test\DatabaseDrivers\PostgreSQLPDO;

View file

@ -7,12 +7,14 @@ declare(strict_types=1);
namespace JKingWeb\Arsse\TestCase\Db\PostgreSQLPDO;
/**
* @group slow
* @covers \JKingWeb\Arsse\Db\PostgreSQL\PDODriver<extended>
* @covers \JKingWeb\Arsse\Db\PDODriver
* @covers \JKingWeb\Arsse\Db\PDOError
* @covers \JKingWeb\Arsse\Db\SQLState */
use PHPUnit\Framework\Attributes\CoversClass;
use PHPUnit\Framework\Attributes\Group;
#[Group("slow")]
#[CoversClass(\JKingWeb\Arsse\Db\PostgreSQL\PDODriver::class)]
#[CoversClass(\JKingWeb\Arsse\Db\PDODriver::class)]
#[CoversClass(\JKingWeb\Arsse\Db\PDOError::class)]
#[CoversClass(\JKingWeb\Arsse\Db\SQLState::class)]
class TestDriver extends \JKingWeb\Arsse\TestCase\Db\BaseDriver {
use \JKingWeb\Arsse\Test\DatabaseDrivers\PostgreSQLPDO;

View file

@ -7,10 +7,11 @@ declare(strict_types=1);
namespace JKingWeb\Arsse\TestCase\Db\PostgreSQLPDO;
/**
* @group slow
* @covers \JKingWeb\Arsse\Db\PostgreSQL\PDOResult<extended>
*/
use PHPUnit\Framework\Attributes\CoversClass;
use PHPUnit\Framework\Attributes\Group;
#[Group("slow")]
#[CoversClass(\JKingWeb\Arsse\Db\PostgreSQL\PDOResult::class)]
class TestResult extends \JKingWeb\Arsse\TestCase\Db\BaseResult {
use \JKingWeb\Arsse\Test\DatabaseDrivers\PostgreSQLPDO;

View file

@ -7,11 +7,13 @@ declare(strict_types=1);
namespace JKingWeb\Arsse\TestCase\Db\PostgreSQLPDO;
/**
* @group slow
* @covers \JKingWeb\Arsse\Db\PostgreSQL\PDOStatement<extended>
* @covers \JKingWeb\Arsse\Db\PDOError
* @covers \JKingWeb\Arsse\Db\SQLState */
use PHPUnit\Framework\Attributes\CoversClass;
use PHPUnit\Framework\Attributes\Group;
#[Group("slow")]
#[CoversClass(\JKingWeb\Arsse\Db\PostgreSQL\PDOStatement::class)]
#[CoversClass(\JKingWeb\Arsse\Db\PDOError::class)]
#[CoversClass(\JKingWeb\Arsse\Db\SQLState::class)]
class TestStatement extends \JKingWeb\Arsse\TestCase\Db\BaseStatement {
use \JKingWeb\Arsse\Test\DatabaseDrivers\PostgreSQLPDO;

View file

@ -7,12 +7,14 @@ declare(strict_types=1);
namespace JKingWeb\Arsse\TestCase\Db\PostgreSQLPDO;
/**
* @group slow
* @covers \JKingWeb\Arsse\Db\PostgreSQL\PDODriver<extended>
* @covers \JKingWeb\Arsse\Db\PDODriver
* @covers \JKingWeb\Arsse\Db\PDOError
* @covers \JKingWeb\Arsse\Db\SQLState */
use PHPUnit\Framework\Attributes\CoversClass;
use PHPUnit\Framework\Attributes\Group;
#[Group("slow")]
#[CoversClass(\JKingWeb\Arsse\Db\PostgreSQL\PDODriver::class)]
#[CoversClass(\JKingWeb\Arsse\Db\PDODriver::class)]
#[CoversClass(\JKingWeb\Arsse\Db\PDOError::class)]
#[CoversClass(\JKingWeb\Arsse\Db\SQLState::class)]
class TestUpdate extends \JKingWeb\Arsse\TestCase\Db\BaseUpdate {
use \JKingWeb\Arsse\Test\DatabaseDrivers\PostgreSQLPDO;

View file

@ -10,10 +10,10 @@ namespace JKingWeb\Arsse\TestCase\Db\SQLite3;
use JKingWeb\Arsse\Arsse;
use JKingWeb\Arsse\Db\SQLite3\Driver;
use org\bovigo\vfs\vfsStream;
use PHPUnit\Framework\Attributes\CoversClass;
/**
* @covers \JKingWeb\Arsse\Db\SQLite3\Driver<extended>
* @covers \JKingWeb\Arsse\Db\SQLite3\ExceptionBuilder */
#[CoversClass(\JKingWeb\Arsse\Db\SQLite3\Driver::class)]
#[CoversClass(\JKingWeb\Arsse\Db\SQLite3\ExceptionBuilder::class)]
class TestCreation extends \JKingWeb\Arsse\Test\AbstractTest {
protected $data;
protected $drv;

View file

@ -8,11 +8,12 @@ declare(strict_types=1);
namespace JKingWeb\Arsse\TestCase\Db\SQLite3;
use JKingWeb\Arsse\Database;
use PHPUnit\Framework\Attributes\CoversClass;
use PHPUnit\Framework\Attributes\Group;
use PHPUnit\Framework\Attributes\CoversNothing;
#[Group('optional')]
#[CoversNothing]
#[CoversClass(Database::class)]
class TestDatabase extends \JKingWeb\Arsse\TestCase\Database\AbstractTest {
use \JKingWeb\Arsse\Test\DatabaseDrivers\SQLite3;

View file

@ -7,9 +7,10 @@ declare(strict_types=1);
namespace JKingWeb\Arsse\TestCase\Db\SQLite3;
/**
* @covers \JKingWeb\Arsse\Db\SQLite3\Driver<extended>
* @covers \JKingWeb\Arsse\Db\SQLite3\ExceptionBuilder */
use PHPUnit\Framework\Attributes\CoversClass;
#[CoversClass(\JKingWeb\Arsse\Db\SQLite3\Driver::class)]
#[CoversClass(\JKingWeb\Arsse\Db\SQLite3\ExceptionBuilder::class)]
class TestDriver extends \JKingWeb\Arsse\TestCase\Db\BaseDriver {
use \JKingWeb\Arsse\Test\DatabaseDrivers\SQLite3;

View file

@ -7,9 +7,9 @@ declare(strict_types=1);
namespace JKingWeb\Arsse\TestCase\Db\SQLite3;
/**
* @covers \JKingWeb\Arsse\Db\SQLite3\Result<extended>
*/
use PHPUnit\Framework\Attributes\CoversClass;
#[CoversClass(\JKingWeb\Arsse\Db\SQLite3\Result::class)]
class TestResult extends \JKingWeb\Arsse\TestCase\Db\BaseResult {
use \JKingWeb\Arsse\Test\DatabaseDrivers\SQLite3;

View file

@ -7,9 +7,10 @@ declare(strict_types=1);
namespace JKingWeb\Arsse\TestCase\Db\SQLite3;
/**
* @covers \JKingWeb\Arsse\Db\SQLite3\Statement<extended>
* @covers \JKingWeb\Arsse\Db\SQLite3\ExceptionBuilder */
use PHPUnit\Framework\Attributes\CoversClass;
#[CoversClass(\JKingWeb\Arsse\Db\SQLite3\Statement::class)]
#[CoversClass(\JKingWeb\Arsse\Db\SQLite3\ExceptionBuilder::class)]
class TestStatement extends \JKingWeb\Arsse\TestCase\Db\BaseStatement {
use \JKingWeb\Arsse\Test\DatabaseDrivers\SQLite3;

View file

@ -7,9 +7,10 @@ declare(strict_types=1);
namespace JKingWeb\Arsse\TestCase\Db\SQLite3;
/**
* @covers \JKingWeb\Arsse\Db\SQLite3\Driver<extended>
* @covers \JKingWeb\Arsse\Db\SQLite3\ExceptionBuilder */
use PHPUnit\Framework\Attributes\CoversClass;
#[CoversClass(\JKingWeb\Arsse\Db\SQLite3\Driver::class)]
#[CoversClass(\JKingWeb\Arsse\Db\SQLite3\ExceptionBuilder::class)]
class TestUpdate extends \JKingWeb\Arsse\TestCase\Db\BaseUpdate {
use \JKingWeb\Arsse\Test\DatabaseDrivers\SQLite3;

View file

@ -10,12 +10,12 @@ namespace JKingWeb\Arsse\TestCase\Db\SQLite3PDO;
use JKingWeb\Arsse\Arsse;
use JKingWeb\Arsse\Db\SQLite3\PDODriver as Driver;
use org\bovigo\vfs\vfsStream;
use PHPUnit\Framework\Attributes\CoversClass;
/**
* @covers \JKingWeb\Arsse\Db\SQLite3\PDODriver<extended>
* @covers \JKingWeb\Arsse\Db\PDODriver
* @covers \JKingWeb\Arsse\Db\PDOError
* @covers \JKingWeb\Arsse\Db\SQLState */
#[CoversClass(\JKingWeb\Arsse\Db\SQLite3\PDODriver::class)]
#[CoversClass(\JKingWeb\Arsse\Db\PDODriver::class)]
#[CoversClass(\JKingWeb\Arsse\Db\PDOError::class)]
#[CoversClass(\JKingWeb\Arsse\Db\SQLState::class)]
class TestCreation extends \JKingWeb\Arsse\Test\AbstractTest {
protected $data;
protected $drv;

View file

@ -8,9 +8,10 @@ declare(strict_types=1);
namespace JKingWeb\Arsse\TestCase\Db\SQLite3PDO;
use PHPUnit\Framework\Attributes\CoversNothing;
use JKingWeb\Arsse\Database;
use PHPUnit\Framework\Attributes\CoversClass;
#[CoversNothing]
#[CoversClass(Database::class)]
class TestDatabase extends \JKingWeb\Arsse\TestCase\Database\AbstractTest {
use \JKingWeb\Arsse\Test\DatabaseDrivers\SQLite3PDO;

View file

@ -7,11 +7,12 @@ declare(strict_types=1);
namespace JKingWeb\Arsse\TestCase\Db\SQLite3PDO;
/**
* @covers \JKingWeb\Arsse\Db\SQLite3\PDODriver<extended>
* @covers \JKingWeb\Arsse\Db\PDODriver
* @covers \JKingWeb\Arsse\Db\PDOError
* @covers \JKingWeb\Arsse\Db\SQLState */
use PHPUnit\Framework\Attributes\CoversClass;
#[CoversClass(\JKingWeb\Arsse\Db\SQLite3\PDODriver::class)]
#[CoversClass(\JKingWeb\Arsse\Db\PDODriver::class)]
#[CoversClass(\JKingWeb\Arsse\Db\PDOError::class)]
#[CoversClass(\JKingWeb\Arsse\Db\SQLState::class)]
class TestDriver extends \JKingWeb\Arsse\TestCase\Db\BaseDriver {
use \JKingWeb\Arsse\Test\DatabaseDrivers\SQLite3PDO;

View file

@ -7,9 +7,9 @@ declare(strict_types=1);
namespace JKingWeb\Arsse\TestCase\Db\SQLite3PDO;
/**
* @covers \JKingWeb\Arsse\Db\PDOResult<extended>
*/
use PHPUnit\Framework\Attributes\CoversClass;
#[CoversClass(\JKingWeb\Arsse\Db\PDOResult::class)]
class TestResult extends \JKingWeb\Arsse\TestCase\Db\BaseResult {
use \JKingWeb\Arsse\Test\DatabaseDrivers\SQLite3PDO;

View file

@ -7,10 +7,11 @@ declare(strict_types=1);
namespace JKingWeb\Arsse\TestCase\Db\SQLite3PDO;
/**
* @covers \JKingWeb\Arsse\Db\PDOStatement<extended>
* @covers \JKingWeb\Arsse\Db\PDOError
* @covers \JKingWeb\Arsse\Db\SQLState */
use PHPUnit\Framework\Attributes\CoversClass;
#[CoversClass(\JKingWeb\Arsse\Db\PDOStatement::class)]
#[CoversClass(\JKingWeb\Arsse\Db\PDOError::class)]
#[CoversClass(\JKingWeb\Arsse\Db\SQLState::class)]
class TestStatement extends \JKingWeb\Arsse\TestCase\Db\BaseStatement {
use \JKingWeb\Arsse\Test\DatabaseDrivers\SQLite3PDO;

View file

@ -7,11 +7,12 @@ declare(strict_types=1);
namespace JKingWeb\Arsse\TestCase\Db\SQLite3PDO;
/**
* @covers \JKingWeb\Arsse\Db\SQLite3\PDODriver<extended>
* @covers \JKingWeb\Arsse\Db\PDODriver
* @covers \JKingWeb\Arsse\Db\PDOError
* @covers \JKingWeb\Arsse\Db\SQLState */
use PHPUnit\Framework\Attributes\CoversClass;
#[CoversClass(\JKingWeb\Arsse\Db\SQLite3\PDODriver::class)]
#[CoversClass(\JKingWeb\Arsse\Db\PDODriver::class)]
#[CoversClass(\JKingWeb\Arsse\Db\PDOError::class)]
#[CoversClass(\JKingWeb\Arsse\Db\SQLState::class)]
class TestUpdate extends \JKingWeb\Arsse\TestCase\Db\BaseUpdate {
use \JKingWeb\Arsse\Test\DatabaseDrivers\SQLite3PDO;

View file

@ -9,8 +9,9 @@ namespace JKingWeb\Arsse\TestCase\Db;
use JKingWeb\Arsse\Db\ResultAggregate;
use JKingWeb\Arsse\Test\Result;
use PHPUnit\Framework\Attributes\CoversClass;
/** @covers \JKingWeb\Arsse\Db\ResultAggregate<extended> */
#[CoversClass(\JKingWeb\Arsse\Db\ResultAggregate::class)]
class TestResultAggregate extends \JKingWeb\Arsse\Test\AbstractTest {
public function testGetChangeCountAndLastInsertId(): void {
$in = [

View file

@ -8,8 +8,9 @@ declare(strict_types=1);
namespace JKingWeb\Arsse\TestCase\Db;
use JKingWeb\Arsse\Db\ResultEmpty;
use PHPUnit\Framework\Attributes\CoversClass;
/** @covers \JKingWeb\Arsse\Db\ResultEmpty<extended> */
#[CoversClass(\JKingWeb\Arsse\Db\ResultEmpty::class)]
class TestResultEmpty extends \JKingWeb\Arsse\Test\AbstractTest {
public function testGetChangeCountAndLastInsertId(): void {
$r = new ResultEmpty;

View file

@ -16,6 +16,7 @@ use PHPUnit\Framework\Attributes\CoversClass;
use PHPUnit\Framework\Attributes\Depends;
#[CoversClass(\JKingWeb\Arsse\AbstractException::class)]
#[CoversClass(\JKingWeb\Arsse\ExceptionFatal::class)]
class TestException extends \JKingWeb\Arsse\Test\AbstractTest {
public function setUp(): void {
self::clearData(false);
@ -59,7 +60,6 @@ class TestException extends \JKingWeb\Arsse\Test\AbstractTest {
throw new LangException("testThisExceptionMessageDoesNotExist");
}
/** @covers \JKingWeb\Arsse\ExceptionFatal */
public function testFatalException(): void {
$this->expectException('JKingWeb\Arsse\ExceptionFatal');
throw new \JKingWeb\Arsse\ExceptionFatal("");

View file

@ -13,8 +13,8 @@ use JKingWeb\Arsse\Feed;
use PHPUnit\Framework\Attributes\CoversClass;
use PHPUnit\Framework\Attributes\Group;
#[CoversClass(\JKingWeb\Arsse\Feed::class)]
#[Group('slow')]
#[CoversClass(\JKingWeb\Arsse\Feed::class)]
class TestFetching extends \JKingWeb\Arsse\Test\AbstractTest {
protected static $host = "http://localhost:8000/";
protected $base = "";

View file

@ -12,8 +12,10 @@ use JKingWeb\Arsse\Database;
use JKingWeb\Arsse\Test\Result;
use JKingWeb\Arsse\ImportExport\OPML;
use JKingWeb\Arsse\ImportExport\Exception;
use PHPUnit\Framework\Attributes\CoversClass;
use PHPUnit\Framework\Attributes\DataProvider;
/** @covers \JKingWeb\Arsse\ImportExport\OPML<extended> */
#[CoversClass(\JKingWeb\Arsse\ImportExport\OPML::class)]
class TestOPML extends \JKingWeb\Arsse\Test\AbstractTest {
protected $folders = [
['id' => 5, 'parent' => 3, 'children' => 0, 'feeds' => 1, 'name' => "Local"],
@ -104,7 +106,7 @@ OPML_EXPORT_SERIALIZATION;
(new OPML)->export("john.doe@example.com");
}
/** @dataProvider provideParserData */
#[DataProvider("provideParserData")]
public function testParseOpmlForImport(string $file, bool $flat, $exp): void {
$data = file_get_contents(\JKingWeb\Arsse\DOCROOT."Import/OPML/$file");
// make the ImportExport::parse() method visible

View file

@ -12,17 +12,17 @@ use JKingWeb\Arsse\Context\ExclusionContext;
use JKingWeb\Arsse\Context\UnionContext;
use JKingWeb\Arsse\Misc\Date;
use JKingWeb\Arsse\Misc\ValueInfo;
use PHPUnit\Framework\Attributes\CoversClass;
use PHPUnit\Framework\Attributes\DataProvider;
/**
* @covers \JKingWeb\Arsse\Context\Context<extended>
* @covers \JKingWeb\Arsse\Context\ExclusionContext<extended>
* @covers \JKingWeb\Arsse\Context\UnionContext<extended>
*/
#[CoversClass(\JKingWeb\Arsse\Context\Context::class)]
#[CoversClass(\JKingWeb\Arsse\Context\ExclusionContext::class)]
#[CoversClass(\JKingWeb\Arsse\Context\UnionContext::class)]
class TestContext extends \JKingWeb\Arsse\Test\AbstractTest {
protected $ranges = ['modifiedRange', 'markedRange', 'articleRange', 'editionRange'];
protected $times = ['modifiedRange', 'markedRange'];
/** @dataProvider provideContextOptions */
#[DataProvider("provideContextOptions")]
public function testSetContextOptions(string $method, array $input, $output, bool $not): void {
$parent = new Context;
$c = ($not) ? $parent->not : $parent;

View file

@ -11,6 +11,7 @@ namespace JKingWeb\Arsse\TestCase\Misc;
use JKingWeb\Arsse\Misc\ValueInfo as I;
use JKingWeb\Arsse\Test\Misc\StrClass;
use JKingWeb\Arsse\Test\Result;
use PHPUnit\Framework\Attributes\CoversClass;
use PHPUnit\Framework\Attributes\DataProvider;
#[CoversClass(\JKingWeb\Arsse\Misc\ValueInfo::class)]

View file

@ -7,8 +7,11 @@ declare(strict_types=1);
namespace JKingWeb\Arsse\TestCase\REST\Fever\PDO;
/** @covers \JKingWeb\Arsse\REST\Fever\API<extended>
* @group optional */
use PHPUnit\Framework\Attributes\CoversClass;
use PHPUnit\Framework\Attributes\Group;
#[Group("optional")]
#[CoversClass(\JKingWeb\Arsse\REST\Fever\API::class)]
class TestAPI extends \JKingWeb\Arsse\TestCase\REST\Fever\TestAPI {
use \JKingWeb\Arsse\Test\PDOTest;
}

View file

@ -16,9 +16,11 @@ use JKingWeb\Arsse\Context\Context;
use JKingWeb\Arsse\Db\ExceptionInput;
use JKingWeb\Arsse\Db\Transaction;
use JKingWeb\Arsse\REST\Fever\API;
use PHPUnit\Framework\Attributes\CoversClass;
use PHPUnit\Framework\Attributes\DataProvider;
use Psr\Http\Message\ResponseInterface;
/** @covers \JKingWeb\Arsse\REST\Fever\API<extended> */
#[CoversClass(\JKingWeb\Arsse\REST\Fever\API::class)]
class TestAPI extends \JKingWeb\Arsse\Test\AbstractTest {
/** @var \JKingWeb\Arsse\REST\Fever\API */
protected $h;
@ -168,7 +170,7 @@ class TestAPI extends \JKingWeb\Arsse\Test\AbstractTest {
\Phake::when($this->hMock)->baseResponse->thenReturn([]);
}
/** @dataProvider provideTokenAuthenticationRequests */
#[DataProvider("provideTokenAuthenticationRequests")]
public function testAuthenticateAUserToken(bool $httpRequired, bool $tokenEnforced, ?string $httpUser, array $dataPost, array $dataGet, ResponseInterface $exp): void {
self::setConf([
'userHTTPAuthRequired' => $httpRequired,
@ -291,7 +293,7 @@ class TestAPI extends \JKingWeb\Arsse\Test\AbstractTest {
$this->assertMessage($exp, $this->req("api&feeds"));
}
/** @dataProvider provideItemListContexts */
#[DataProvider("provideItemListContexts")]
public function testListItems(string $url, Context $c, bool $desc): void {
$fields = ["id", "subscription", "title", "author", "content", "url", "starred", "unread", "published_date"];
$order = [$desc ? "id desc" : "id"];
@ -338,7 +340,7 @@ class TestAPI extends \JKingWeb\Arsse\Test\AbstractTest {
$this->assertMessage($exp, $this->req("api&links"));
}
/** @dataProvider provideMarkingContexts */
#[DataProvider("provideMarkingContexts")]
public function testSetMarks(string $post, Context $c, array $data, array $out): void {
$saved = [['id' => 1],['id' => 2],['id' => 3]];
$unread = [['id' => 4],['id' => 5],['id' => 6]];
@ -355,7 +357,7 @@ class TestAPI extends \JKingWeb\Arsse\Test\AbstractTest {
}
}
/** @dataProvider provideMarkingContexts */
#[DataProvider("provideMarkingContexts")]
public function testSetMarksWithQuery(string $get, Context $c, array $data, array $out): void {
$saved = [['id' => 1],['id' => 2],['id' => 3]];
$unread = [['id' => 4],['id' => 5],['id' => 6]];
@ -410,7 +412,7 @@ class TestAPI extends \JKingWeb\Arsse\Test\AbstractTest {
];
}
/** @dataProvider provideInvalidRequests */
#[DataProvider("provideInvalidRequests")]
public function testSendInvalidRequests(string $get, string $post, string $method, ?string $type, ResponseInterface $exp): void {
$this->assertMessage($exp, $this->req($get, $post, $method, $type));
}

View file

@ -14,8 +14,10 @@ use JKingWeb\Arsse\Db\ExceptionInput;
use JKingWeb\Arsse\User\ExceptionConflict as UserException;
use JKingWeb\Arsse\Db\Transaction;
use JKingWeb\Arsse\REST\Fever\User as FeverUser;
use PHPUnit\Framework\Attributes\CoversClass;
use PHPUnit\Framework\Attributes\DataProvider;
/** @covers \JKingWeb\Arsse\REST\Fever\User<extended> */
#[CoversClass(\JKingWeb\Arsse\REST\Fever\User::class)]
class TestUser extends \JKingWeb\Arsse\Test\AbstractTest {
protected $u;
protected $h;
@ -33,7 +35,7 @@ class TestUser extends \JKingWeb\Arsse\Test\AbstractTest {
$this->h = new FeverUser;
}
/** @dataProvider providePasswordCreations */
#[DataProvider("providePasswordCreations")]
public function testRegisterAUserPassword(string $user, ?string $password, $exp): void {
\Phake::when(Arsse::$user)->generatePassword->thenReturn("RANDOM_PASSWORD");
\Phake::when(Arsse::$db)->tokenCreate->thenReturnCallback(function($user, $class, $id = null) {
@ -73,7 +75,7 @@ class TestUser extends \JKingWeb\Arsse\Test\AbstractTest {
\Phake::verify(Arsse::$db)->tokenRevoke("john.doe@example.com", "fever.login");
}
/** @dataProvider provideUserAuthenticationRequests */
#[DataProvider("provideUserAuthenticationRequests")]
public function testAuthenticateAUserName(string $user, string $password, bool $exp): void {
\Phake::when(Arsse::$db)->tokenLookup->thenThrow(new ExceptionInput("constraintViolation"));
\Phake::when(Arsse::$db)->tokenLookup("fever.login", md5("jane.doe@example.com:secret"))->thenReturn(['user' => "jane.doe@example.com"]);

View file

@ -7,8 +7,11 @@ declare(strict_types=1);
namespace JKingWeb\Arsse\TestCase\REST\Miniflux\PDO;
/** @covers \JKingWeb\Arsse\REST\Miniflux\Token<extended>
* @group optional */
use PHPUnit\Framework\Attributes\CoversClass;
use PHPUnit\Framework\Attributes\Group;
#[Group("optional")]
#[CoversClass(\JKingWeb\Arsse\REST\Miniflux\Token::class)]
class TestToken extends \JKingWeb\Arsse\TestCase\REST\Miniflux\TestV1 {
use \JKingWeb\Arsse\Test\PDOTest;
}

View file

@ -7,8 +7,11 @@ declare(strict_types=1);
namespace JKingWeb\Arsse\TestCase\REST\Miniflux\PDO;
/** @covers \JKingWeb\Arsse\REST\Miniflux\V1<extended>
* @group optional */
use PHPUnit\Framework\Attributes\CoversClass;
use PHPUnit\Framework\Attributes\Group;
#[Group("optional")]
#[CoversClass(\JKingWeb\Arsse\REST\Miniflux\V1::class)]
class TestV1 extends \JKingWeb\Arsse\TestCase\REST\Miniflux\TestV1 {
use \JKingWeb\Arsse\Test\PDOTest;
}

View file

@ -12,8 +12,9 @@ use JKingWeb\Arsse\Database;
use JKingWeb\Arsse\Db\Transaction;
use JKingWeb\Arsse\REST\Miniflux\Token;
use JKingWeb\Arsse\Test\Result;
use PHPUnit\Framework\Attributes\CoversClass;
/** @covers \JKingWeb\Arsse\REST\Miniflux\Token<extended> */
#[CoversClass(\JKingWeb\Arsse\REST\Miniflux\Token::class)]
class TestToken extends \JKingWeb\Arsse\Test\AbstractTest {
protected const NOW = "2020-12-09T22:35:10.023419Z";
protected const TOKEN = "Tk2o9YubmZIL2fm2w8Z4KlDEQJz532fNSOcTG0s2_xc=";

View file

@ -23,9 +23,11 @@ use JKingWeb\Arsse\ImportExport\OPML;
use JKingWeb\Arsse\User\ExceptionConflict;
use JKingWeb\Arsse\User\ExceptionInput as UserExceptionInput;
use JKingWeb\Arsse\Test\Result;
use PHPUnit\Framework\Attributes\CoversClass;
use PHPUnit\Framework\Attributes\DataProvider;
use Psr\Http\Message\ResponseInterface;
/** @covers \JKingWeb\Arsse\REST\Miniflux\V1<extended> */
#[CoversClass(\JKingWeb\Arsse\REST\Miniflux\V1::class)]
class TestV1 extends \JKingWeb\Arsse\Test\AbstractTest {
protected const NOW = "2020-12-09T22:35:10.023419Z";
protected const TOKEN = "Tk2o9YubmZIL2fm2w8Z4KlDEQJz532fNSOcTG0s2_xc=";
@ -97,7 +99,7 @@ class TestV1 extends \JKingWeb\Arsse\Test\AbstractTest {
$this->assertMessage($exp, $act);
}
/** @dataProvider provideAuthResponses */
#[DataProvider("provideAuthResponses")]
public function testAuthenticateAUser($token, bool $auth, bool $success): void {
$exp = $success ? HTTP::respEmpty(404) : V1::respError("401", 401);
$user = "john.doe@example.com";
@ -128,7 +130,7 @@ class TestV1 extends \JKingWeb\Arsse\Test\AbstractTest {
];
}
/** @dataProvider provideInvalidPaths */
#[DataProvider("provideInvalidPaths")]
public function testRespondToInvalidPaths($path, $method, $code, $allow = null): void {
$exp = HTTP::respEmpty($code, $allow ? ['Allow' => $allow] : []);
$this->assertMessage($exp, $this->req($method, $path));
@ -143,7 +145,7 @@ class TestV1 extends \JKingWeb\Arsse\Test\AbstractTest {
];
}
/** @dataProvider provideOptionsRequests */
#[DataProvider("provideOptionsRequests")]
public function testRespondToOptionsRequests(string $url, string $allow, string $accept): void {
$exp = HTTP::respEmpty(204, [
'Allow' => $allow,
@ -172,7 +174,7 @@ class TestV1 extends \JKingWeb\Arsse\Test\AbstractTest {
$this->assertMessage($exp, $this->req("POST", "/discover", ['url' => 2112]));
}
/** @dataProvider provideDiscoveries */
#[DataProvider("provideDiscoveries")]
public function testDiscoverFeeds($in, ResponseInterface $exp): void {
$this->assertMessage($exp, $this->req("POST", "/discover", ['url' => $in]));
}
@ -193,7 +195,7 @@ class TestV1 extends \JKingWeb\Arsse\Test\AbstractTest {
];
}
/** @dataProvider provideUserQueries */
#[DataProvider("provideUserQueries")]
public function testQueryUsers(bool $admin, string $route, ResponseInterface $exp): void {
$u = [
new ExceptionConflict("doesNotExist"),
@ -234,7 +236,7 @@ class TestV1 extends \JKingWeb\Arsse\Test\AbstractTest {
];
}
/** @dataProvider provideUserModifications */
#[DataProvider("provideUserModifications")]
public function testModifyAUser(bool $admin, string $url, array $body, $in1, $out1, $in2, $out2, $in3, $out3, ResponseInterface $exp): void {
Arsse::$user = \Phake::mock(User::class);
\Phake::when(Arsse::$user)->begin->thenReturn($this->transaction);
@ -303,7 +305,7 @@ class TestV1 extends \JKingWeb\Arsse\Test\AbstractTest {
];
}
/** @dataProvider provideUserAdditions */
#[DataProvider("provideUserAdditions")]
public function testAddAUser(array $body, $in1, $out1, $in2, $out2, ResponseInterface $exp): void {
Arsse::$user = \Phake::mock(User::class);
\Phake::when(Arsse::$user)->begin->thenReturn($this->transaction);
@ -398,7 +400,7 @@ class TestV1 extends \JKingWeb\Arsse\Test\AbstractTest {
$this->assertMessage($exp, $this->req("GET", "/categories"));
}
/** @dataProvider provideCategoryAdditions */
#[DataProvider("provideCategoryAdditions")]
public function testAddACategory($title, ResponseInterface $exp): void {
if (!strlen((string) $title)) {
\Phake::when(Arsse::$db)->folderAdd->thenThrow(new ExceptionInput("missing"));
@ -423,7 +425,7 @@ class TestV1 extends \JKingWeb\Arsse\Test\AbstractTest {
];
}
/** @dataProvider provideCategoryUpdates */
#[DataProvider("provideCategoryUpdates")]
public function testRenameACategory(int $id, $title, $out, ResponseInterface $exp): void {
\Phake::when(Arsse::$user)->propertiesSet->thenReturn(['root_folder_name' => $title]);
if (is_string($out)) {
@ -523,7 +525,7 @@ class TestV1 extends \JKingWeb\Arsse\Test\AbstractTest {
\Phake::verify(Arsse::$db)->subscriptionPropertiesGet(Arsse::$user->id, 1);
}
/** @dataProvider provideFeedCreations */
#[DataProvider("provideFeedCreations")]
public function testCreateAFeed(array $in, $out1, $out2, $out3, $out4, ResponseInterface $exp): void {
if ($out1 instanceof \Exception) {
\Phake::when(Arsse::$db)->feedAdd->thenThrow($out1);
@ -614,7 +616,7 @@ class TestV1 extends \JKingWeb\Arsse\Test\AbstractTest {
];
}
/** @dataProvider provideFeedModifications */
#[DataProvider("provideFeedModifications")]
public function testModifyAFeed(array $in, array $data, $out, ResponseInterface $exp): void {
$this->h = \Phake::partialMock(V1::class);
\Phake::when($this->h)->getFeed->thenReturn(HTTP::respJson(self::FEEDS_OUT[0]));
@ -664,7 +666,7 @@ class TestV1 extends \JKingWeb\Arsse\Test\AbstractTest {
\Phake::verify(Arsse::$db)->subscriptionRemove(Arsse::$user->id, 2112);
}
/** @dataProvider provideIcons */
#[DataProvider("provideIcons")]
public function testGetTheIconOfASubscription($out, ResponseInterface $exp): void {
if ($out instanceof \Exception) {
\Phake::when(Arsse::$db)->subscriptionIcon->thenThrow($out);
@ -686,7 +688,7 @@ class TestV1 extends \JKingWeb\Arsse\Test\AbstractTest {
];
}
/** @dataProvider provideEntryQueries */
#[DataProvider("provideEntryQueries")]
public function testGetEntries(string $url, ?RootContext $c, ?array $order, $out, bool $count, ResponseInterface $exp): void {
\Phake::when(Arsse::$db)->subscriptionList->thenReturn(new Result(self::v(self::FEEDS)));
\Phake::when(Arsse::$db)->articleCount->thenReturn(2112);
@ -777,7 +779,7 @@ class TestV1 extends \JKingWeb\Arsse\Test\AbstractTest {
];
}
/** @dataProvider provideSingleEntryQueries */
#[DataProvider("provideSingleEntryQueries")]
public function testGetASingleEntry(string $url, Context $c, $out, ResponseInterface $exp): void {
\Phake::when(Arsse::$db)->subscriptionPropertiesGet->thenReturn(self::v(self::FEEDS[1]));
if ($out instanceof \Exception) {
@ -816,7 +818,7 @@ class TestV1 extends \JKingWeb\Arsse\Test\AbstractTest {
];
}
/** @dataProvider provideEntryMarkings */
#[DataProvider("provideEntryMarkings")]
public function testMarkEntries(array $in, ?array $data, ResponseInterface $exp): void {
\Phake::when(Arsse::$db)->articleMark->thenReturn(0);
$this->assertMessage($exp, $this->req("PUT", "/entries", $in));
@ -844,7 +846,7 @@ class TestV1 extends \JKingWeb\Arsse\Test\AbstractTest {
];
}
/** @dataProvider provideMassMarkings */
#[DataProvider("provideMassMarkings")]
public function testMassMarkEntries(string $url, Context $c, $out, ResponseInterface $exp): void {
if ($out instanceof \Exception) {
\Phake::when(Arsse::$db)->articleMark->thenThrow($out);
@ -873,7 +875,7 @@ class TestV1 extends \JKingWeb\Arsse\Test\AbstractTest {
];
}
/** @dataProvider provideBookmarkTogglings */
#[DataProvider("provideBookmarkTogglings")]
public function testToggleABookmark($before, ?bool $after, ResponseInterface $exp): void {
$c = (new Context)->article(2112);
\Phake::when(Arsse::$db)->articleMark->thenReturn(1);
@ -925,7 +927,7 @@ class TestV1 extends \JKingWeb\Arsse\Test\AbstractTest {
$this->assertMessage(HTTP::respEmpty(204), $this->req("PUT", "/feeds/refresh"));
}
/** @dataProvider provideImports */
#[DataProvider("provideImports")]
public function testImport($out, ResponseInterface $exp): void {
$opml = \Phake::mock(OPML::class);
\Phake::when(Arsse::$obj)->get(OPML::class)->thenReturn($opml);

View file

@ -7,9 +7,11 @@ declare(strict_types=1);
namespace JKingWeb\Arsse\TestCase\REST\NextcloudNews\PDO;
/** @covers \JKingWeb\Arsse\REST\NextcloudNews\V1_2<extended>
* @group optional
*/
use PHPUnit\Framework\Attributes\CoversClass;
use PHPUnit\Framework\Attributes\Group;
#[Group("optional")]
#[CoversClass(\JKingWeb\Arsse\REST\NextcloudNews\V1_2::class)]
class TestV1_2 extends \JKingWeb\Arsse\TestCase\REST\NextcloudNews\TestV1_2 {
use \JKingWeb\Arsse\Test\PDOTest;
}

View file

@ -17,9 +17,11 @@ use JKingWeb\Arsse\Context\Context;
use JKingWeb\Arsse\Db\ExceptionInput;
use JKingWeb\Arsse\Db\Transaction;
use JKingWeb\Arsse\REST\NextcloudNews\V1_2;
use PHPUnit\Framework\Attributes\CoversClass;
use PHPUnit\Framework\Attributes\DataProvider;
use Psr\Http\Message\ResponseInterface;
/** @covers \JKingWeb\Arsse\REST\NextcloudNews\V1_2<extended> */
#[CoversClass(\JKingWeb\Arsse\REST\NextcloudNews\V1_2::class)]
class TestV1_2 extends \JKingWeb\Arsse\Test\AbstractTest {
protected $h;
protected $transaction;
@ -337,7 +339,7 @@ class TestV1_2 extends \JKingWeb\Arsse\Test\AbstractTest {
$this->assertMessage($exp, $this->req("GET", "/", "", [], false));
}
/** @dataProvider provideInvalidPaths */
#[DataProvider("provideInvalidPaths")]
public function testRespondToInvalidPaths($path, $method, $code, $allow = null): void {
$exp = HTTP::respEmpty($code, $allow ? ['Allow' => $allow] : []);
$this->assertMessage($exp, $this->req($method, $path));
@ -378,7 +380,7 @@ class TestV1_2 extends \JKingWeb\Arsse\Test\AbstractTest {
$this->assertMessage($exp, $this->req("PUT", "/folders/1", '<data/>', ['Content-Type' => null]));
}
/** @dataProvider provideOptionsRequests */
#[DataProvider("provideOptionsRequests")]
public function testRespondToOptionsRequests(string $url, string $allow, string $accept): void {
$exp = HTTP::respEmpty(204, [
'Allow' => $allow,
@ -409,7 +411,7 @@ class TestV1_2 extends \JKingWeb\Arsse\Test\AbstractTest {
$this->assertMessage($exp, $this->req("GET", "/folders"));
}
/** @dataProvider provideFolderCreations */
#[DataProvider("provideFolderCreations")]
public function testAddAFolder(array $input, bool $body, $output, ResponseInterface $exp): void {
if ($output instanceof ExceptionInput) {
\Phake::when(Arsse::$db)->folderAdd->thenThrow($output);
@ -450,7 +452,7 @@ class TestV1_2 extends \JKingWeb\Arsse\Test\AbstractTest {
\Phake::verify(Arsse::$db, \Phake::times(2))->folderRemove($this->userId, 1);
}
/** @dataProvider provideFolderRenamings */
#[DataProvider("provideFolderRenamings")]
public function testRenameAFolder(array $input, int $id, $output, ResponseInterface $exp): void {
if ($output instanceof ExceptionInput) {
\Phake::when(Arsse::$db)->folderPropertiesSet->thenThrow($output);
@ -500,7 +502,7 @@ class TestV1_2 extends \JKingWeb\Arsse\Test\AbstractTest {
$this->assertMessage($exp, $this->req("GET", "/feeds"));
}
/** @dataProvider provideNewSubscriptions */
#[DataProvider("provideNewSubscriptions")]
public function testAddASubscription(array $input, $id, int $latestEdition, array $output, $moveOutcome, ResponseInterface $exp): void {
if ($id instanceof \Exception) {
\Phake::when(Arsse::$db)->subscriptionAdd->thenThrow($id);
@ -663,7 +665,7 @@ class TestV1_2 extends \JKingWeb\Arsse\Test\AbstractTest {
\Phake::verify(Arsse::$db, \Phake::never())->feedUpdate(\Phake::anyParameters());
}
/** @dataProvider provideArticleQueries */
#[DataProvider("provideArticleQueries")]
public function testListArticles(string $url, array $in, Context $c, $out, ResponseInterface $exp): void {
if ($out instanceof \Exception) {
\Phake::when(Arsse::$db)->articleList->thenThrow($out);

View file

@ -7,9 +7,12 @@ declare(strict_types=1);
namespace JKingWeb\Arsse\TestCase\REST\TinyTinyRSS\PDO;
/** @covers \JKingWeb\Arsse\REST\TinyTinyRSS\API<extended>
* @covers \JKingWeb\Arsse\REST\TinyTinyRSS\Exception
* @group optional */
use PHPUnit\Framework\Attributes\CoversClass;
use PHPUnit\Framework\Attributes\Group;
#[Group("optional")]
#[CoversClass(\JKingWeb\Arsse\REST\TinyTinyRSS\API::class)]
#[CoversClass(\JKingWeb\Arsse\REST\TinyTinyRSS\Exception::class)]
class TestAPI extends \JKingWeb\Arsse\TestCase\REST\TinyTinyRSS\TestAPI {
use \JKingWeb\Arsse\Test\PDOTest;
}

View file

@ -18,10 +18,12 @@ use JKingWeb\Arsse\Db\ExceptionInput;
use JKingWeb\Arsse\Db\Transaction;
use JKingWeb\Arsse\REST\TinyTinyRSS\API;
use JKingWeb\Arsse\Feed\Exception as FeedException;
use PHPUnit\Framework\Attributes\CoversClass;
use PHPUnit\Framework\Attributes\DataProvider;
use Psr\Http\Message\ResponseInterface;
/** @covers \JKingWeb\Arsse\REST\TinyTinyRSS\API<extended>
* @covers \JKingWeb\Arsse\REST\TinyTinyRSS\Exception */
#[CoversClass(\JKingWeb\Arsse\REST\TinyTinyRSS\API::class)]
#[CoversClass(\JKingWeb\Arsse\REST\TinyTinyRSS\Exception::class)]
class TestAPI extends \JKingWeb\Arsse\Test\AbstractTest {
protected const NOW = "2020-12-21T23:09:17.189065Z";
@ -203,7 +205,7 @@ LONG_STRING;
$this->assertMessage($exp, $this->req(null, "POST", "", "")); // lack of data is also an error
}
/** @dataProvider provideLoginRequests */
#[DataProvider("provideLoginRequests")]
public function testLogIn(array $conf, $httpUser, array $data, $sessions): void {
self::$userId = null;
self::setConf($conf);
@ -237,7 +239,7 @@ LONG_STRING;
return self::generateLoginRequests("login");
}
/** @dataProvider provideResumeRequests */
#[DataProvider("provideResumeRequests")]
public function testValidateASession(array $conf, $httpUser, string $data, $result): void {
self::$userId = null;
self::setConf($conf);
@ -589,7 +591,7 @@ LONG_STRING;
$this->assertMessage($exp, $this->req($data));
}
/** @dataProvider provideCategoryAdditions */
#[DataProvider("provideCategoryAdditions")]
public function testAddACategory(array $in, array $data, $out, ResponseInterface $exp): void {
$in = array_merge(['op' => "addCategory", 'sid' => "PriestsOfSyrinx"], $in);
$action = ($out instanceof \Exception) ? "thenThrow" : "thenReturn";
@ -621,7 +623,7 @@ LONG_STRING;
];
}
/** @dataProvider provideCategoryRemovals */
#[DataProvider("provideCategoryRemovals")]
public function testRemoveACategory(array $in, ?int $data, $out, ResponseInterface $exp): void {
$in = array_merge(['op' => "removeCategory", 'sid' => "PriestsOfSyrinx"], $in);
$action = ($out instanceof \Exception) ? "thenThrow" : "thenReturn";
@ -641,7 +643,7 @@ LONG_STRING;
];
}
/** @dataProvider provideCategoryMoves */
#[DataProvider("provideCategoryMoves")]
public function testMoveACategory(array $in, array $data, $out, ResponseInterface $exp): void {
$in = array_merge(['op' => "moveCategory", 'sid' => "PriestsOfSyrinx"], $in);
$action = ($out instanceof \Exception) ? "thenThrow" : "thenReturn";
@ -668,7 +670,7 @@ LONG_STRING;
];
}
/** @dataProvider provideCategoryRenamings */
#[DataProvider("provideCategoryRenamings")]
public function testRenameACategory(array $in, ?array $data, $out, ResponseInterface $exp): void {
$in = array_merge(['op' => "renameCategory", 'sid' => "PriestsOfSyrinx"], $in);
$action = ($out instanceof \Exception) ? "thenThrow" : "thenReturn";
@ -695,7 +697,7 @@ LONG_STRING;
];
}
/** @dataProvider provideFeedSubscriptions */
#[DataProvider("provideFeedSubscriptions")]
public function testAddASubscription(array $in, ?array $data, $out, ResponseInterface $exp): void {
$in = array_merge(['op' => "subscribeToFeed", 'sid' => "PriestsOfSyrinx"], $in);
$action = ($out instanceof \Exception) ? "thenThrow" : "thenReturn";
@ -740,7 +742,7 @@ LONG_STRING;
];
}
/** @dataProvider provideFeedUnsubscriptions */
#[DataProvider("provideFeedUnsubscriptions")]
public function testRemoveASubscription(array $in, ?array $data, $out, ResponseInterface $exp): void {
$in = array_merge(['op' => "unsubscribeFeed", 'sid' => "PriestsOfSyrinx"], $in);
$action = ($out instanceof \Exception) ? "thenThrow" : "thenReturn";
@ -762,7 +764,7 @@ LONG_STRING;
];
}
/** @dataProvider provideFeedMoves */
#[DataProvider("provideFeedMoves")]
public function testMoveAFeed(array $in, ?array $data, $out, ResponseInterface $exp): void {
$in = array_merge(['op' => "moveFeed", 'sid' => "PriestsOfSyrinx"], $in);
$action = ($out instanceof \Exception) ? "thenThrow" : "thenReturn";
@ -789,7 +791,7 @@ LONG_STRING;
];
}
/** @dataProvider provideFeedRenamings */
#[DataProvider("provideFeedRenamings")]
public function testRenameAFeed(array $in, ?array $data, $out, ResponseInterface $exp): void {
$in = array_merge(['op' => "renameFeed", 'sid' => "PriestsOfSyrinx"], $in);
$action = ($out instanceof \Exception) ? "thenThrow" : "thenReturn";
@ -838,7 +840,7 @@ LONG_STRING;
$this->assertMessage(self::respGood(['icons_dir' => "feed-icons", 'icons_url' => "feed-icons", 'daemon_is_running' => false, 'num_feeds' => 2]), $this->req($in));
}
/** @dataProvider provideFeedUpdates */
#[DataProvider("provideFeedUpdates")]
public function testUpdateAFeed(array $in, ?array $data, $out, ?int $id, ResponseInterface $exp): void {
$in = array_merge(['op' => "updateFeed", 'sid' => "PriestsOfSyrinx"], $in);
$action = ($out instanceof \Exception) ? "thenThrow" : "thenReturn";
@ -866,7 +868,7 @@ LONG_STRING;
];
}
/** @dataProvider provideLabelAdditions */
#[DataProvider("provideLabelAdditions")]
public function testAddALabel(array $in, ?array $data1, $out1, ?array $data2, $out2, ResponseInterface $exp): void {
$in = array_merge(['op' => "addLabel", 'sid' => "PriestsOfSyrinx"], $in);
$action = ($out1 instanceof \Exception) ? "thenThrow" : "thenReturn";
@ -897,7 +899,7 @@ LONG_STRING;
];
}
/** @dataProvider provideLabelRemovals */
#[DataProvider("provideLabelRemovals")]
public function testRemoveALabel(array $in, ?array $data, $out, ResponseInterface $exp): void {
$in = array_merge(['op' => "removeLabel", 'sid' => "PriestsOfSyrinx"], $in);
$action = ($out instanceof \Exception) ? "thenThrow" : "thenReturn";
@ -921,7 +923,7 @@ LONG_STRING;
];
}
/** @dataProvider provideLabelRenamings */
#[DataProvider("provideLabelRenamings")]
public function testRenameALabel(array $in, ?array $data, $out, ResponseInterface $exp): void {
$in = array_merge(['op' => "renameLabel", 'sid' => "PriestsOfSyrinx"], $in);
$action = ($out instanceof \Exception) ? "thenThrow" : "thenReturn";
@ -949,7 +951,7 @@ LONG_STRING;
];
}
/** @dataProvider provideCategoryListings */
#[DataProvider("provideCategoryListings")]
public function testRetrieveCategoryLists(array $in, ResponseInterface $exp): void {
$in = array_merge(['op' => "getCategories", 'sid' => "PriestsOfSyrinx"], $in);
\Phake::when(Arsse::$db)->folderList($this->anything(), null, true)->thenReturn(new Result(self::v($this->folders)));
@ -1060,7 +1062,7 @@ LONG_STRING;
\Phake::verify(Arsse::$db)->articleCount(self::$userId, $this->equalTo((new Context)->hidden(false)->unread(true)->modifiedRange(Date::sub("PT24H", self::NOW), null)));
}
/** @dataProvider provideLabelListings */
#[DataProvider("provideLabelListings")]
public function testRetrieveTheLabelList(array $in, ResponseInterface $exp): void {
$in = array_merge(['op' => "getLabels", 'sid' => "PriestsOfSyrinx"], $in);
\Phake::when(Arsse::$db)->labelList->thenReturn(new Result(self::v($this->labels)));
@ -1121,7 +1123,7 @@ LONG_STRING;
];
}
/** @dataProvider provideLabelAssignments */
#[DataProvider("provideLabelAssignments")]
public function testAssignArticlesToALabel(array $in, ?int $label, ?int $operation, ResponseInterface $exp): void {
$in = array_merge(['op' => "setArticleLabel", 'sid' => "PriestsOfSyrinx"], $in);
\Phake::when(Arsse::$db)->labelArticlesSet(self::$userId, $this->anything(), $this->anything(), Database::ASSOC_REMOVE)->thenReturn(42)->thenReturn(47);
@ -1152,7 +1154,7 @@ LONG_STRING;
\Phake::verify(Arsse::$db, \Phake::times(2))->articleCount(self::$userId, $this->equalTo((new Context)->hidden(false)->unread(true)->modifiedRange(Date::sub("PT24H", self::NOW), null)));
}
/** @dataProvider provideMassMarkings */
#[DataProvider("provideMassMarkings")]
public function testMarkFeedsAsRead(array $in, ?Context $c): void {
$base = ['op' => "catchupFeed", 'sid' => "PriestsOfSyrinx"];
$in = array_merge($base, $in);
@ -1194,7 +1196,7 @@ LONG_STRING;
];
}
/** @dataProvider provideFeedListings */
#[DataProvider("provideFeedListings")]
public function testRetrieveFeedList(array $in, ResponseInterface $exp): void {
$in = array_merge(['op' => "getFeeds", 'sid' => "PriestsOfSyrinx"], $in);
// statistical mocks
@ -1353,7 +1355,7 @@ LONG_STRING;
];
}
/** @dataProvider provideArticleChanges */
#[DataProvider("provideArticleChanges")]
public function testChangeArticles(array $in, ResponseInterface $exp): void {
$in = array_merge(['op' => "updateArticle", 'sid' => "PriestsOfSyrinx"], $in);
\Phake::when(Arsse::$db)->articleMark->thenReturn(1);
@ -1404,7 +1406,7 @@ LONG_STRING;
];
}
/** @dataProvider provideArticleListings */
#[DataProvider("provideArticleListings")]
public function testListArticles(array $in, ResponseInterface $exp): void {
$in = array_merge(['op' => "getArticle", 'sid' => "PriestsOfSyrinx"], $in);
\Phake::when(Arsse::$db)->labelList($this->anything())->thenReturn(new Result(self::v($this->labels)));
@ -1485,7 +1487,7 @@ LONG_STRING;
];
}
/** @dataProvider provideArticleListingsWithoutLabels */
#[DataProvider("provideArticleListingsWithoutLabels")]
public function testListArticlesWithoutLabels(array $in, ResponseInterface $exp): void {
$in = array_merge(['op' => "getArticle", 'sid' => "PriestsOfSyrinx"], $in);
\Phake::when(Arsse::$db)->labelList($this->anything())->thenReturn(new Result([]));
@ -1563,7 +1565,7 @@ LONG_STRING;
];
}
/** @dataProvider provideHeadlines */
#[DataProvider("provideHeadlines")]
public function testRetrieveHeadlines(bool $full, array $in, $out, Context $c, array $fields, array $order, ResponseInterface $exp): void {
$base = ['op' => $full ? "getHeadlines" : "getCompactHeadlines", 'sid' => "PriestsOfSyrinx"];
$in = array_merge($base, $in);

View file

@ -13,9 +13,10 @@ use JKingWeb\Arsse\Database;
use JKingWeb\Arsse\Misc\HTTP;
use JKingWeb\Arsse\Db\ExceptionInput;
use JKingWeb\Arsse\REST\TinyTinyRSS\Icon;
use PHPUnit\Framework\Attributes\CoversClass;
use Psr\Http\Message\ResponseInterface;
/** @covers \JKingWeb\Arsse\REST\TinyTinyRSS\Icon<extended> */
#[CoversClass(\JKingWeb\Arsse\REST\TinyTinyRSS\Icon::class)]
class TestIcon extends \JKingWeb\Arsse\Test\AbstractTest {
protected $h;
protected $user = "john.doe@example.com";

View file

@ -25,9 +25,9 @@ use Psr\Http\Message\RequestInterface;
use Psr\Http\Message\ServerRequestInterface;
use Psr\Http\Message\ResponseInterface;
use GuzzleHttp\Psr7\ServerRequest;
use PHPUnit\Framework\Attributes\CoversNothing;
use PHPUnit\Framework\Attributes\CoversClass;
#[CoversNothing]
#[CoversClass(Database::class)]
abstract class AbstractTest extends \PHPUnit\Framework\TestCase {
public function setUp(): void {
self::clearData();

View file

@ -1,154 +1,150 @@
<?xml version="1.0"?>
<phpunit
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:noNamespaceSchemaLocation="https://schema.phpunit.de/9.3/phpunit.xsd"
colors="true"
bootstrap="bootstrap.php"
convertErrorsToExceptions="false"
convertNoticesToExceptions="false"
convertWarningsToExceptions="false"
beStrictAboutTestsThatDoNotTestAnything="true"
beStrictAboutOutputDuringTests="true"
forceCoversAnnotation="true"
executionOrder="defects"
<phpunit
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:noNamespaceSchemaLocation="https://schema.phpunit.de/11.5/phpunit.xsd"
colors="true"
bootstrap="bootstrap.php"
beStrictAboutTestsThatDoNotTestAnything="true"
beStrictAboutOutputDuringTests="true"
executionOrder="defects"
cacheDirectory=".phpunit.cache"
requireCoverageMetadata="true"
>
<php>
<env name="ARSSE_TEST_PGSQL_HOST" value=""/>
<env name="ARSSE_TEST_PGSQL_PORT" value="5432"/>
<env name="ARSSE_TEST_PGSQL_USER" value="arsse_test"/>
<env name="ARSSE_TEST_PGSQL_PASS" value="arsse_test"/>
<env name="ARSSE_TEST_PGSQL_DB" value="arsse_test"/>
<php>
<env name="ARSSE_TEST_PGSQL_HOST" value=""/>
<env name="ARSSE_TEST_PGSQL_PORT" value="5432"/>
<env name="ARSSE_TEST_PGSQL_USER" value="arsse_test"/>
<env name="ARSSE_TEST_PGSQL_PASS" value="arsse_test"/>
<env name="ARSSE_TEST_PGSQL_DB" value="arsse_test"/>
<env name="ARSSE_TEST_PGSQL_SCHEMA" value="arsse_test"/>
<env name="ARSSE_TEST_MYSQL_HOST" value="localhost"/>
<env name="ARSSE_TEST_MYSQL_PORT" value="3306"/>
<env name="ARSSE_TEST_MYSQL_USER" value="arsse_test"/>
<env name="ARSSE_TEST_MYSQL_PASS" value="arsse_test"/>
<env name="ARSSE_TEST_MYSQL_DB" value="arsse_test"/>
</php>
<coverage processUncoveredFiles="true">
<env name="ARSSE_TEST_MYSQL_HOST" value="localhost"/>
<env name="ARSSE_TEST_MYSQL_PORT" value="3306"/>
<env name="ARSSE_TEST_MYSQL_USER" value="arsse_test"/>
<env name="ARSSE_TEST_MYSQL_PASS" value="arsse_test"/>
<env name="ARSSE_TEST_MYSQL_DB" value="arsse_test"/>
</php>
<source>
<include>
<directory suffix=".php">../lib</directory>
<directory suffix=".php">../lib</directory>
</include>
</coverage>
<testsuites>
</source>
<testsuites>
<testsuite name="Exceptions">
<file>cases/Exception/TestException.php</file>
<file>cases/Exception/TestException.php</file>
</testsuite>
<testsuite name="Localization">
<file>cases/Lang/TestBasic.php</file>
<file>cases/Lang/TestComplex.php</file>
<file>cases/Lang/TestErrors.php</file>
<file>cases/Lang/TestBasic.php</file>
<file>cases/Lang/TestComplex.php</file>
<file>cases/Lang/TestErrors.php</file>
</testsuite>
<testsuite name="Configuration">
<file>cases/Conf/TestConf.php</file>
<file>cases/Conf/TestConf.php</file>
</testsuite>
<testsuite name="Sundry">
<file>cases/Misc/TestFactory.php</file>
<file>cases/Misc/TestValueInfo.php</file>
<file>cases/Misc/TestDate.php</file>
<file>cases/Misc/TestQuery.php</file>
<file>cases/Misc/TestContext.php</file>
<file>cases/Misc/TestURL.php</file>
<file>cases/Misc/TestHTTP.php</file>
<file>cases/Misc/TestRule.php</file>
<file>cases/Misc/TestFactory.php</file>
<file>cases/Misc/TestValueInfo.php</file>
<file>cases/Misc/TestDate.php</file>
<file>cases/Misc/TestQuery.php</file>
<file>cases/Misc/TestContext.php</file>
<file>cases/Misc/TestURL.php</file>
<file>cases/Misc/TestHTTP.php</file>
<file>cases/Misc/TestRule.php</file>
</testsuite>
<testsuite name="User management">
<file>cases/User/TestInternal.php</file>
<file>cases/User/TestUser.php</file>
<file>cases/User/TestInternal.php</file>
<file>cases/User/TestUser.php</file>
</testsuite>
<testsuite name="Feed parser">
<file>cases/Feed/TestException.php</file>
<file>cases/Feed/TestFetching.php</file>
<file>cases/Feed/TestFeed.php</file>
<file>cases/Feed/TestException.php</file>
<file>cases/Feed/TestFetching.php</file>
<file>cases/Feed/TestFeed.php</file>
</testsuite>
<testsuite name="Database interface">
<file>cases/Db/TestTransaction.php</file>
<file>cases/Db/TestResultAggregate.php</file>
<file>cases/Db/TestResultEmpty.php</file>
<file>cases/Database/TestDatabase.php</file>
<file>cases/Db/TestTransaction.php</file>
<file>cases/Db/TestResultAggregate.php</file>
<file>cases/Db/TestResultEmpty.php</file>
<file>cases/Database/TestDatabase.php</file>
</testsuite>
<testsuite name="SQLite">
<file>cases/Db/SQLite3/TestResult.php</file>
<file>cases/Db/SQLite3/TestStatement.php</file>
<file>cases/Db/SQLite3/TestCreation.php</file>
<file>cases/Db/SQLite3/TestDriver.php</file>
<file>cases/Db/SQLite3/TestUpdate.php</file>
<file>cases/Db/SQLite3/TestDatabase.php</file>
<file>cases/Db/SQLite3PDO/TestResult.php</file>
<file>cases/Db/SQLite3PDO/TestStatement.php</file>
<file>cases/Db/SQLite3PDO/TestCreation.php</file>
<file>cases/Db/SQLite3PDO/TestDriver.php</file>
<file>cases/Db/SQLite3PDO/TestUpdate.php</file>
<file>cases/Db/SQLite3PDO/TestDatabase.php</file>
<file>cases/Db/SQLite3/TestResult.php</file>
<file>cases/Db/SQLite3/TestStatement.php</file>
<file>cases/Db/SQLite3/TestCreation.php</file>
<file>cases/Db/SQLite3/TestDriver.php</file>
<file>cases/Db/SQLite3/TestUpdate.php</file>
<file>cases/Db/SQLite3/TestDatabase.php</file>
<file>cases/Db/SQLite3PDO/TestResult.php</file>
<file>cases/Db/SQLite3PDO/TestStatement.php</file>
<file>cases/Db/SQLite3PDO/TestCreation.php</file>
<file>cases/Db/SQLite3PDO/TestDriver.php</file>
<file>cases/Db/SQLite3PDO/TestUpdate.php</file>
<file>cases/Db/SQLite3PDO/TestDatabase.php</file>
</testsuite>
<testsuite name="PostgreSQL">
<file>cases/Db/PostgreSQL/TestResult.php</file>
<file>cases/Db/PostgreSQL/TestStatement.php</file>
<file>cases/Db/PostgreSQL/TestCreation.php</file>
<file>cases/Db/PostgreSQL/TestDriver.php</file>
<file>cases/Db/PostgreSQL/TestUpdate.php</file>
<file>cases/Db/PostgreSQL/TestDatabase.php</file>
<file>cases/Db/PostgreSQLPDO/TestResult.php</file>
<file>cases/Db/PostgreSQLPDO/TestStatement.php</file>
<file>cases/Db/PostgreSQLPDO/TestCreation.php</file>
<file>cases/Db/PostgreSQLPDO/TestDriver.php</file>
<file>cases/Db/PostgreSQLPDO/TestUpdate.php</file>
<file>cases/Db/PostgreSQLPDO/TestDatabase.php</file>
<file>cases/Db/PostgreSQL/TestResult.php</file>
<file>cases/Db/PostgreSQL/TestStatement.php</file>
<file>cases/Db/PostgreSQL/TestCreation.php</file>
<file>cases/Db/PostgreSQL/TestDriver.php</file>
<file>cases/Db/PostgreSQL/TestUpdate.php</file>
<file>cases/Db/PostgreSQL/TestDatabase.php</file>
<file>cases/Db/PostgreSQLPDO/TestResult.php</file>
<file>cases/Db/PostgreSQLPDO/TestStatement.php</file>
<file>cases/Db/PostgreSQLPDO/TestCreation.php</file>
<file>cases/Db/PostgreSQLPDO/TestDriver.php</file>
<file>cases/Db/PostgreSQLPDO/TestUpdate.php</file>
<file>cases/Db/PostgreSQLPDO/TestDatabase.php</file>
</testsuite>
<testsuite name="MySQL">
<file>cases/Db/MySQL/TestResult.php</file>
<file>cases/Db/MySQL/TestStatement.php</file>
<file>cases/Db/MySQL/TestCreation.php</file>
<file>cases/Db/MySQL/TestDriver.php</file>
<file>cases/Db/MySQL/TestUpdate.php</file>
<file>cases/Db/MySQL/TestDatabase.php</file>
<file>cases/Db/MySQLPDO/TestResult.php</file>
<file>cases/Db/MySQLPDO/TestStatement.php</file>
<file>cases/Db/MySQLPDO/TestCreation.php</file>
<file>cases/Db/MySQLPDO/TestDriver.php</file>
<file>cases/Db/MySQLPDO/TestUpdate.php</file>
<file>cases/Db/MySQLPDO/TestDatabase.php</file>
<file>cases/Db/MySQL/TestResult.php</file>
<file>cases/Db/MySQL/TestStatement.php</file>
<file>cases/Db/MySQL/TestCreation.php</file>
<file>cases/Db/MySQL/TestDriver.php</file>
<file>cases/Db/MySQL/TestUpdate.php</file>
<file>cases/Db/MySQL/TestDatabase.php</file>
<file>cases/Db/MySQLPDO/TestResult.php</file>
<file>cases/Db/MySQLPDO/TestStatement.php</file>
<file>cases/Db/MySQLPDO/TestCreation.php</file>
<file>cases/Db/MySQLPDO/TestDriver.php</file>
<file>cases/Db/MySQLPDO/TestUpdate.php</file>
<file>cases/Db/MySQLPDO/TestDatabase.php</file>
</testsuite>
<testsuite name="REST">
<file>cases/REST/TestREST.php</file>
<file>cases/REST/TestREST.php</file>
</testsuite>
<testsuite name="Miniflux">
<file>cases/REST/Miniflux/TestStatus.php</file>
<file>cases/REST/Miniflux/TestV1.php</file>
<file>cases/REST/Miniflux/TestToken.php</file>
<file>cases/REST/Miniflux/PDO/TestV1.php</file>
<file>cases/REST/Miniflux/PDO/TestToken.php</file>
<file>cases/REST/Miniflux/TestStatus.php</file>
<file>cases/REST/Miniflux/TestV1.php</file>
<file>cases/REST/Miniflux/TestToken.php</file>
<file>cases/REST/Miniflux/PDO/TestV1.php</file>
<file>cases/REST/Miniflux/PDO/TestToken.php</file>
</testsuite>
<testsuite name="NCNv1">
<file>cases/REST/NextcloudNews/TestVersions.php</file>
<file>cases/REST/NextcloudNews/TestV1_2.php</file>
<file>cases/REST/NextcloudNews/PDO/TestV1_2.php</file>
<file>cases/REST/NextcloudNews/TestVersions.php</file>
<file>cases/REST/NextcloudNews/TestV1_2.php</file>
<file>cases/REST/NextcloudNews/PDO/TestV1_2.php</file>
</testsuite>
<testsuite name="TTRSS">
<file>cases/REST/TinyTinyRSS/TestSearch.php</file>
<file>cases/REST/TinyTinyRSS/TestAPI.php</file>
<file>cases/REST/TinyTinyRSS/TestIcon.php</file>
<file>cases/REST/TinyTinyRSS/PDO/TestAPI.php</file>
<file>cases/REST/TinyTinyRSS/TestSearch.php</file>
<file>cases/REST/TinyTinyRSS/TestAPI.php</file>
<file>cases/REST/TinyTinyRSS/TestIcon.php</file>
<file>cases/REST/TinyTinyRSS/PDO/TestAPI.php</file>
</testsuite>
<testsuite name="Fever">
<file>cases/REST/Fever/TestUser.php</file>
<file>cases/REST/Fever/TestAPI.php</file>
<file>cases/REST/Fever/PDO/TestAPI.php</file>
<file>cases/REST/Fever/TestUser.php</file>
<file>cases/REST/Fever/TestAPI.php</file>
<file>cases/REST/Fever/PDO/TestAPI.php</file>
</testsuite>
<testsuite name="Admin tools">
<file>cases/Service/TestService.php</file>
<file>cases/Service/TestSerial.php</file>
<file>cases/Service/TestSubprocess.php</file>
<file>cases/Service/TestDaemon.php</file>
<file>cases/CLI/TestCLI.php</file>
<file>cases/TestArsse.php</file>
<file>cases/Service/TestService.php</file>
<file>cases/Service/TestSerial.php</file>
<file>cases/Service/TestSubprocess.php</file>
<file>cases/Service/TestDaemon.php</file>
<file>cases/CLI/TestCLI.php</file>
<file>cases/TestArsse.php</file>
</testsuite>
<testsuite name="Import/Export">
<file>cases/ImportExport/TestFile.php</file>
<file>cases/ImportExport/TestImportExport.php</file>
<file>cases/ImportExport/TestOPML.php</file>
<file>cases/ImportExport/TestFile.php</file>
<file>cases/ImportExport/TestImportExport.php</file>
<file>cases/ImportExport/TestOPML.php</file>
</testsuite>
</testsuites>
</testsuites>
</phpunit>