mirror of
https://code.mensbeam.com/MensBeam/Arsse.git
synced 2024-12-22 21:22:40 +00:00
parent
b3c65bcdbd
commit
4066bba05e
15 changed files with 105 additions and 14 deletions
|
@ -328,11 +328,11 @@ class Database {
|
||||||
|
|
||||||
protected function folderValidateId(string $user, int $id = null, int $parent = null, bool $subject = false): array {
|
protected function folderValidateId(string $user, int $id = null, int $parent = null, bool $subject = false): array {
|
||||||
if(is_null($id)) {
|
if(is_null($id)) {
|
||||||
// if no ID is specified this is a no-op, unless a parent is specified, which is always a circular dependence
|
// if no ID is specified this is a no-op, unless a parent is specified, which is always a circular dependence (the root cannot be moved)
|
||||||
if(!is_null($parent)) {
|
if(!is_null($parent)) {
|
||||||
throw new Db\ExceptionInput("circularDependence", ["action" => $this->caller(), "field" => "parent", 'id' => $parent]);
|
throw new Db\ExceptionInput("circularDependence", ["action" => $this->caller(), "field" => "parent", 'id' => $parent]); // @codeCoverageIgnore
|
||||||
}
|
}
|
||||||
return [name => null, parent => null];
|
return ['name' => null, 'parent' => null];
|
||||||
}
|
}
|
||||||
// check whether the folder exists and is owned by the user
|
// check whether the folder exists and is owned by the user
|
||||||
$f = $this->db->prepare("SELECT name,parent from arsse_folders where owner is ? and id is ?", "str", "int")->run($user, $id)->getRow();
|
$f = $this->db->prepare("SELECT name,parent from arsse_folders where owner is ? and id is ?", "str", "int")->run($user, $id)->getRow();
|
||||||
|
|
|
@ -2,7 +2,7 @@
|
||||||
declare(strict_types=1);
|
declare(strict_types=1);
|
||||||
namespace JKingWeb\Arsse;
|
namespace JKingWeb\Arsse;
|
||||||
|
|
||||||
/** @covers \JKingWeb\Arsse\Database */
|
/** @covers \JKingWeb\Arsse\Database<extended> */
|
||||||
class TestDatabaseArticleSQLite3 extends Test\AbstractTest {
|
class TestDatabaseArticleSQLite3 extends Test\AbstractTest {
|
||||||
use Test\Database\Setup;
|
use Test\Database\Setup;
|
||||||
use Test\Database\DriverSQLite3;
|
use Test\Database\DriverSQLite3;
|
||||||
|
|
|
@ -2,7 +2,7 @@
|
||||||
declare(strict_types=1);
|
declare(strict_types=1);
|
||||||
namespace JKingWeb\Arsse;
|
namespace JKingWeb\Arsse;
|
||||||
|
|
||||||
/** @covers \JKingWeb\Arsse\Database */
|
/** @covers \JKingWeb\Arsse\Database<extended> */
|
||||||
class TestDatabaseFeedSQLite3 extends Test\AbstractTest {
|
class TestDatabaseFeedSQLite3 extends Test\AbstractTest {
|
||||||
use Test\Database\Setup;
|
use Test\Database\Setup;
|
||||||
use Test\Database\DriverSQLite3;
|
use Test\Database\DriverSQLite3;
|
||||||
|
|
|
@ -2,7 +2,7 @@
|
||||||
declare(strict_types=1);
|
declare(strict_types=1);
|
||||||
namespace JKingWeb\Arsse;
|
namespace JKingWeb\Arsse;
|
||||||
|
|
||||||
/** @covers \JKingWeb\Arsse\Database */
|
/** @covers \JKingWeb\Arsse\Database<extended> */
|
||||||
class TestDatabaseFolderSQLite3 extends Test\AbstractTest {
|
class TestDatabaseFolderSQLite3 extends Test\AbstractTest {
|
||||||
use Test\Database\Setup;
|
use Test\Database\Setup;
|
||||||
use Test\Database\DriverSQLite3;
|
use Test\Database\DriverSQLite3;
|
||||||
|
|
|
@ -2,7 +2,7 @@
|
||||||
declare(strict_types=1);
|
declare(strict_types=1);
|
||||||
namespace JKingWeb\Arsse;
|
namespace JKingWeb\Arsse;
|
||||||
|
|
||||||
/** @covers \JKingWeb\Arsse\Database */
|
/** @covers \JKingWeb\Arsse\Database<extended> */
|
||||||
class TestDatabaseMetaSQLite3 extends Test\AbstractTest {
|
class TestDatabaseMetaSQLite3 extends Test\AbstractTest {
|
||||||
use Test\Database\Setup;
|
use Test\Database\Setup;
|
||||||
use Test\Database\DriverSQLite3;
|
use Test\Database\DriverSQLite3;
|
||||||
|
|
10
tests/Db/SQLite3/Database/TestDatabaseMiscellanySQLite3.php
Normal file
10
tests/Db/SQLite3/Database/TestDatabaseMiscellanySQLite3.php
Normal file
|
@ -0,0 +1,10 @@
|
||||||
|
<?php
|
||||||
|
declare(strict_types=1);
|
||||||
|
namespace JKingWeb\Arsse;
|
||||||
|
|
||||||
|
/** @covers \JKingWeb\Arsse\Database<extended> */
|
||||||
|
class TestDatabaseMiscellanySQLite3 extends Test\AbstractTest {
|
||||||
|
use Test\Database\Setup;
|
||||||
|
use Test\Database\DriverSQLite3;
|
||||||
|
use Test\Database\SeriesMiscellany;
|
||||||
|
}
|
|
@ -2,7 +2,7 @@
|
||||||
declare(strict_types=1);
|
declare(strict_types=1);
|
||||||
namespace JKingWeb\Arsse;
|
namespace JKingWeb\Arsse;
|
||||||
|
|
||||||
/** @covers \JKingWeb\Arsse\Database */
|
/** @covers \JKingWeb\Arsse\Database<extended> */
|
||||||
class TestDatabaseSubscriptionSQLite3 extends Test\AbstractTest {
|
class TestDatabaseSubscriptionSQLite3 extends Test\AbstractTest {
|
||||||
use Test\Database\Setup;
|
use Test\Database\Setup;
|
||||||
use Test\Database\DriverSQLite3;
|
use Test\Database\DriverSQLite3;
|
||||||
|
|
|
@ -2,7 +2,7 @@
|
||||||
declare(strict_types=1);
|
declare(strict_types=1);
|
||||||
namespace JKingWeb\Arsse;
|
namespace JKingWeb\Arsse;
|
||||||
|
|
||||||
/** @covers \JKingWeb\Arsse\Database */
|
/** @covers \JKingWeb\Arsse\Database<extended> */
|
||||||
class TestDatabaseUserSQLite3 extends Test\AbstractTest {
|
class TestDatabaseUserSQLite3 extends Test\AbstractTest {
|
||||||
use Test\Database\Setup;
|
use Test\Database\Setup;
|
||||||
use Test\Database\DriverSQLite3;
|
use Test\Database\DriverSQLite3;
|
||||||
|
|
|
@ -18,6 +18,8 @@
|
||||||
</item>
|
</item>
|
||||||
<item>
|
<item>
|
||||||
<dc:identifier>urn:uuid:43fb1908-42ec-11e7-b61b-2b118faca2f2</dc:identifier> <!-- Correct ID -->
|
<dc:identifier>urn:uuid:43fb1908-42ec-11e7-b61b-2b118faca2f2</dc:identifier> <!-- Correct ID -->
|
||||||
|
<enclosure url="http://example.com/svg" type="image/svg"/>
|
||||||
|
<category>HLN</category>
|
||||||
</item>
|
</item>
|
||||||
<item>
|
<item>
|
||||||
<link>http://example.com/2</link>
|
<link>http://example.com/2</link>
|
||||||
|
|
|
@ -87,6 +87,7 @@ trait SeriesFeed {
|
||||||
[4,1,'http://example.com/4','Article title 4','','2000-01-04 00:00:00','2000-01-04 00:00:00','<p>Article content 4</p>','804e517d623390e71497982c77cf6823180342ebcd2e7d5e32da1e55b09dd180','f3615c7f16336d3ea242d35cf3fc17dbc4ee3afb78376bf49da2dd7a5a25dec8','f11c2b4046f207579aeb9c69a8c20ca5461cef49756ccfa5ba5e2344266da3b3','ab2da63276acce431250b18d3d49b988b226a99c7faadf275c90b751aee05be9',$past],
|
[4,1,'http://example.com/4','Article title 4','','2000-01-04 00:00:00','2000-01-04 00:00:00','<p>Article content 4</p>','804e517d623390e71497982c77cf6823180342ebcd2e7d5e32da1e55b09dd180','f3615c7f16336d3ea242d35cf3fc17dbc4ee3afb78376bf49da2dd7a5a25dec8','f11c2b4046f207579aeb9c69a8c20ca5461cef49756ccfa5ba5e2344266da3b3','ab2da63276acce431250b18d3d49b988b226a99c7faadf275c90b751aee05be9',$past],
|
||||||
[5,1,'http://example.com/5','Article title 5','','2000-01-05 00:00:00','2000-01-05 00:00:00','<p>Article content 5</p>','db3e736c2c492f5def5c5da33ddcbea1824040e9ced2142069276b0a6e291a41','d40da96e39eea6c55948ccbe9b3d275b5f931298288dbe953990c5f496097022','834240f84501b5341d375414718204ec421561f3825d34c22bf9182203e42900','43b970ac6ec5f8a9647b2c7e4eed8b1d7f62e154a95eed748b0294c1256764ba',$past],
|
[5,1,'http://example.com/5','Article title 5','','2000-01-05 00:00:00','2000-01-05 00:00:00','<p>Article content 5</p>','db3e736c2c492f5def5c5da33ddcbea1824040e9ced2142069276b0a6e291a41','d40da96e39eea6c55948ccbe9b3d275b5f931298288dbe953990c5f496097022','834240f84501b5341d375414718204ec421561f3825d34c22bf9182203e42900','43b970ac6ec5f8a9647b2c7e4eed8b1d7f62e154a95eed748b0294c1256764ba',$past],
|
||||||
[6,2,'http://example.com/1','Article title 1','','2000-01-01 00:00:00','2000-01-01 00:00:00','<p>Article content 1</p>','e433653cef2e572eee4215fa299a4a5af9137b2cefd6283c85bd69a32915beda','f5cb8bfc1c7396dc9816af212a3e2ac5221585c2a00bf7ccb6aabd95dcfcd6a6','fb0bc8f8cb08913dc5a497db700e327f1d34e4987402687d494a5891f24714d4','18fdd4fa93d693128c43b004399e5c9cea6c261ddfa002518d3669f55d8c2207',$past],
|
[6,2,'http://example.com/1','Article title 1','','2000-01-01 00:00:00','2000-01-01 00:00:00','<p>Article content 1</p>','e433653cef2e572eee4215fa299a4a5af9137b2cefd6283c85bd69a32915beda','f5cb8bfc1c7396dc9816af212a3e2ac5221585c2a00bf7ccb6aabd95dcfcd6a6','fb0bc8f8cb08913dc5a497db700e327f1d34e4987402687d494a5891f24714d4','18fdd4fa93d693128c43b004399e5c9cea6c261ddfa002518d3669f55d8c2207',$past],
|
||||||
|
[7,5,'' ,'' ,'','2000-01-01 00:00:00','2000-01-01 00:00:00','' ,'205e986f4f8b3acfa281227beadb14f5e8c32c8dae4737f888c94c0df49c56f8','' ,'' ,'' ,$past],
|
||||||
]
|
]
|
||||||
],
|
],
|
||||||
'arsse_editions' => [
|
'arsse_editions' => [
|
||||||
|
@ -125,17 +126,21 @@ trait SeriesFeed {
|
||||||
],
|
],
|
||||||
'arsse_enclosures' => [
|
'arsse_enclosures' => [
|
||||||
'columns' => [
|
'columns' => [
|
||||||
|
'article' => "int",
|
||||||
'url' => "str",
|
'url' => "str",
|
||||||
'type' => "str",
|
'type' => "str",
|
||||||
],
|
],
|
||||||
'rows' => [
|
'rows' => [
|
||||||
|
[7,'http://example.com/png','image/png'],
|
||||||
]
|
]
|
||||||
],
|
],
|
||||||
'arsse_categories' => [
|
'arsse_categories' => [
|
||||||
'columns' => [
|
'columns' => [
|
||||||
|
'article' => "int",
|
||||||
'name' => "str",
|
'name' => "str",
|
||||||
],
|
],
|
||||||
'rows' => [
|
'rows' => [
|
||||||
|
[7,'Syrinx']
|
||||||
]
|
]
|
||||||
],
|
],
|
||||||
];
|
];
|
||||||
|
@ -167,9 +172,9 @@ trait SeriesFeed {
|
||||||
]);
|
]);
|
||||||
$state['arsse_articles']['rows'][2] = [3,1,'http://example.com/3','Article title 3 (updated)','','2000-01-03 00:00:00','2000-01-03 00:00:00','<p>Article content 3</p>','31a6594500a48b59fcc8a075ce82b946c9c3c782460d088bd7b8ef3ede97ad92','6cc99be662ef3486fef35a890123f18d74c29a32d714802d743c5b4ef713315a','b278380e984cefe63f0e412b88ffc9cb0befdfa06fdc00bace1da99a8daff406','d5faccc13bf8267850a1e8e61f95950a0f34167df2c8c58011c0aaa6367026ac',$now];
|
$state['arsse_articles']['rows'][2] = [3,1,'http://example.com/3','Article title 3 (updated)','','2000-01-03 00:00:00','2000-01-03 00:00:00','<p>Article content 3</p>','31a6594500a48b59fcc8a075ce82b946c9c3c782460d088bd7b8ef3ede97ad92','6cc99be662ef3486fef35a890123f18d74c29a32d714802d743c5b4ef713315a','b278380e984cefe63f0e412b88ffc9cb0befdfa06fdc00bace1da99a8daff406','d5faccc13bf8267850a1e8e61f95950a0f34167df2c8c58011c0aaa6367026ac',$now];
|
||||||
$state['arsse_articles']['rows'][3] = [4,1,'http://example.com/4','Article title 4','','2000-01-04 00:00:00','2000-01-04 00:00:01','<p>Article content 4</p>','804e517d623390e71497982c77cf6823180342ebcd2e7d5e32da1e55b09dd180','f3615c7f16336d3ea242d35cf3fc17dbc4ee3afb78376bf49da2dd7a5a25dec8','f11c2b4046f207579aeb9c69a8c20ca5461cef49756ccfa5ba5e2344266da3b3','ab2da63276acce431250b18d3d49b988b226a99c7faadf275c90b751aee05be9',$now];
|
$state['arsse_articles']['rows'][3] = [4,1,'http://example.com/4','Article title 4','','2000-01-04 00:00:00','2000-01-04 00:00:01','<p>Article content 4</p>','804e517d623390e71497982c77cf6823180342ebcd2e7d5e32da1e55b09dd180','f3615c7f16336d3ea242d35cf3fc17dbc4ee3afb78376bf49da2dd7a5a25dec8','f11c2b4046f207579aeb9c69a8c20ca5461cef49756ccfa5ba5e2344266da3b3','ab2da63276acce431250b18d3d49b988b226a99c7faadf275c90b751aee05be9',$now];
|
||||||
$state['arsse_articles']['rows'][] = [7,1,'http://example.com/6','Article title 6','','2000-01-06 00:00:00','2000-01-06 00:00:00','<p>Article content 6</p>','b3461ab8e8759eeb1d65a818c65051ec00c1dfbbb32a3c8f6999434e3e3b76ab','91d051a8e6749d014506848acd45e959af50bf876427c4f0e3a1ec0f04777b51','211d78b1a040d40d17e747a363cc283f58767b2e502630d8de9b8f1d5e941d18','5ed68ccb64243b8c1931241d2c9276274c3b1d87f223634aa7a1ab0141292ca7',$now];
|
$state['arsse_articles']['rows'][] = [8,1,'http://example.com/6','Article title 6','','2000-01-06 00:00:00','2000-01-06 00:00:00','<p>Article content 6</p>','b3461ab8e8759eeb1d65a818c65051ec00c1dfbbb32a3c8f6999434e3e3b76ab','91d051a8e6749d014506848acd45e959af50bf876427c4f0e3a1ec0f04777b51','211d78b1a040d40d17e747a363cc283f58767b2e502630d8de9b8f1d5e941d18','5ed68ccb64243b8c1931241d2c9276274c3b1d87f223634aa7a1ab0141292ca7',$now];
|
||||||
$state['arsse_editions']['rows'] = array_merge($state['arsse_editions']['rows'], [
|
$state['arsse_editions']['rows'] = array_merge($state['arsse_editions']['rows'], [
|
||||||
[6,7,$now],
|
[6,8,$now],
|
||||||
[7,3,$now],
|
[7,3,$now],
|
||||||
[8,4,$now],
|
[8,4,$now],
|
||||||
]);
|
]);
|
||||||
|
@ -194,6 +199,11 @@ trait SeriesFeed {
|
||||||
$this->compareExpectations($state);
|
$this->compareExpectations($state);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function testUpdateAMissingFeed() {
|
||||||
|
$this->assertException("subjectMissing", "Db", "ExceptionInput");
|
||||||
|
Arsse::$db->feedUpdate(2112);
|
||||||
|
}
|
||||||
|
|
||||||
function testUpdateAFeedThrowingExceptions() {
|
function testUpdateAFeedThrowingExceptions() {
|
||||||
$this->assertException("invalidUrl", "Feed");
|
$this->assertException("invalidUrl", "Feed");
|
||||||
Arsse::$db->feedUpdate(3, true);
|
Arsse::$db->feedUpdate(3, true);
|
||||||
|
@ -205,13 +215,17 @@ trait SeriesFeed {
|
||||||
'arsse_enclosures' => ["url","type"],
|
'arsse_enclosures' => ["url","type"],
|
||||||
'arsse_categories' => ["name"],
|
'arsse_categories' => ["name"],
|
||||||
]);
|
]);
|
||||||
$state['arsse_enclosures']['rows'][] = ['http://example.com/text','text/plain'];
|
$state['arsse_enclosures']['rows'] = [
|
||||||
$state['arsse_categories']['rows'] = array_merge($state['arsse_categories']['rows'], [
|
['http://example.com/svg','image/svg'],
|
||||||
|
['http://example.com/text','text/plain'],
|
||||||
|
];
|
||||||
|
$state['arsse_categories']['rows'] = [
|
||||||
|
["HLN"],
|
||||||
["Aniki!"],
|
["Aniki!"],
|
||||||
["Beams"],
|
["Beams"],
|
||||||
["Bodybuilders"],
|
["Bodybuilders"],
|
||||||
["Men"],
|
["Men"],
|
||||||
]);
|
];
|
||||||
$this->compareExpectations($state);
|
$this->compareExpectations($state);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -225,6 +225,16 @@ trait SeriesFolder {
|
||||||
$this->compareExpectations($state);
|
$this->compareExpectations($state);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function testRenameAFolderToTheEmptyString() {
|
||||||
|
$this->assertException("missing", "Db", "ExceptionInput");
|
||||||
|
$this->assertTrue(Arsse::$db->folderPropertiesSet("john.doe@example.com", 6, ['name' => ""]));
|
||||||
|
}
|
||||||
|
|
||||||
|
function testRenameAFolderToWhitespaceOnly() {
|
||||||
|
$this->assertException("whitespace", "Db", "ExceptionInput");
|
||||||
|
$this->assertTrue(Arsse::$db->folderPropertiesSet("john.doe@example.com", 6, ['name' => " "]));
|
||||||
|
}
|
||||||
|
|
||||||
function testMoveAFolder() {
|
function testMoveAFolder() {
|
||||||
$this->assertTrue(Arsse::$db->folderPropertiesSet("john.doe@example.com", 6, ['parent' => 5]));
|
$this->assertTrue(Arsse::$db->folderPropertiesSet("john.doe@example.com", 6, ['parent' => 5]));
|
||||||
Phake::verify(Arsse::$user)->authorize("john.doe@example.com", "folderPropertiesSet");
|
Phake::verify(Arsse::$user)->authorize("john.doe@example.com", "folderPropertiesSet");
|
||||||
|
|
28
tests/lib/Database/SeriesMiscellany.php
Normal file
28
tests/lib/Database/SeriesMiscellany.php
Normal file
|
@ -0,0 +1,28 @@
|
||||||
|
<?php
|
||||||
|
declare(strict_types=1);
|
||||||
|
namespace JKingWeb\Arsse\Test\Database;
|
||||||
|
use JKingWeb\Arsse\Arsse;
|
||||||
|
use JKingWeb\Arsse\Database;
|
||||||
|
|
||||||
|
trait SeriesMiscellany {
|
||||||
|
|
||||||
|
function testListDrivers() {
|
||||||
|
$exp = [
|
||||||
|
'JKingWeb\\Arsse\\Db\\SQLite3\\Driver' => Arsse::$lang->msg("Driver.Db.SQLite3.Name"),
|
||||||
|
];
|
||||||
|
$this->assertArraySubset($exp, Database::driverList());
|
||||||
|
}
|
||||||
|
|
||||||
|
function testInitializeDatabase() {
|
||||||
|
$d = new Database();
|
||||||
|
$this->assertSame(Database::SCHEMA_VERSION, $d->driverSchemaVersion());
|
||||||
|
}
|
||||||
|
|
||||||
|
function testManuallyInitializeDatabase() {
|
||||||
|
$d = new Database(false);
|
||||||
|
$this->assertSame(0, $d->driverSchemaVersion());
|
||||||
|
$this->assertTrue($d->driverSchemaUpdate());
|
||||||
|
$this->assertSame(Database::SCHEMA_VERSION, $d->driverSchemaVersion());
|
||||||
|
$this->assertFalse($d->driverSchemaUpdate());
|
||||||
|
}
|
||||||
|
}
|
|
@ -264,6 +264,17 @@ trait SeriesSubscription {
|
||||||
Arsse::$db->subscriptionList($this->user);
|
Arsse::$db->subscriptionList($this->user);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function testGetThePropertiesOfAMissingSubscription() {
|
||||||
|
$this->assertException("subjectMissing", "Db", "ExceptionInput");
|
||||||
|
Arsse::$db->subscriptionPropertiesGet($this->user, 2112);
|
||||||
|
}
|
||||||
|
|
||||||
|
function testGetThePropertiesOfASubscriptionWithoutAuthority() {
|
||||||
|
Phake::when(Arsse::$user)->authorize->thenReturn(false);
|
||||||
|
$this->assertException("notAuthorized", "User", "ExceptionAuthz");
|
||||||
|
Arsse::$db->subscriptionPropertiesGet($this->user, 1);
|
||||||
|
}
|
||||||
|
|
||||||
function testSetThePropertiesOfASubscription() {
|
function testSetThePropertiesOfASubscription() {
|
||||||
Arsse::$db->subscriptionPropertiesSet($this->user, 1,[
|
Arsse::$db->subscriptionPropertiesSet($this->user, 1,[
|
||||||
'title' => "Ook Ook",
|
'title' => "Ook Ook",
|
||||||
|
@ -290,6 +301,10 @@ trait SeriesSubscription {
|
||||||
Arsse::$db->subscriptionPropertiesSet($this->user, 1, ['folder' => 4]);
|
Arsse::$db->subscriptionPropertiesSet($this->user, 1, ['folder' => 4]);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function testMoveASubscriptionToTheRootFolder() {
|
||||||
|
$this->assertTrue(Arsse::$db->subscriptionPropertiesSet($this->user, 3, ['folder' => null]));
|
||||||
|
}
|
||||||
|
|
||||||
function testRenameASubscriptionToABlankTitle() {
|
function testRenameASubscriptionToABlankTitle() {
|
||||||
$this->assertException("missing", "Db", "ExceptionInput");
|
$this->assertException("missing", "Db", "ExceptionInput");
|
||||||
Arsse::$db->subscriptionPropertiesSet($this->user, 1, ['title' => ""]);
|
Arsse::$db->subscriptionPropertiesSet($this->user, 1, ['title' => ""]);
|
||||||
|
|
|
@ -43,6 +43,11 @@ trait SeriesUser {
|
||||||
$this->assertTrue(password_verify("secret", $hash));
|
$this->assertTrue(password_verify("secret", $hash));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function testGetThePasswordOfAMissingUser() {
|
||||||
|
$this->assertException("doesNotExist", "User");
|
||||||
|
Arsse::$db->userPasswordGet("john.doe@example.org");
|
||||||
|
}
|
||||||
|
|
||||||
function testGetAPasswordWithoutAuthority() {
|
function testGetAPasswordWithoutAuthority() {
|
||||||
Phake::when(Arsse::$user)->authorize->thenReturn(false);
|
Phake::when(Arsse::$user)->authorize->thenReturn(false);
|
||||||
$this->assertException("notAuthorized", "User", "ExceptionAuthz");
|
$this->assertException("notAuthorized", "User", "ExceptionAuthz");
|
||||||
|
@ -145,6 +150,12 @@ trait SeriesUser {
|
||||||
Phake::verify(Arsse::$user)->authorize($user, "userPasswordSet");
|
Phake::verify(Arsse::$user)->authorize($user, "userPasswordSet");
|
||||||
$this->assertTrue(password_verify($pass, $hash), "Failed verifying password of $user '$pass' against hash '$hash'.");
|
$this->assertTrue(password_verify($pass, $hash), "Failed verifying password of $user '$pass' against hash '$hash'.");
|
||||||
}
|
}
|
||||||
|
function testSetARandomPassword() {
|
||||||
|
$user = "john.doe@example.com";
|
||||||
|
$this->assertEquals("", Arsse::$db->userPasswordGet($user));
|
||||||
|
$pass = Arsse::$db->userPasswordSet($user);
|
||||||
|
$hash = Arsse::$db->userPasswordGet($user);
|
||||||
|
}
|
||||||
|
|
||||||
function testSetThePasswordOfAMissingUser() {
|
function testSetThePasswordOfAMissingUser() {
|
||||||
$this->assertException("doesNotExist", "User");
|
$this->assertException("doesNotExist", "User");
|
||||||
|
|
|
@ -53,6 +53,7 @@
|
||||||
<file>Db/SQLite3/TestDbUpdateSQLite3.php</file>
|
<file>Db/SQLite3/TestDbUpdateSQLite3.php</file>
|
||||||
</testsuite>
|
</testsuite>
|
||||||
<testsuite name="Database functions">
|
<testsuite name="Database functions">
|
||||||
|
<file>Db/SQLite3/Database/TestDatabaseMiscellanySQLite3.php</file>
|
||||||
<file>Db/SQLite3/Database/TestDatabaseMetaSQLite3.php</file>
|
<file>Db/SQLite3/Database/TestDatabaseMetaSQLite3.php</file>
|
||||||
<file>Db/SQLite3/Database/TestDatabaseUserSQLite3.php</file>
|
<file>Db/SQLite3/Database/TestDatabaseUserSQLite3.php</file>
|
||||||
<file>Db/SQLite3/Database/TestDatabaseFolderSQLite3.php</file>
|
<file>Db/SQLite3/Database/TestDatabaseFolderSQLite3.php</file>
|
||||||
|
|
Loading…
Reference in a new issue