1
1
Fork 0
mirror of https://code.mensbeam.com/MensBeam/Arsse.git synced 2024-12-22 21:22:40 +00:00

Fix NCNv1 tests

- Version report test was failing
- Added test for offset=0
This commit is contained in:
J. King 2017-07-16 11:51:18 -04:00
parent 6d4aa4db6e
commit e797de05c2

View file

@ -417,7 +417,10 @@ class TestNCNV1_2 extends Test\AbstractTest {
} }
function testRetrieveServerVersion() { function testRetrieveServerVersion() {
$exp = new Response(200, ['version' => \JKingWeb\Arsse\VERSION]); $exp = new Response(200, [
'arsse_version' => \JKingWeb\Arsse\VERSION,
'version' => REST\NextCloudNews\V1_2::VERSION,
]);
$this->assertEquals($exp, $this->h->dispatch(new Request("GET", "/version"))); $this->assertEquals($exp, $this->h->dispatch(new Request("GET", "/version")));
} }
@ -591,6 +594,7 @@ class TestNCNV1_2 extends Test\AbstractTest {
['getRead' => true], ['getRead' => true],
['getRead' => false], ['getRead' => false],
['lastModified' => $t->getTimestamp()], ['lastModified' => $t->getTimestamp()],
['oldestFirst' => false, 'batchSize' => 5, 'offset' => 0], // offset=0 should not set the latestEdition context
]; ];
Phake::when(Data::$db)->articleList(Data::$user->id, $this->anything())->thenReturn($res); Phake::when(Data::$db)->articleList(Data::$user->id, $this->anything())->thenReturn($res);
Phake::when(Data::$db)->articleList(Data::$user->id, (new Context)->reverse(true)->subscription(42))->thenThrow(new ExceptionInput("idMissing")); Phake::when(Data::$db)->articleList(Data::$user->id, (new Context)->reverse(true)->subscription(42))->thenThrow(new ExceptionInput("idMissing"));
@ -611,6 +615,7 @@ class TestNCNV1_2 extends Test\AbstractTest {
$this->h->dispatch(new Request("GET", "/items", json_encode($in[6]), 'application/json')); // fourth instance of base context $this->h->dispatch(new Request("GET", "/items", json_encode($in[6]), 'application/json')); // fourth instance of base context
$this->h->dispatch(new Request("GET", "/items", json_encode($in[7]), 'application/json')); $this->h->dispatch(new Request("GET", "/items", json_encode($in[7]), 'application/json'));
$this->h->dispatch(new Request("GET", "/items", json_encode($in[8]), 'application/json')); $this->h->dispatch(new Request("GET", "/items", json_encode($in[8]), 'application/json'));
$this->h->dispatch(new Request("GET", "/items", json_encode($in[9]), 'application/json'));
// perform method verifications // perform method verifications
Phake::verify(Data::$db, Phake::times(4))->articleList(Data::$user->id, (new Context)->reverse(true)); Phake::verify(Data::$db, Phake::times(4))->articleList(Data::$user->id, (new Context)->reverse(true));
Phake::verify(Data::$db)->articleList(Data::$user->id, (new Context)->reverse(true)->subscription(42)); Phake::verify(Data::$db)->articleList(Data::$user->id, (new Context)->reverse(true)->subscription(42));
@ -620,6 +625,7 @@ class TestNCNV1_2 extends Test\AbstractTest {
Phake::verify(Data::$db)->articleList(Data::$user->id, (new Context)->reverse(true)->limit(5)->latestEdition(4)); Phake::verify(Data::$db)->articleList(Data::$user->id, (new Context)->reverse(true)->limit(5)->latestEdition(4));
Phake::verify(Data::$db)->articleList(Data::$user->id, (new Context)->reverse(true)->unread(true)); Phake::verify(Data::$db)->articleList(Data::$user->id, (new Context)->reverse(true)->unread(true));
Phake::verify(Data::$db)->articleList(Data::$user->id, (new Context)->reverse(true)->modifiedSince($t)); Phake::verify(Data::$db)->articleList(Data::$user->id, (new Context)->reverse(true)->modifiedSince($t));
Phake::verify(Data::$db)->articleList(Data::$user->id, (new Context)->reverse(true)->limit(5));
} }
function testMarkAFolderRead() { function testMarkAFolderRead() {