mirror of
https://code.mensbeam.com/MensBeam/Arsse.git
synced 2024-12-22 13:12:41 +00:00
Coverage fixes and OPML bugfix
This commit is contained in:
parent
b8b8a6aa70
commit
64c3ec3571
9 changed files with 20 additions and 25 deletions
|
@ -3,6 +3,7 @@ Version 0.8.1 (2019-??-??)
|
|||
|
||||
Bug fixes:
|
||||
- Don't crash updating feeds cached solely via ETag
|
||||
- Don't fail importing new folders from OPML files
|
||||
- Don't fail adding a feed which collides with another via redirection
|
||||
- Don't fail on very long text-search queries containing question marks
|
||||
when using PostgreSQL or MySQL
|
||||
|
|
|
@ -5,6 +5,7 @@ use Robo\Result;
|
|||
const BASE = __DIR__.\DIRECTORY_SEPARATOR;
|
||||
const BASE_TEST = BASE."tests".\DIRECTORY_SEPARATOR;
|
||||
define("IS_WIN", defined("PHP_WINDOWS_VERSION_MAJOR"));
|
||||
define("IS_MAC", php_uname("s") === "Darwin");
|
||||
|
||||
function norm(string $path): string {
|
||||
$out = realpath($path);
|
||||
|
@ -92,12 +93,13 @@ class RoboFile extends \Robo\Tasks {
|
|||
$dbg = dirname(\PHP_BINARY)."\\phpdbg.exe";
|
||||
$dbg = file_exists($dbg) ? $dbg : "";
|
||||
} else {
|
||||
$dbg = trim(`which phpdbg`);
|
||||
$dbg = trim(`which phpdbg 2>/dev/null`);
|
||||
}
|
||||
if ($dbg) {
|
||||
return escapeshellarg($dbg)." -qrr";
|
||||
} else {
|
||||
return escapeshellarg(\PHP_BINARY);
|
||||
$ext = IS_WIN ? "dll" : (IS_MAC ? "dylib" : "so");
|
||||
return escapeshellarg(\PHP_BINARY)." -d zend_extension=xdebug.$ext";
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -206,7 +206,7 @@ USAGE_TEXT;
|
|||
$this->logError($e->getMessage());
|
||||
return $e->getCode();
|
||||
}
|
||||
}
|
||||
} // @codeCoverageIgnore
|
||||
|
||||
/** @codeCoverageIgnore */
|
||||
protected function logError(string $msg) {
|
||||
|
@ -248,7 +248,7 @@ USAGE_TEXT;
|
|||
case "":
|
||||
return $this->userList();
|
||||
}
|
||||
}
|
||||
} // @codeCoverageIgnore
|
||||
|
||||
protected function userAddOrSetPassword(string $method, string $user, string $password = null, string $oldpass = null): int {
|
||||
$passwd = Arsse::$user->$method(...array_slice(func_get_args(), 1));
|
||||
|
|
|
@ -57,7 +57,7 @@ abstract class AbstractImportExport {
|
|||
}
|
||||
if (!isset($folderMap[$id])) {
|
||||
// if no existing folder exists, add one
|
||||
$folderMap[$id] = Arsse::$db->folderAdd($user, ['name' => $f['name'], 'parent' -> $parent]);
|
||||
$folderMap[$id] = Arsse::$db->folderAdd($user, ['name' => $f['name'], 'parent' => $parent]);
|
||||
}
|
||||
}
|
||||
// process newsfeed subscriptions
|
||||
|
@ -118,21 +118,21 @@ abstract class AbstractImportExport {
|
|||
foreach (array_diff(array_column($feedsDb, "id"), $feedMap) as $id) {
|
||||
try {
|
||||
Arsse::$db->subscriptionRemove($user, $id);
|
||||
} catch (InputException $e) {
|
||||
} catch (InputException $e) { // @codeCoverageIgnore
|
||||
// ignore errors
|
||||
}
|
||||
}
|
||||
foreach (array_diff(array_column($foldersDb, "id"), $folderMap) as $id) {
|
||||
try {
|
||||
Arsse::$db->folderRemove($user, $id);
|
||||
} catch (InputException $e) {
|
||||
} catch (InputException $e) { // @codeCoverageIgnore
|
||||
// ignore errors
|
||||
}
|
||||
}
|
||||
foreach (array_diff(array_column($tagsDb, "name"), array_keys($tagMap)) as $id) {
|
||||
try {
|
||||
Arsse::$db->tagRemove($user, $id, true);
|
||||
} catch (InputException $e) {
|
||||
} catch (InputException $e) { // @codeCoverageIgnore
|
||||
// ignore errors
|
||||
}
|
||||
}
|
||||
|
|
|
@ -207,7 +207,8 @@ class API extends \JKingWeb\Arsse\REST\AbstractHandler {
|
|||
// indexed arrays
|
||||
$p->appendChild($this->makeXMLIndexed($v, $d->createElement($k), substr($k, 0, strlen($k) - 1)));
|
||||
} else {
|
||||
$p->appendChild($this->makeXMLAssoc($v, $d->createElement($k)));
|
||||
// this case does not actually occur in a proper Fever response
|
||||
$p->appendChild($this->makeXMLAssoc($v, $d->createElement($k))); // @codeCoverageIgnore
|
||||
}
|
||||
}
|
||||
return $p;
|
||||
|
|
|
@ -212,11 +212,13 @@ class TestImportExport extends \JKingWeb\Arsse\Test\AbstractTest {
|
|||
['id' => 4, 'name' => "Politics", 'parent' => 0],
|
||||
['id' => 5, 'name' => "Local", 'parent' => 4],
|
||||
['id' => 6, 'name' => "National", 'parent' => 4],
|
||||
['id' => 7, 'name' => "Nature", 'parent' => 0], // new folder
|
||||
]];
|
||||
\Phake::when($this->proc)->parse->thenReturn($in);
|
||||
$this->proc->import("john.doe@example.com", "", false, true);
|
||||
$exp = $this->primeExpectations($this->data, $this->checkTables);
|
||||
$exp['arsse_subscriptions']['rows'][3] = [4, "john.doe@example.com", null, 4, "CBC"];
|
||||
$exp['arsse_folders']['rows'][] = [7, "john.doe@example.com", null, "Nature"];
|
||||
$this->compareExpectations($this->drv, $exp);
|
||||
}
|
||||
|
||||
|
|
|
@ -9,6 +9,7 @@ namespace JKingWeb\Arsse\Test\Lang;
|
|||
use JKingWeb\Arsse\Lang;
|
||||
use JKingWeb\Arsse\Arsse;
|
||||
use org\bovigo\vfs\vfsStream;
|
||||
use Webmozart\Glob\Glob;
|
||||
|
||||
trait Setup {
|
||||
public function setUp() {
|
||||
|
@ -36,7 +37,10 @@ trait Setup {
|
|||
// set up a file without read access
|
||||
chmod($this->path."ru.php", 0000);
|
||||
// make the test Lang class use the vfs files
|
||||
$this->l = new TestLang($this->path);
|
||||
$this->l = \Phake::partialMock(Lang::class, $this->path);
|
||||
\Phake::when($this->l)->globFiles->thenReturnCallback(function(string $path): array {
|
||||
return Glob::glob($this->path."*.php");
|
||||
});
|
||||
// create a mock Lang object so as not to create a dependency loop
|
||||
self::clearData(false);
|
||||
Arsse::$lang = \Phake::mock(Lang::class);
|
||||
|
|
|
@ -1,15 +0,0 @@
|
|||
<?php
|
||||
/** @license MIT
|
||||
* Copyright 2017 J. King, Dustin Wilson et al.
|
||||
* See LICENSE and AUTHORS files for details */
|
||||
|
||||
declare(strict_types=1);
|
||||
namespace JKingWeb\Arsse\Test\Lang;
|
||||
|
||||
use Webmozart\Glob\Glob;
|
||||
|
||||
class TestLang extends \JKingWeb\Arsse\Lang {
|
||||
protected function globFiles(string $path): array {
|
||||
return Glob::glob($this->path."*.php");
|
||||
}
|
||||
}
|
Loading…
Reference in a new issue