@ -187,11 +187,11 @@ LONG_STRING;
public function testHandleInvalidPaths() {
$exp = $this->respErr("MALFORMED_INPUT", [], null);
$this->assertRespons e($exp, $this->req(null, "POST", "", ""));
$this->assertRespons e($exp, $this->req(null, "POST", "/", ""));
$this->assertRespons e($exp, $this->req(null, "POST", "/index.php", ""));
$this->assertMessag e($exp, $this->req(null, "POST", "", ""));
$this->assertMessag e($exp, $this->req(null, "POST", "/", ""));
$this->assertMessag e($exp, $this->req(null, "POST", "/index.php", ""));
$exp = new EmptyResponse(404);
$this->assertRespons e($exp, $this->req(null, "POST", "/bad/path", ""));
$this->assertMessag e($exp, $this->req(null, "POST", "/bad/path", ""));
}
public function testHandleOptionsRequest() {
@ -199,13 +199,13 @@ LONG_STRING;
'Allow' => "POST",
'Accept' => "application/json, text/json",
]);
$this->assertRespons e($exp, $this->req(null, "OPTIONS", "", ""));
$this->assertMessag e($exp, $this->req(null, "OPTIONS", "", ""));
}
public function testHandleInvalidData() {
$exp = $this->respErr("MALFORMED_INPUT", [], null);
$this->assertRespons e($exp, $this->req(null, "POST", "", "This is not valid JSON data"));
$this->assertRespons e($exp, $this->req(null, "POST", "", "")); // lack of data is also an error
$this->assertMessag e($exp, $this->req(null, "POST", "", "This is not valid JSON data"));
$this->assertMessag e($exp, $this->req(null, "POST", "", "")); // lack of data is also an error
}
public function testLogIn() {
@ -218,15 +218,15 @@ LONG_STRING;
'password' => "secret",
];
$exp = $this->respGood(['session_id' => "PriestsOfSyrinx", 'api_level' => \JKingWeb\Arsse\REST\TinyTinyRSS\API::LEVEL]);
$this->assertRespons e($exp, $this->req($data));
$this->assertMessag e($exp, $this->req($data));
// base64 passwords are also accepted
$data['password'] = base64_encode($data['password']);
$exp = $this->respGood(['session_id' => "SolarFederation", 'api_level' => \JKingWeb\Arsse\REST\TinyTinyRSS\API::LEVEL]);
$this->assertRespons e($exp, $this->req($data));
$this->assertMessag e($exp, $this->req($data));
// test a failed log-in
$data['password'] = "superman";
$exp = $this->respErr("LOGIN_ERROR");
$this->assertRespons e($exp, $this->req($data));
$this->assertMessag e($exp, $this->req($data));
// logging in should never try to resume a session
Phake::verify(Arsse::$db, Phake::times(0))->sessionResume($this->anything());
}
@ -239,7 +239,7 @@ LONG_STRING;
'password' => "secret",
];
$exp = new EmptyResponse(500);
$this->assertRespons e($exp, $this->req($data));
$this->assertMessag e($exp, $this->req($data));
}
public function testLogOut() {
@ -249,7 +249,7 @@ LONG_STRING;
'sid' => "PriestsOfSyrinx",
];
$exp = $this->respGood(['status' => "OK"]);
$this->assertRespons e($exp, $this->req($data));
$this->assertMessag e($exp, $this->req($data));
Phake::verify(Arsse::$db)->sessionDestroy(Arsse::$user->id, "PriestsOfSyrinx");
}
@ -259,10 +259,10 @@ LONG_STRING;
'sid' => "PriestsOfSyrinx",
];
$exp = $this->respGood(['status' => true]);
$this->assertRespons e($exp, $this->req($data));
$this->assertMessag e($exp, $this->req($data));
$data['sid'] = "SolarFederation";
$exp = $this->respErr("NOT_LOGGED_IN");
$this->assertRespons e($exp, $this->req($data));
$this->assertMessag e($exp, $this->req($data));
}
public function testHandleUnknownMethods() {
@ -271,7 +271,7 @@ LONG_STRING;
'op' => "thisMethodDoesNotExist",
'sid' => "PriestsOfSyrinx",
];
$this->assertRespons e($exp, $this->req($data));
$this->assertMessag e($exp, $this->req($data));
}
public function testHandleMixedCaseMethods() {
@ -280,13 +280,13 @@ LONG_STRING;
'sid' => "PriestsOfSyrinx",
];
$exp = $this->respGood(['status' => true]);
$this->assertRespons e($exp, $this->req($data));
$this->assertMessag e($exp, $this->req($data));
$data['op'] = "isloggedin";
$this->assertRespons e($exp, $this->req($data));
$this->assertMessag e($exp, $this->req($data));
$data['op'] = "ISLOGGEDIN";
$this->assertRespons e($exp, $this->req($data));
$this->assertMessag e($exp, $this->req($data));
$data['op'] = "iSlOgGeDiN";
$this->assertRespons e($exp, $this->req($data));
$this->assertMessag e($exp, $this->req($data));
}
public function testRetrieveServerVersion() {
@ -298,7 +298,7 @@ LONG_STRING;
'version' => \JKingWeb\Arsse\REST\TinyTinyRSS\API::VERSION,
'arsse_version' => Arsse::VERSION,
]);
$this->assertRespons e($exp, $this->req($data));
$this->assertMessag e($exp, $this->req($data));
}
public function testRetrieveProtocolLevel() {
@ -307,7 +307,7 @@ LONG_STRING;
'sid' => "PriestsOfSyrinx",
];
$exp = $this->respGood(['level' => \JKingWeb\Arsse\REST\TinyTinyRSS\API::LEVEL]);
$this->assertRespons e($exp, $this->req($data));
$this->assertMessag e($exp, $this->req($data));
}
public function testAddACategory() {
@ -341,24 +341,24 @@ LONG_STRING;
Phake::when(Arsse::$db)->folderAdd(Arsse::$user->id, ['name' => " ", 'parent' => null])->thenThrow(new ExceptionInput("whitespace"));
// correctly add two folders
$exp = $this->respGood("2");
$this->assertRespons e($exp, $this->req($in[0]));
$this->assertMessag e($exp, $this->req($in[0]));
$exp = $this->respGood("3");
$this->assertRespons e($exp, $this->req($in[1]));
$this->assertMessag e($exp, $this->req($in[1]));
// attempt to add the two folders again
$exp = $this->respGood("2");
$this->assertRespons e($exp, $this->req($in[0]));
$this->assertMessag e($exp, $this->req($in[0]));
$exp = $this->respGood("3");
$this->assertRespons e($exp, $this->req($in[1]));
$this->assertMessag e($exp, $this->req($in[1]));
Phake::verify(Arsse::$db)->folderList(Arsse::$user->id, null, false);
Phake::verify(Arsse::$db)->folderList(Arsse::$user->id, 1, false);
// add a folder to a missing parent (silently fails)
$exp = $this->respGood(false);
$this->assertRespons e($exp, $this->req($in[2]));
$this->assertMessag e($exp, $this->req($in[2]));
// add some invalid folders
$exp = $this->respErr("INCORRECT_USAGE");
$this->assertRespons e($exp, $this->req($in[3]));
$this->assertRespons e($exp, $this->req($in[4]));
$this->assertRespons e($exp, $this->req($in[5]));
$this->assertMessag e($exp, $this->req($in[3]));
$this->assertMessag e($exp, $this->req($in[4]));
$this->assertMessag e($exp, $this->req($in[5]));
}
public function testRemoveACategory() {
@ -371,16 +371,16 @@ LONG_STRING;
Phake::when(Arsse::$db)->folderRemove(Arsse::$user->id, 42)->thenReturn(true)->thenThrow(new ExceptionInput("subjectMissing"));
// succefully delete a folder
$exp = $this->respGood();
$this->assertRespons e($exp, $this->req($in[0]));
$this->assertMessag e($exp, $this->req($in[0]));
// try deleting it again (this should silently fail)
$exp = $this->respGood();
$this->assertRespons e($exp, $this->req($in[0]));
$this->assertMessag e($exp, $this->req($in[0]));
// delete a folder which does not exist (this should also silently fail)
$exp = $this->respGood();
$this->assertRespons e($exp, $this->req($in[1]));
$this->assertMessag e($exp, $this->req($in[1]));
// delete an invalid folder (causes an error)
$exp = $this->respErr("INCORRECT_USAGE");
$this->assertRespons e($exp, $this->req($in[2]));
$this->assertMessag e($exp, $this->req($in[2]));
Phake::verify(Arsse::$db, Phake::times(3))->folderRemove(Arsse::$user->id, $this->anything());
}
@ -418,21 +418,21 @@ LONG_STRING;
Phake::when(Arsse::$db)->folderPropertiesSet(...$db[8])->thenThrow(new ExceptionInput("typeViolation"));
// succefully move a folder
$exp = $this->respGood();
$this->assertRespons e($exp, $this->req($in[0]));
$this->assertMessag e($exp, $this->req($in[0]));
// move a folder which does not exist (this should silently fail)
$exp = $this->respGood();
$this->assertRespons e($exp, $this->req($in[1]));
$this->assertMessag e($exp, $this->req($in[1]));
// move a folder causing a duplication (this should also silently fail)
$exp = $this->respGood();
$this->assertRespons e($exp, $this->req($in[2]));
$this->assertRespons e($exp, $this->req($in[3]));
$this->assertRespons e($exp, $this->req($in[6]));
$this->assertMessag e($exp, $this->req($in[2]));
$this->assertMessag e($exp, $this->req($in[3]));
$this->assertMessag e($exp, $this->req($in[6]));
// all the rest should cause errors
$exp = $this->respErr("INCORRECT_USAGE");
$this->assertRespons e($exp, $this->req($in[4]));
$this->assertRespons e($exp, $this->req($in[5]));
$this->assertRespons e($exp, $this->req($in[7]));
$this->assertRespons e($exp, $this->req($in[8]));
$this->assertMessag e($exp, $this->req($in[4]));
$this->assertMessag e($exp, $this->req($in[5]));
$this->assertMessag e($exp, $this->req($in[7]));
$this->assertMessag e($exp, $this->req($in[8]));
Phake::verify(Arsse::$db, Phake::times(5))->folderPropertiesSet(Arsse::$user->id, $this->anything(), $this->anything());
}
@ -458,21 +458,21 @@ LONG_STRING;
Phake::when(Arsse::$db)->folderPropertiesSet(...$db[2])->thenThrow(new ExceptionInput("constraintViolation"));
// succefully rename a folder
$exp = $this->respGood();
$this->assertRespons e($exp, $this->req($in[0]));
$this->assertMessag e($exp, $this->req($in[0]));
// rename a folder which does not exist (this should silently fail)
$exp = $this->respGood();
$this->assertRespons e($exp, $this->req($in[1]));
$this->assertMessag e($exp, $this->req($in[1]));
// rename a folder causing a duplication (this should also silently fail)
$exp = $this->respGood();
$this->assertRespons e($exp, $this->req($in[2]));
$this->assertMessag e($exp, $this->req($in[2]));
// all the rest should cause errors
$exp = $this->respErr("INCORRECT_USAGE");
$this->assertRespons e($exp, $this->req($in[3]));
$this->assertRespons e($exp, $this->req($in[4]));
$this->assertRespons e($exp, $this->req($in[5]));
$this->assertRespons e($exp, $this->req($in[6]));
$this->assertRespons e($exp, $this->req($in[7]));
$this->assertRespons e($exp, $this->req($in[8]));
$this->assertMessag e($exp, $this->req($in[3]));
$this->assertMessag e($exp, $this->req($in[4]));
$this->assertMessag e($exp, $this->req($in[5]));
$this->assertMessag e($exp, $this->req($in[6]));
$this->assertMessag e($exp, $this->req($in[7]));
$this->assertMessag e($exp, $this->req($in[8]));
Phake::verify(Arsse::$db, Phake::times(3))->folderPropertiesSet(Arsse::$user->id, $this->anything(), $this->anything());
}
@ -542,11 +542,11 @@ LONG_STRING;
Phake::when(Arsse::$db)->subscriptionList(Arsse::$user->id)->thenReturn(new Result($list));
for ($a = 0; $a < (sizeof($in) - 4); $a++) {
$exp = $this->respGood($out[$a]);
$this->assertRespons e($exp, $this->req($in[$a]), "Failed test $a");
$this->assertMessag e($exp, $this->req($in[$a]), "Failed test $a");
}
$exp = $this->respErr("INCORRECT_USAGE");
for ($a = (sizeof($in) - 4); $a < sizeof ( $ in ) ; $ a + + ) {
$this->assertRespons e($exp, $this->req($in[$a]), "Failed test $a");
$this->assertMessag e($exp, $this->req($in[$a]), "Failed test $a");
}
Phake::verify(Arsse::$db, Phake::times(0))->subscriptionPropertiesSet(Arsse::$user->id, 4, ['folder' => 1]);
}
@ -563,13 +563,13 @@ LONG_STRING;
Phake::when(Arsse::$db)->subscriptionRemove(Arsse::$user->id, 42)->thenReturn(true)->thenThrow(new ExceptionInput("subjectMissing"));
// succefully delete a folder
$exp = $this->respGood(['status' => "OK"]);
$this->assertRespons e($exp, $this->req($in[0]));
$this->assertMessag e($exp, $this->req($in[0]));
// try deleting it again (this should noisily fail, as should everything else)
$exp = $this->respErr("FEED_NOT_FOUND");
$this->assertRespons e($exp, $this->req($in[0]));
$this->assertRespons e($exp, $this->req($in[1]));
$this->assertRespons e($exp, $this->req($in[2]));
$this->assertRespons e($exp, $this->req($in[3]));
$this->assertMessag e($exp, $this->req($in[0]));
$this->assertMessag e($exp, $this->req($in[1]));
$this->assertMessag e($exp, $this->req($in[2]));
$this->assertMessag e($exp, $this->req($in[3]));
Phake::verify(Arsse::$db, Phake::times(5))->subscriptionRemove(Arsse::$user->id, $this->anything());
}
@ -597,21 +597,21 @@ LONG_STRING;
Phake::when(Arsse::$db)->subscriptionPropertiesSet(...$db[3])->thenThrow(new ExceptionInput("constraintViolation"));
// succefully move a subscription
$exp = $this->respGood();
$this->assertRespons e($exp, $this->req($in[0]));
$this->assertMessag e($exp, $this->req($in[0]));
// move a subscription which does not exist (this should silently fail)
$exp = $this->respGood();
$this->assertRespons e($exp, $this->req($in[1]));
$this->assertMessag e($exp, $this->req($in[1]));
// move a subscription causing a duplication (this should also silently fail)
$exp = $this->respGood();
$this->assertRespons e($exp, $this->req($in[2]));
$this->assertRespons e($exp, $this->req($in[3]));
$this->assertMessag e($exp, $this->req($in[2]));
$this->assertMessag e($exp, $this->req($in[3]));
// all the rest should cause errors
$exp = $this->respErr("INCORRECT_USAGE");
$this->assertRespons e($exp, $this->req($in[4]));
$this->assertRespons e($exp, $this->req($in[5]));
$this->assertRespons e($exp, $this->req($in[6]));
$this->assertRespons e($exp, $this->req($in[7]));
$this->assertRespons e($exp, $this->req($in[8]));
$this->assertMessag e($exp, $this->req($in[4]));
$this->assertMessag e($exp, $this->req($in[5]));
$this->assertMessag e($exp, $this->req($in[6]));
$this->assertMessag e($exp, $this->req($in[7]));
$this->assertMessag e($exp, $this->req($in[8]));
Phake::verify(Arsse::$db, Phake::times(4))->subscriptionPropertiesSet(Arsse::$user->id, $this->anything(), $this->anything());
}
@ -637,21 +637,21 @@ LONG_STRING;
Phake::when(Arsse::$db)->subscriptionPropertiesSet(...$db[2])->thenThrow(new ExceptionInput("constraintViolation"));
// succefully rename a subscription
$exp = $this->respGood();
$this->assertRespons e($exp, $this->req($in[0]));
$this->assertMessag e($exp, $this->req($in[0]));
// rename a subscription which does not exist (this should silently fail)
$exp = $this->respGood();
$this->assertRespons e($exp, $this->req($in[1]));
$this->assertMessag e($exp, $this->req($in[1]));
// rename a subscription causing a duplication (this should also silently fail)
$exp = $this->respGood();
$this->assertRespons e($exp, $this->req($in[2]));
$this->assertMessag e($exp, $this->req($in[2]));
// all the rest should cause errors
$exp = $this->respErr("INCORRECT_USAGE");
$this->assertRespons e($exp, $this->req($in[3]));
$this->assertRespons e($exp, $this->req($in[4]));
$this->assertRespons e($exp, $this->req($in[5]));
$this->assertRespons e($exp, $this->req($in[6]));
$this->assertRespons e($exp, $this->req($in[7]));
$this->assertRespons e($exp, $this->req($in[8]));
$this->assertMessag e($exp, $this->req($in[3]));
$this->assertMessag e($exp, $this->req($in[4]));
$this->assertMessag e($exp, $this->req($in[5]));
$this->assertMessag e($exp, $this->req($in[6]));
$this->assertMessag e($exp, $this->req($in[7]));
$this->assertMessag e($exp, $this->req($in[8]));
Phake::verify(Arsse::$db)->subscriptionPropertiesSet(...$db[0]);
Phake::verify(Arsse::$db)->subscriptionPropertiesSet(...$db[1]);
Phake::verify(Arsse::$db)->subscriptionPropertiesSet(...$db[2]);
@ -665,7 +665,7 @@ LONG_STRING;
['id' => 3, 'unread' => 47],
]));
$exp = $this->respGood(['unread' => (string) (2112 + 42 + 47)]);
$this->assertRespons e($exp, $this->req($in));
$this->assertMessag e($exp, $this->req($in));
}
public function testRetrieveTheServerConfiguration() {
@ -679,8 +679,8 @@ LONG_STRING;
['icons_dir' => "feed-icons", 'icons_url' => "feed-icons", 'daemon_is_running' => true, 'num_feeds' => 12],
['icons_dir' => "feed-icons", 'icons_url' => "feed-icons", 'daemon_is_running' => false, 'num_feeds' => 2],
];
$this->assertRespons e($this->respGood($exp[0]), $this->req($in));
$this->assertRespons e($this->respGood($exp[1]), $this->req($in));
$this->assertMessag e($this->respGood($exp[0]), $this->req($in));
$this->assertMessag e($this->respGood($exp[1]), $this->req($in));
}
public function testUpdateAFeed() {
@ -694,13 +694,13 @@ LONG_STRING;
Phake::when(Arsse::$db)->subscriptionPropertiesGet(Arsse::$user->id, 1)->thenReturn(['id' => 1, 'feed' => 11]);
Phake::when(Arsse::$db)->subscriptionPropertiesGet(Arsse::$user->id, 2)->thenThrow(new ExceptionInput("subjectMissing"));
$exp = $this->respGood(['status' => "OK"]);
$this->assertRespons e($exp, $this->req($in[0]));
$this->assertMessag e($exp, $this->req($in[0]));
Phake::verify(Arsse::$db)->feedUpdate(11);
$exp = $this->respErr("FEED_NOT_FOUND");
$this->assertRespons e($exp, $this->req($in[1]));
$this->assertMessag e($exp, $this->req($in[1]));
$exp = $this->respErr("INCORRECT_USAGE");
$this->assertRespons e($exp, $this->req($in[2]));
$this->assertRespons e($exp, $this->req($in[3]));
$this->assertMessag e($exp, $this->req($in[2]));
$this->assertMessag e($exp, $this->req($in[3]));
}
public function testAddALabel() {
@ -731,21 +731,21 @@ LONG_STRING;
Phake::when(Arsse::$db)->labelAdd(Arsse::$user->id, ['name' => " "])->thenThrow(new ExceptionInput("whitespace"));
// correctly add two labels
$exp = $this->respGood((-1 * API::LABEL_OFFSET) - 2);
$this->assertRespons e($exp, $this->req($in[0]));
$this->assertMessag e($exp, $this->req($in[0]));
$exp = $this->respGood((-1 * API::LABEL_OFFSET) - 3);
$this->assertRespons e($exp, $this->req($in[1]));
$this->assertMessag e($exp, $this->req($in[1]));
// attempt to add the two labels again
$exp = $this->respGood((-1 * API::LABEL_OFFSET) - 2);
$this->assertRespons e($exp, $this->req($in[0]));
$this->assertMessag e($exp, $this->req($in[0]));
$exp = $this->respGood((-1 * API::LABEL_OFFSET) - 3);
$this->assertRespons e($exp, $this->req($in[1]));
$this->assertMessag e($exp, $this->req($in[1]));
Phake::verify(Arsse::$db)->labelPropertiesGet(Arsse::$user->id, "Software", true);
Phake::verify(Arsse::$db)->labelPropertiesGet(Arsse::$user->id, "Hardware", true);
// add some invalid labels
$exp = $this->respErr("INCORRECT_USAGE");
$this->assertRespons e($exp, $this->req($in[2]));
$this->assertRespons e($exp, $this->req($in[3]));
$this->assertRespons e($exp, $this->req($in[4]));
$this->assertMessag e($exp, $this->req($in[2]));
$this->assertMessag e($exp, $this->req($in[3]));
$this->assertMessag e($exp, $this->req($in[4]));
}
public function testRemoveALabel() {
@ -760,18 +760,18 @@ LONG_STRING;
Phake::when(Arsse::$db)->labelRemove(Arsse::$user->id, 18)->thenReturn(true)->thenThrow(new ExceptionInput("subjectMissing"));
// succefully delete a label
$exp = $this->respGood();
$this->assertRespons e($exp, $this->req($in[0]));
$this->assertMessag e($exp, $this->req($in[0]));
// try deleting it again (this should silently fail)
$exp = $this->respGood();
$this->assertRespons e($exp, $this->req($in[0]));
$this->assertMessag e($exp, $this->req($in[0]));
// delete a label which does not exist (this should also silently fail)
$exp = $this->respGood();
$this->assertRespons e($exp, $this->req($in[1]));
$this->assertMessag e($exp, $this->req($in[1]));
// delete some invalid labels (causes an error)
$exp = $this->respErr("INCORRECT_USAGE");
$this->assertRespons e($exp, $this->req($in[2]));
$this->assertRespons e($exp, $this->req($in[3]));
$this->assertRespons e($exp, $this->req($in[4]));
$this->assertMessag e($exp, $this->req($in[2]));
$this->assertMessag e($exp, $this->req($in[3]));
$this->assertMessag e($exp, $this->req($in[4]));
Phake::verify(Arsse::$db, Phake::times(2))->labelRemove(Arsse::$user->id, 18);
Phake::verify(Arsse::$db)->labelRemove(Arsse::$user->id, 1088);
}
@ -804,21 +804,21 @@ LONG_STRING;
Phake::when(Arsse::$db)->labelPropertiesSet(...$db[5])->thenThrow(new ExceptionInput("typeViolation"));
// succefully rename a label
$exp = $this->respGood();
$this->assertRespons e($exp, $this->req($in[0]));
$this->assertMessag e($exp, $this->req($in[0]));
// rename a label which does not exist (this should silently fail)
$exp = $this->respGood();
$this->assertRespons e($exp, $this->req($in[1]));
$this->assertMessag e($exp, $this->req($in[1]));
// rename a label causing a duplication (this should also silently fail)
$exp = $this->respGood();
$this->assertRespons e($exp, $this->req($in[2]));
$this->assertMessag e($exp, $this->req($in[2]));
// all the rest should cause errors
$exp = $this->respErr("INCORRECT_USAGE");
$this->assertRespons e($exp, $this->req($in[3]));
$this->assertRespons e($exp, $this->req($in[4]));
$this->assertRespons e($exp, $this->req($in[5]));
$this->assertRespons e($exp, $this->req($in[6]));
$this->assertRespons e($exp, $this->req($in[7]));
$this->assertRespons e($exp, $this->req($in[8]));
$this->assertMessag e($exp, $this->req($in[3]));
$this->assertMessag e($exp, $this->req($in[4]));
$this->assertMessag e($exp, $this->req($in[5]));
$this->assertMessag e($exp, $this->req($in[6]));
$this->assertMessag e($exp, $this->req($in[7]));
$this->assertMessag e($exp, $this->req($in[8]));
Phake::verify(Arsse::$db, Phake::times(6))->labelPropertiesSet(Arsse::$user->id, $this->anything(), $this->anything());
}
@ -890,7 +890,7 @@ LONG_STRING;
],
];
for ($a = 0; $a < sizeof ( $ in ) ; $ a + + ) {
$this->assertRespons e($this->respGood($exp[$a]), $this->req($in[$a]), "Test $a failed");
$this->assertMessag e($this->respGood($exp[$a]), $this->req($in[$a]), "Test $a failed");
}
}
@ -926,7 +926,7 @@ LONG_STRING;
['id' => 0, 'kind' => "cat", 'counter' => 0],
['id' => -2, 'kind' => "cat", 'counter' => 6],
];
$this->assertRespons e($this->respGood($exp), $this->req($in));
$this->assertMessag e($this->respGood($exp), $this->req($in));
}
public function testRetrieveTheLabelList() {
@ -970,7 +970,7 @@ LONG_STRING;
],
];
for ($a = 0; $a < sizeof ( $ in ) ; $ a + + ) {
$this->assertRespons e($this->respGood($exp[$a]), $this->req($in[$a]), "Test $a failed");
$this->assertMessag e($this->respGood($exp[$a]), $this->req($in[$a]), "Test $a failed");
}
}
@ -996,20 +996,20 @@ LONG_STRING;
Phake::when(Arsse::$db)->labelArticlesSet(Arsse::$user->id, 1088, (new Context)->articles($list[1]), false)->thenReturn(5);
Phake::when(Arsse::$db)->labelArticlesSet(Arsse::$user->id, 1088, (new Context)->articles($list[2]), false)->thenReturn(2);
$exp = $this->respGood(['status' => "OK", 'updated' => 89]);
$this->assertRespons e($exp, $this->req($in[0]));
$this->assertMessag e($exp, $this->req($in[0]));
Phake::verify(Arsse::$db)->labelArticlesSet(Arsse::$user->id, 1088, (new Context)->articles($list[1]), true);
Phake::verify(Arsse::$db)->labelArticlesSet(Arsse::$user->id, 1088, (new Context)->articles($list[2]), true);
$exp = $this->respGood(['status' => "OK", 'updated' => 7]);
$this->assertRespons e($exp, $this->req($in[1]));
$this->assertMessag e($exp, $this->req($in[1]));
Phake::verify(Arsse::$db)->labelArticlesSet(Arsse::$user->id, 1088, (new Context)->articles($list[1]), false);
Phake::verify(Arsse::$db)->labelArticlesSet(Arsse::$user->id, 1088, (new Context)->articles($list[2]), false);
$exp = $this->respGood(['status' => "OK", 'updated' => 0]);
$this->assertRespons e($exp, $this->req($in[2]));
$this->assertMessag e($exp, $this->req($in[2]));
$exp = $this->respErr("INCORRECT_USAGE");
$this->assertRespons e($exp, $this->req($in[3]));
$this->assertRespons e($exp, $this->req($in[4]));
$this->assertRespons e($exp, $this->req($in[5]));
$this->assertRespons e($exp, $this->req($in[6]));
$this->assertMessag e($exp, $this->req($in[3]));
$this->assertMessag e($exp, $this->req($in[4]));
$this->assertMessag e($exp, $this->req($in[5]));
$this->assertMessag e($exp, $this->req($in[6]));
}
public function testRetrieveFeedTree() {
@ -1024,9 +1024,9 @@ LONG_STRING;
Phake::when(Arsse::$db)->articleStarred($this->anything())->thenReturn($this->starred);
// the expectations are packed tightly since they're very verbose; one can use var_export() (or convert to JSON) to pretty-print them
$exp = ['categories'=>['identifier'=>'id','label'=>'name','items'=>[['name'=>'Special','id'=>'CAT:-1','bare_id'=>-1,'type'=>'category','unread'=>0,'items'=>[['name'=>'All articles','id'=>'FEED:-4','bare_id'=>-4,'icon'=>'images/folder.png','unread'=>35,'type'=>'feed','auxcounter'=>0,'error'=>'','updated'=>'',],['name'=>'Fresh articles','id'=>'FEED:-3','bare_id'=>-3,'icon'=>'images/fresh.png','unread'=>7,'type'=>'feed','auxcounter'=>0,'error'=>'','updated'=>'',],['name'=>'Starred articles','id'=>'FEED:-1','bare_id'=>-1,'icon'=>'images/star.png','unread'=>4,'type'=>'feed','auxcounter'=>0,'error'=>'','updated'=>'',],['name'=>'Published articles','id'=>'FEED:-2','bare_id'=>-2,'icon'=>'images/feed.png','unread'=>0,'type'=>'feed','auxcounter'=>0,'error'=>'','updated'=>'',],['name'=>'Archived articles','id'=>'FEED:0','bare_id'=>0,'icon'=>'images/archive.png','unread'=>0,'type'=>'feed','auxcounter'=>0,'error'=>'','updated'=>'',],['name'=>'Recently read','id'=>'FEED:-6','bare_id'=>-6,'icon'=>'images/time.png','unread'=>0,'type'=>'feed','auxcounter'=>0,'error'=>'','updated'=>'',],],],['name'=>'Labels','id'=>'CAT:-2','bare_id'=>-2,'type'=>'category','unread'=>6,'items'=>[['name'=>'Fascinating','id'=>'FEED:-1027','bare_id'=>-1027,'unread'=>0,'icon'=>'images/label.png','type'=>'feed','auxcounter'=>0,'error'=>'','updated'=>'','fg_color'=>'','bg_color'=>'',],['name'=>'Interesting','id'=>'FEED:-1029','bare_id'=>-1029,'unread'=>0,'icon'=>'images/label.png','type'=>'feed','auxcounter'=>0,'error'=>'','updated'=>'','fg_color'=>'','bg_color'=>'',],['name'=>'Logical','id'=>'FEED:-1025','bare_id'=>-1025,'unread'=>0,'icon'=>'images/label.png','type'=>'feed','auxcounter'=>0,'error'=>'','updated'=>'','fg_color'=>'','bg_color'=>'',],],],['name'=>'Photography','id'=>'CAT:4','bare_id'=>4,'parent_id'=>null,'type'=>'category','auxcounter'=>0,'unread'=>0,'child_unread'=>0,'checkbox'=>false,'param'=>'(0 feeds)','items'=>[],],['name'=>'Politics','id'=>'CAT:3','bare_id'=>3,'parent_id'=>null,'type'=>'category','auxcounter'=>0,'unread'=>0,'child_unread'=>0,'checkbox'=>false,'param'=>'(3 feeds)','items'=>[['name'=>'Local','id'=>'CAT:5','bare_id'=>5,'parent_id'=>3,'type'=>'category','auxcounter'=>0,'unread'=>0,'child_unread'=>0,'checkbox'=>false,'param'=>'(1 feed)','items'=>[['name'=>'Toronto Star','id'=>'FEED:2','bare_id'=>2,'icon'=>'feed-icons/2.ico','error'=>'oops','param'=>'2011-11-11T11:11:11Z','unread'=>0,'auxcounter'=>0,'checkbox'=>false,],],],['name'=>'National','id'=>'CAT:6','bare_id'=>6,'parent_id'=>3,'type'=>'category','auxcounter'=>0,'unread'=>0,'child_unread'=>0,'checkbox'=>false,'param'=>'(2 feeds)','items'=>[['name'=>'CBC News','id'=>'FEED:4','bare_id'=>4,'icon'=>'feed-icons/4.ico','error'=>'','param'=>'2017-10-09T15:58:34Z','unread'=>0,'auxcounter'=>0,'checkbox'=>false,],['name'=>'Ottawa Citizen','id'=>'FEED:5','bare_id'=>5,'icon'=>false,'error'=>'','param'=>'2017-07-07T17:07:17Z','unread'=>0,'auxcounter'=>0,'checkbox'=>false,],],],],],['name'=>'Science','id'=>'CAT:1','bare_id'=>1,'parent_id'=>null,'type'=>'category','auxcounter'=>0,'unread'=>0,'child_unread'=>0,'checkbox'=>false,'param'=>'(2 feeds)','items'=>[['name'=>'Rocketry','id'=>'CAT:2','bare_id'=>2,'parent_id'=>1,'type'=>'category','auxcounter'=>0,'unread'=>0,'child_unread'=>0,'checkbox'=>false,'param'=>'(1 feed)','items'=>[['name'=>'NASA JPL','id'=>'FEED:1','bare_id'=>1,'icon'=>false,'error'=>'','param'=>'2017-09-15T22:54:16Z','unread'=>0,'auxcounter'=>0,'checkbox'=>false,],],],['name'=>'Ars Technica','id'=>'FEED:3','bare_id'=>3,'icon'=>'feed-icons/3.ico','error'=>'argh','param'=>'2016-05-23T06:40:02Z','unread'=>0,'auxcounter'=>0,'checkbox'=>false,],],],['name'=>'Uncategorized','id'=>'CAT:0','bare_id'=>0,'type'=>'category','auxcounter'=>0,'unread'=>0,'child_unread'=>0,'checkbox'=>false,'parent_id'=>null,'param'=>'(1 feed)','items'=>[['name'=>'Eurogamer','id'=>'FEED:6','bare_id'=>6,'icon'=>'feed-icons/6.ico','error'=>'','param'=>'2010-02-12T20:08:47Z','unread'=>0,'auxcounter'=>0,'checkbox'=>false,],],],],],];
$this->assertRespons e($this->respGood($exp), $this->req($in[0]));
$this->assertMessag e($this->respGood($exp), $this->req($in[0]));
$exp = ['categories'=>['identifier'=>'id','label'=>'name','items'=>[['name'=>'Special','id'=>'CAT:-1','bare_id'=>-1,'type'=>'category','unread'=>0,'items'=>[['name'=>'All articles','id'=>'FEED:-4','bare_id'=>-4,'icon'=>'images/folder.png','unread'=>35,'type'=>'feed','auxcounter'=>0,'error'=>'','updated'=>'',],['name'=>'Fresh articles','id'=>'FEED:-3','bare_id'=>-3,'icon'=>'images/fresh.png','unread'=>7,'type'=>'feed','auxcounter'=>0,'error'=>'','updated'=>'',],['name'=>'Starred articles','id'=>'FEED:-1','bare_id'=>-1,'icon'=>'images/star.png','unread'=>4,'type'=>'feed','auxcounter'=>0,'error'=>'','updated'=>'',],['name'=>'Published articles','id'=>'FEED:-2','bare_id'=>-2,'icon'=>'images/feed.png','unread'=>0,'type'=>'feed','auxcounter'=>0,'error'=>'','updated'=>'',],['name'=>'Archived articles','id'=>'FEED:0','bare_id'=>0,'icon'=>'images/archive.png','unread'=>0,'type'=>'feed','auxcounter'=>0,'error'=>'','updated'=>'',],['name'=>'Recently read','id'=>'FEED:-6','bare_id'=>-6,'icon'=>'images/time.png','unread'=>0,'type'=>'feed','auxcounter'=>0,'error'=>'','updated'=>'',],],],['name'=>'Labels','id'=>'CAT:-2','bare_id'=>-2,'type'=>'category','unread'=>6,'items'=>[['name'=>'Fascinating','id'=>'FEED:-1027','bare_id'=>-1027,'unread'=>0,'icon'=>'images/label.png','type'=>'feed','auxcounter'=>0,'error'=>'','updated'=>'','fg_color'=>'','bg_color'=>'',],['name'=>'Interesting','id'=>'FEED:-1029','bare_id'=>-1029,'unread'=>0,'icon'=>'images/label.png','type'=>'feed','auxcounter'=>0,'error'=>'','updated'=>'','fg_color'=>'','bg_color'=>'',],['name'=>'Logical','id'=>'FEED:-1025','bare_id'=>-1025,'unread'=>0,'icon'=>'images/label.png','type'=>'feed','auxcounter'=>0,'error'=>'','updated'=>'','fg_color'=>'','bg_color'=>'',],],],['name'=>'Politics','id'=>'CAT:3','bare_id'=>3,'parent_id'=>null,'type'=>'category','auxcounter'=>0,'unread'=>0,'child_unread'=>0,'checkbox'=>false,'param'=>'(3 feeds)','items'=>[['name'=>'Local','id'=>'CAT:5','bare_id'=>5,'parent_id'=>3,'type'=>'category','auxcounter'=>0,'unread'=>0,'child_unread'=>0,'checkbox'=>false,'param'=>'(1 feed)','items'=>[['name'=>'Toronto Star','id'=>'FEED:2','bare_id'=>2,'icon'=>'feed-icons/2.ico','error'=>'oops','param'=>'2011-11-11T11:11:11Z','unread'=>0,'auxcounter'=>0,'checkbox'=>false,],],],['name'=>'National','id'=>'CAT:6','bare_id'=>6,'parent_id'=>3,'type'=>'category','auxcounter'=>0,'unread'=>0,'child_unread'=>0,'checkbox'=>false,'param'=>'(2 feeds)','items'=>[['name'=>'CBC News','id'=>'FEED:4','bare_id'=>4,'icon'=>'feed-icons/4.ico','error'=>'','param'=>'2017-10-09T15:58:34Z','unread'=>0,'auxcounter'=>0,'checkbox'=>false,],['name'=>'Ottawa Citizen','id'=>'FEED:5','bare_id'=>5,'icon'=>false,'error'=>'','param'=>'2017-07-07T17:07:17Z','unread'=>0,'auxcounter'=>0,'checkbox'=>false,],],],],],['name'=>'Science','id'=>'CAT:1','bare_id'=>1,'parent_id'=>null,'type'=>'category','auxcounter'=>0,'unread'=>0,'child_unread'=>0,'checkbox'=>false,'param'=>'(2 feeds)','items'=>[['name'=>'Rocketry','id'=>'CAT:2','bare_id'=>2,'parent_id'=>1,'type'=>'category','auxcounter'=>0,'unread'=>0,'child_unread'=>0,'checkbox'=>false,'param'=>'(1 feed)','items'=>[['name'=>'NASA JPL','id'=>'FEED:1','bare_id'=>1,'icon'=>false,'error'=>'','param'=>'2017-09-15T22:54:16Z','unread'=>0,'auxcounter'=>0,'checkbox'=>false,],],],['name'=>'Ars Technica','id'=>'FEED:3','bare_id'=>3,'icon'=>'feed-icons/3.ico','error'=>'argh','param'=>'2016-05-23T06:40:02Z','unread'=>0,'auxcounter'=>0,'checkbox'=>false,],],],['name'=>'Uncategorized','id'=>'CAT:0','bare_id'=>0,'type'=>'category','auxcounter'=>0,'unread'=>0,'child_unread'=>0,'checkbox'=>false,'parent_id'=>null,'param'=>'(1 feed)','items'=>[['name'=>'Eurogamer','id'=>'FEED:6','bare_id'=>6,'icon'=>'feed-icons/6.ico','error'=>'','param'=>'2010-02-12T20:08:47Z','unread'=>0,'auxcounter'=>0,'checkbox'=>false,],],],],],];
$this->assertRespons e($this->respGood($exp), $this->req($in[1]));
$this->assertMessag e($this->respGood($exp), $this->req($in[1]));
}
public function testMarkFeedsAsRead() {
@ -1058,12 +1058,12 @@ LONG_STRING;
$exp = $this->respGood(['status' => "OK"]);
// verify the above are in fact no-ops
for ($a = 0; $a < sizeof ( $ in1 ) ; $ a + + ) {
$this->assertRespons e($exp, $this->req($in1[$a]), "Test $a failed");
$this->assertMessag e($exp, $this->req($in1[$a]), "Test $a failed");
}
Phake::verify(Arsse::$db, Phake::times(0))->articleMark;
// verify the simple contexts
for ($a = 0; $a < sizeof ( $ in2 ) ; $ a + + ) {
$this->assertRespons e($exp, $this->req($in2[$a]), "Test $a failed");
$this->assertMessag e($exp, $this->req($in2[$a]), "Test $a failed");
}
Phake::verify(Arsse::$db)->articleMark($this->anything(), ['read' => true], new Context);
Phake::verify(Arsse::$db)->articleMark($this->anything(), ['read' => true], (new Context)->starred(true));
@ -1075,7 +1075,7 @@ LONG_STRING;
// verify the time-based mock
$t = Date::sub("PT24H");
for ($a = 0; $a < sizeof ( $ in3 ) ; $ a + + ) {
$this->assertRespons e($exp, $this->req($in3[$a]), "Test $a failed");
$this->assertMessag e($exp, $this->req($in3[$a]), "Test $a failed");
}
Phake::verify(Arsse::$db)->articleMark($this->anything(), ['read' => true], (new Context)->modifiedSince($t));
}
@ -1210,10 +1210,10 @@ LONG_STRING;
],
];
for ($a = 0; $a < sizeof ( $ in1 ) ; $ a + + ) {
$this->assertRespons e($this->respGood($exp[$a]), $this->req($in1[$a]), "Test $a failed");
$this->assertMessag e($this->respGood($exp[$a]), $this->req($in1[$a]), "Test $a failed");
}
for ($a = 0; $a < sizeof ( $ in2 ) ; $ a + + ) {
$this->assertRespons e($this->respGood([]), $this->req($in2[$a]), "Test $a failed");
$this->assertMessag e($this->respGood([]), $this->req($in2[$a]), "Test $a failed");
}
}
@ -1323,7 +1323,7 @@ LONG_STRING;
$this->respErr("INCORRECT_USAGE"),
];
for ($a = 0; $a < sizeof ( $ in ) ; $ a + + ) {
$this->assertRespons e($out[$a], $this->req($in[$a]), "Test $a failed");
$this->assertMessag e($out[$a], $this->req($in[$a]), "Test $a failed");
}
}
@ -1347,10 +1347,10 @@ LONG_STRING;
Phake::when(Arsse::$db)->articleList($this->anything(), (new Context)->articles([101]))->thenReturn(new Result([$this->articles[0]]));
Phake::when(Arsse::$db)->articleList($this->anything(), (new Context)->articles([102]))->thenReturn(new Result([$this->articles[1]]));
$exp = $this->respErr("INCORRECT_USAGE");
$this->assertRespons e($exp, $this->req($in[0]));
$this->assertRespons e($exp, $this->req($in[1]));
$this->assertRespons e($exp, $this->req($in[2]));
$this->assertRespons e($exp, $this->req($in[3]));
$this->assertMessag e($exp, $this->req($in[0]));
$this->assertMessag e($exp, $this->req($in[1]));
$this->assertMessag e($exp, $this->req($in[2]));
$this->assertMessag e($exp, $this->req($in[3]));
$exp = [
[
'id' => "101",
@ -1407,13 +1407,13 @@ LONG_STRING;
'content' => '< p > Article content 2< / p > ',
],
];
$this->assertRespons e($this->respGood($exp), $this->req($in[4]));
$this->assertRespons e($this->respGood([$exp[0]]), $this->req($in[5]));
$this->assertRespons e($this->respGood([$exp[1]]), $this->req($in[6]));
$this->assertMessag e($this->respGood($exp), $this->req($in[4]));
$this->assertMessag e($this->respGood([$exp[0]]), $this->req($in[5]));
$this->assertMessag e($this->respGood([$exp[1]]), $this->req($in[6]));
// test the special case when labels are not used
Phake::when(Arsse::$db)->labelList($this->anything())->thenReturn(new Result([]));
Phake::when(Arsse::$db)->labelList($this->anything(), false)->thenReturn(new Result([]));
$this->assertRespons e($this->respGood([$exp[0]]), $this->req($in[5]));
$this->assertMessag e($this->respGood([$exp[0]]), $this->req($in[5]));
}
public function testRetrieveCompactHeadlines() {
@ -1492,13 +1492,13 @@ LONG_STRING;
$this->respGood([['id' => 1003]]),
];
for ($a = 0; $a < sizeof ( $ in1 ) ; $ a + + ) {
$this->assertRespons e($out1[$a], $this->req($in1[$a]), "Test $a failed");
$this->assertMessag e($out1[$a], $this->req($in1[$a]), "Test $a failed");
}
for ($a = 0; $a < sizeof ( $ in2 ) ; $ a + + ) {
Phake::when(Arsse::$db)->articleList($this->anything(), (clone $c)->unread(false)->markedSince(Date::sub("PT24H")), Database::LIST_MINIMAL)->thenReturn(new Result([['id' => 1001]]));
Phake::when(Arsse::$db)->articleList($this->anything(), (clone $c)->unread(true)->modifiedSince(Date::sub("PT24H")), Database::LIST_MINIMAL)->thenReturn(new Result([['id' => 1002]]));
Phake::when(Arsse::$db)->articleList($this->anything(), (clone $c)->unread(true)->modifiedSince(Date::sub("PT24H"))->starred(true), Database::LIST_MINIMAL)->thenReturn(new Result([['id' => 1003]]));
$this->assertRespons e($out2[$a], $this->req($in2[$a]), "Test $a failed");
$this->assertMessag e($out2[$a], $this->req($in2[$a]), "Test $a failed");
}
}
@ -1600,16 +1600,16 @@ LONG_STRING;
$this->outputHeadlines(1003),
];
for ($a = 0; $a < sizeof ( $ in1 ) ; $ a + + ) {
$this->assertRespons e($this->respGood([]), $this->req($in1[$a]), "Test $a failed");
$this->assertMessag e($this->respGood([]), $this->req($in1[$a]), "Test $a failed");
}
for ($a = 0; $a < sizeof ( $ in2 ) ; $ a + + ) {
$this->assertRespons e($out2[$a], $this->req($in2[$a]), "Test $a failed");
$this->assertMessag e($out2[$a], $this->req($in2[$a]), "Test $a failed");
}
for ($a = 0; $a < sizeof ( $ in3 ) ; $ a + + ) {
Phake::when(Arsse::$db)->articleList($this->anything(), (clone $c)->unread(false)->markedSince(Date::sub("PT24H")), Database::LIST_FULL)->thenReturn($this->generateHeadlines(1001));
Phake::when(Arsse::$db)->articleList($this->anything(), (clone $c)->unread(true)->modifiedSince(Date::sub("PT24H")), Database::LIST_FULL)->thenReturn($this->generateHeadlines(1002));
Phake::when(Arsse::$db)->articleList($this->anything(), (clone $c)->unread(true)->modifiedSince(Date::sub("PT24H"))->starred(true), Database::LIST_FULL)->thenReturn($this->generateHeadlines(1003));
$this->assertRespons e($out3[$a], $this->req($in3[$a]), "Test $a failed");
$this->assertMessag e($out3[$a], $this->req($in3[$a]), "Test $a failed");
}
}
@ -1639,7 +1639,7 @@ LONG_STRING;
Phake::when(Arsse::$db)->articleCount($this->anything(), (new Context)->unread(true))->thenReturn(1);
// sanity check; this makes sure extra fields are not included in default situations
$test = $this->req($in[0]);
$this->assertRespons e($this->outputHeadlines(1), $test);
$this->assertMessag e($this->outputHeadlines(1), $test);
// test 'show_content'
$test = $this->req($in[1]);
$this->assertArrayHasKey("content", $test->getPayload()['content'][0]);
@ -1671,21 +1671,21 @@ LONG_STRING;
['id' => -4, 'is_cat' => false, 'first_id' => 1],
$this->outputHeadlines(1)->getPayload()['content'],
]);
$this->assertRespons e($exp, $test);
$this->assertMessag e($exp, $test);
// test 'include_header' with a category
$test = $this->req($in[4]);
$exp = $this->respGood([
['id' => -3, 'is_cat' => true, 'first_id' => 1],
$this->outputHeadlines(1)->getPayload()['content'],
]);
$this->assertRespons e($exp, $test);
$this->assertMessag e($exp, $test);
// test 'include_header' with an empty result
$test = $this->req($in[5]);
$exp = $this->respGood([
['id' => -1, 'is_cat' => true, 'first_id' => 0],
[],
]);
$this->assertRespons e($exp, $test);
$this->assertMessag e($exp, $test);
// test 'include_header' with an erroneous result
Phake::when(Arsse::$db)->articleList($this->anything(), (new Context)->limit(200)->reverse(true)->subscription(2112), $this->anything())->thenThrow(new ExceptionInput("subjectMissing"));
$test = $this->req($in[6]);
@ -1693,14 +1693,14 @@ LONG_STRING;
['id' => 2112, 'is_cat' => false, 'first_id' => 0],
[],
]);
$this->assertRespons e($exp, $test);
$this->assertMessag e($exp, $test);
// test 'include_header' with ascending order
$test = $this->req($in[7]);
$exp = $this->respGood([
['id' => -4, 'is_cat' => false, 'first_id' => 0],
$this->outputHeadlines(1)->getPayload()['content'],
]);
$this->assertRespons e($exp, $test);
$this->assertMessag e($exp, $test);
// test 'include_header' with skip
Phake::when(Arsse::$db)->articleList($this->anything(), (new Context)->reverse(true)->limit(1)->subscription(42), Database::LIST_MINIMAL)->thenReturn($this->generateHeadlines(1867));
$test = $this->req($in[8]);
@ -1708,14 +1708,14 @@ LONG_STRING;
['id' => 42, 'is_cat' => false, 'first_id' => 1867],
$this->outputHeadlines(1)->getPayload()['content'],
]);
$this->assertRespons e($exp, $test);
$this->assertMessag e($exp, $test);
// test 'include_header' with skip and ascending order
$test = $this->req($in[9]);
$exp = $this->respGood([
['id' => 42, 'is_cat' => false, 'first_id' => 0],
$this->outputHeadlines(1)->getPayload()['content'],
]);
$this->assertRespons e($exp, $test);
$this->assertMessag e($exp, $test);
// test 'show_excerpt'
$exp1 = "“This & that, you know‽”";
$exp2 = "Pour vous faire mieux connaitre d’ou\u{300} vient l’erreur de ceux qui bla\u{302}ment la volupte\u{301}, et qui louent en…";