1
1
Fork 0
mirror of https://code.mensbeam.com/MensBeam/Arsse.git synced 2024-12-24 09:32:40 +00:00
Arsse/tests/REST/NextCloudNews/TestNCNVersionDiscovery.php

48 lines
1.4 KiB
PHP
Raw Normal View History

<?php
/** @license MIT
* Copyright 2017 J. King, Dustin Wilson et al.
* See LICENSE and AUTHORS files for details */
declare(strict_types=1);
2017-03-28 04:12:12 +00:00
namespace JKingWeb\Arsse;
2017-08-29 14:50:31 +00:00
use JKingWeb\Arsse\REST\Request;
use JKingWeb\Arsse\REST\Response;
2017-07-20 22:36:03 +00:00
/** @covers \JKingWeb\Arsse\REST\NextCloudNews\Versions */
class TestNCNVersionDiscovery extends Test\AbstractTest {
2017-08-29 14:50:31 +00:00
public function setUp() {
$this->clearData();
}
2017-08-29 14:50:31 +00:00
public function testFetchVersionList() {
$exp = new Response(200, ['apiLevels' => ['v1-2']]);
$h = new REST\NextCloudNews\Versions();
$req = new Request("GET", "/");
$res = $h->dispatch($req);
$this->assertEquals($exp, $res);
$req = new Request("GET", "");
$res = $h->dispatch($req);
$this->assertEquals($exp, $res);
$req = new Request("GET", "/?id=1827");
$res = $h->dispatch($req);
$this->assertEquals($exp, $res);
}
2017-08-29 14:50:31 +00:00
public function testUseIncorrectMethod() {
2017-09-29 22:11:39 +00:00
$exp = new Response(405, "", "", ["Allow: GET"]);
$h = new REST\NextCloudNews\Versions();
$req = new Request("POST", "/");
$res = $h->dispatch($req);
$this->assertEquals($exp, $res);
}
2017-08-29 14:50:31 +00:00
public function testUseIncorrectPath() {
$exp = new Response(501);
$h = new REST\NextCloudNews\Versions();
$req = new Request("GET", "/ook");
$res = $h->dispatch($req);
$this->assertEquals($exp, $res);
}
2017-08-29 14:50:31 +00:00
}