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

Relegate bootstrap.php to testing; fixes #117

This commit is contained in:
J. King 2017-10-01 09:33:49 -04:00
parent bf35e0ecc8
commit 1b72d45adf
11 changed files with 25 additions and 21 deletions

View file

@ -1,7 +1,12 @@
<?php
namespace JKingWeb\Arsse;
require_once __DIR__.DIRECTORY_SEPARATOR."bootstrap.php";
const BASE = __DIR__.DIRECTORY_SEPARATOR;
const NS_BASE = __NAMESPACE__."\\";
require_once BASE."vendor".DIRECTORY_SEPARATOR."autoload.php";
ignore_user_abort(true);
if (\PHP_SAPI=="cli") {
// initialize the CLI; this automatically handles --help and --version

View file

@ -1,10 +0,0 @@
<?php
declare(strict_types=1);
namespace JKingWeb\Arsse;
const BASE = __DIR__.DIRECTORY_SEPARATOR;
const NS_BASE = __NAMESPACE__."\\";
const VERSION = "0.1.1";
require_once BASE."vendor".DIRECTORY_SEPARATOR."autoload.php";
ignore_user_abort(true);

View file

@ -10,7 +10,6 @@
<include name="dist/**"/>
<include name="composer.*"/>
<include name="arsse.php"/>
<include name="bootstrap.php"/>
<include name="CHANGELOG"/>
<include name="LICENSE"/>
<include name="README.md"/>

View file

@ -3,6 +3,8 @@ declare(strict_types=1);
namespace JKingWeb\Arsse;
class Arsse {
const VERSION = "0.1.1";
/** @var Lang */
public static $lang;
/** @var Conf */

View file

@ -27,7 +27,7 @@ USAGE_TEXT;
$this->args = \Docopt::handle($this->usage(), [
'argv' => $argv,
'help' => true,
'version' => VERSION,
'version' => Arsse::VERSION,
]);
}

View file

@ -24,7 +24,7 @@ class Feed {
public function __construct(int $feedID = null, string $url, string $lastModified = '', string $etag = '', string $username = '', string $password = '', bool $scrape = false, bool $discover = false) {
// set the configuration
$userAgent = Arsse::$conf->fetchUserAgentString ?? sprintf('Arsse/%s (%s %s; %s; https://code.jkingweb.ca/jking/arsse) PicoFeed (https://github.com/fguillot/picoFeed)',
VERSION, // Arsse version
Arsse::VERSION, // Arsse version
php_uname('s'), // OS
php_uname('r'), // OS version
php_uname('m') // platform architecture

View file

@ -691,14 +691,14 @@ class V1_2 extends \JKingWeb\Arsse\REST\AbstractHandler {
protected function serverVersion(array $url, array $data): Response {
return new Response(200, [
'version' => self::VERSION,
'arsse_version' => \JKingWeb\Arsse\VERSION,
'arsse_version' => Arsse::VERSION,
]);
}
protected function serverStatus(array $url, array $data): Response {
return new Response(200, [
'version' => self::VERSION,
'arsse_version' => \JKingWeb\Arsse\VERSION,
'arsse_version' => Arsse::VERSION,
'warnings' => [
'improperlyConfiguredCron' => !Service::hasCheckedIn(),
]

View file

@ -458,7 +458,7 @@ class TestNCNV1_2 extends Test\AbstractTest {
public function testRetrieveServerVersion() {
$exp = new Response(200, [
'arsse_version' => \JKingWeb\Arsse\VERSION,
'arsse_version' => Arsse::VERSION,
'version' => REST\NextCloudNews\V1_2::VERSION,
]);
$this->assertEquals($exp, $this->h->dispatch(new Request("GET", "/version")));
@ -842,7 +842,7 @@ class TestNCNV1_2 extends Test\AbstractTest {
Phake::when(Arsse::$db)->metaGet("service_last_checkin")->thenReturn(Date::transform($valid, "sql"))->thenReturn(Date::transform($invalid, "sql"));
$arr1 = $arr2 = [
'version' => REST\NextCloudNews\V1_2::VERSION,
'arsse_version' => VERSION,
'arsse_version' => Arsse::VERSION,
'warnings' => [
'improperlyConfiguredCron' => false,
]

8
tests/bootstrap.php Normal file
View file

@ -0,0 +1,8 @@
<?php
declare(strict_types=1);
namespace JKingWeb\Arsse;
const NS_BASE = __NAMESPACE__."\\";
define(NS_BASE."BASE", dirname(__DIR__).DIRECTORY_SEPARATOR);
require_once BASE."vendor".DIRECTORY_SEPARATOR."autoload.php";

View file

@ -1,7 +1,7 @@
<?xml version="1.0"?>
<phpunit
colors="true"
bootstrap="../bootstrap.php"
bootstrap="bootstrap.php"
convertErrorsToExceptions="false"
convertNoticesToExceptions="false"
convertWarningsToExceptions="false"

View file

@ -2,7 +2,7 @@
declare(strict_types=1);
namespace JKingWeb\Arsse;
require_once __DIR__."/../bootstrap.php";
require_once __DIR__."/bootstrap.php";
/*