The clean & modern RSS server that doesn't give you any crap.
https://thearsse.com/
You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
74 lines
2.3 KiB
74 lines
2.3 KiB
7 years ago
|
<?php
|
||
7 years ago
|
/** @license MIT
|
||
|
* Copyright 2017 J. King, Dustin Wilson et al.
|
||
|
* See LICENSE and AUTHORS files for details */
|
||
|
|
||
7 years ago
|
declare(strict_types=1);
|
||
|
namespace JKingWeb\Arsse;
|
||
|
|
||
7 years ago
|
use Phake;
|
||
7 years ago
|
|
||
7 years ago
|
/** @covers \JKingWeb\Arsse\Feed */
|
||
7 years ago
|
class TestFeedFetching extends Test\AbstractTest {
|
||
7 years ago
|
protected static $host = "http://localhost:8000/";
|
||
|
protected $base = "";
|
||
|
|
||
7 years ago
|
public function setUp() {
|
||
|
if (!extension_loaded('curl')) {
|
||
7 years ago
|
$this->markTestSkipped("Feed fetching tests are only accurate with curl enabled.");
|
||
7 years ago
|
} elseif (!@file_get_contents(self::$host."IsUp")) {
|
||
7 years ago
|
$this->markTestSkipped("Test Web server is not accepting requests");
|
||
|
}
|
||
|
$this->base = self::$host."Feed/";
|
||
|
$this->clearData();
|
||
7 years ago
|
Arsse::$conf = new Conf();
|
||
7 years ago
|
}
|
||
|
|
||
7 years ago
|
public function testHandle400() {
|
||
7 years ago
|
$this->assertException("unsupportedFeedFormat", "Feed");
|
||
|
new Feed(null, $this->base."Fetching/Error?code=400");
|
||
|
}
|
||
|
|
||
7 years ago
|
public function testHandle401() {
|
||
7 years ago
|
$this->assertException("unauthorized", "Feed");
|
||
|
new Feed(null, $this->base."Fetching/Error?code=401");
|
||
|
}
|
||
|
|
||
7 years ago
|
public function testHandle403() {
|
||
7 years ago
|
$this->assertException("forbidden", "Feed");
|
||
|
new Feed(null, $this->base."Fetching/Error?code=403");
|
||
|
}
|
||
|
|
||
7 years ago
|
public function testHandle404() {
|
||
7 years ago
|
$this->assertException("invalidUrl", "Feed");
|
||
|
new Feed(null, $this->base."Fetching/Error?code=404");
|
||
|
}
|
||
|
|
||
7 years ago
|
public function testHandle500() {
|
||
7 years ago
|
$this->assertException("unsupportedFeedFormat", "Feed");
|
||
|
new Feed(null, $this->base."Fetching/Error?code=500");
|
||
|
}
|
||
|
|
||
7 years ago
|
public function testHandleARedirectLoop() {
|
||
7 years ago
|
$this->assertException("maxRedirect", "Feed");
|
||
|
new Feed(null, $this->base."Fetching/EndlessLoop?i=0");
|
||
|
}
|
||
|
|
||
7 years ago
|
public function testHandleATimeout() {
|
||
7 years ago
|
Arsse::$conf->fetchTimeout = 1;
|
||
7 years ago
|
$this->assertException("timeout", "Feed");
|
||
|
new Feed(null, $this->base."Fetching/Timeout");
|
||
|
}
|
||
|
|
||
7 years ago
|
public function testHandleAnOverlyLargeFeed() {
|
||
7 years ago
|
Arsse::$conf->fetchSizeLimit = 512;
|
||
7 years ago
|
$this->assertException("maxSize", "Feed");
|
||
|
new Feed(null, $this->base."Fetching/TooLarge");
|
||
|
}
|
||
|
|
||
7 years ago
|
public function testHandleACertificateError() {
|
||
7 years ago
|
$this->assertException("invalidCertificate", "Feed");
|
||
|
new Feed(null, "https://localhost:8000/");
|
||
|
}
|
||
7 years ago
|
}
|