From 1b72d45adf4cf1f4fe89843a0651e8e2a44c67b2 Mon Sep 17 00:00:00 2001 From: "J. King" Date: Sun, 1 Oct 2017 09:33:49 -0400 Subject: [PATCH] Relegate bootstrap.php to testing; fixes #117 --- arsse.php | 7 ++++++- bootstrap.php | 10 ---------- build.xml | 1 - lib/Arsse.php | 2 ++ lib/CLI.php | 2 +- lib/Feed.php | 4 ++-- lib/REST/NextCloudNews/V1_2.php | 4 ++-- tests/REST/NextCloudNews/TestNCNV1_2.php | 4 ++-- tests/bootstrap.php | 8 ++++++++ tests/phpunit.xml | 2 +- tests/server.php | 2 +- 11 files changed, 25 insertions(+), 21 deletions(-) delete mode 100644 bootstrap.php create mode 100644 tests/bootstrap.php diff --git a/arsse.php b/arsse.php index 8634bf57..c1fd5086 100644 --- a/arsse.php +++ b/arsse.php @@ -1,7 +1,12 @@ - diff --git a/lib/Arsse.php b/lib/Arsse.php index 2475ed63..a453bd7e 100644 --- a/lib/Arsse.php +++ b/lib/Arsse.php @@ -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 */ diff --git a/lib/CLI.php b/lib/CLI.php index 971197fc..36aa8db6 100644 --- a/lib/CLI.php +++ b/lib/CLI.php @@ -27,7 +27,7 @@ USAGE_TEXT; $this->args = \Docopt::handle($this->usage(), [ 'argv' => $argv, 'help' => true, - 'version' => VERSION, + 'version' => Arsse::VERSION, ]); } diff --git a/lib/Feed.php b/lib/Feed.php index ee6114cb..f256016b 100644 --- a/lib/Feed.php +++ b/lib/Feed.php @@ -20,11 +20,11 @@ class Feed { public $nextFetch; public $newItems = []; public $changedItems = []; - + 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 diff --git a/lib/REST/NextCloudNews/V1_2.php b/lib/REST/NextCloudNews/V1_2.php index 8ece274b..bab902e1 100644 --- a/lib/REST/NextCloudNews/V1_2.php +++ b/lib/REST/NextCloudNews/V1_2.php @@ -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(), ] diff --git a/tests/REST/NextCloudNews/TestNCNV1_2.php b/tests/REST/NextCloudNews/TestNCNV1_2.php index 713267b8..0d8e08ed 100644 --- a/tests/REST/NextCloudNews/TestNCNV1_2.php +++ b/tests/REST/NextCloudNews/TestNCNV1_2.php @@ -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, ] diff --git a/tests/bootstrap.php b/tests/bootstrap.php new file mode 100644 index 00000000..c74e5515 --- /dev/null +++ b/tests/bootstrap.php @@ -0,0 +1,8 @@ +