Update vendor
This commit is contained in:
parent
60d125a05e
commit
79862f61b4
2
vendor/autoload.php
vendored
2
vendor/autoload.php
vendored
@ -4,4 +4,4 @@
|
|||||||
|
|
||||||
require_once __DIR__ . '/composer' . '/autoload_real.php';
|
require_once __DIR__ . '/composer' . '/autoload_real.php';
|
||||||
|
|
||||||
return ComposerAutoloaderInit5f8b99c769a3ccbc962bd7a5595128da::getLoader();
|
return ComposerAutoloaderInit08690efdd2fbfd1e6b9f9841af6f8e3c::getLoader();
|
||||||
|
10
vendor/composer/autoload_real.php
vendored
10
vendor/composer/autoload_real.php
vendored
@ -2,7 +2,7 @@
|
|||||||
|
|
||||||
// autoload_real.php @generated by Composer
|
// autoload_real.php @generated by Composer
|
||||||
|
|
||||||
class ComposerAutoloaderInit5f8b99c769a3ccbc962bd7a5595128da
|
class ComposerAutoloaderInit08690efdd2fbfd1e6b9f9841af6f8e3c
|
||||||
{
|
{
|
||||||
private static $loader;
|
private static $loader;
|
||||||
|
|
||||||
@ -19,9 +19,9 @@ class ComposerAutoloaderInit5f8b99c769a3ccbc962bd7a5595128da
|
|||||||
return self::$loader;
|
return self::$loader;
|
||||||
}
|
}
|
||||||
|
|
||||||
spl_autoload_register(array('ComposerAutoloaderInit5f8b99c769a3ccbc962bd7a5595128da', 'loadClassLoader'), true, true);
|
spl_autoload_register(array('ComposerAutoloaderInit08690efdd2fbfd1e6b9f9841af6f8e3c', 'loadClassLoader'), true, true);
|
||||||
self::$loader = $loader = new \Composer\Autoload\ClassLoader();
|
self::$loader = $loader = new \Composer\Autoload\ClassLoader();
|
||||||
spl_autoload_unregister(array('ComposerAutoloaderInit5f8b99c769a3ccbc962bd7a5595128da', 'loadClassLoader'));
|
spl_autoload_unregister(array('ComposerAutoloaderInit08690efdd2fbfd1e6b9f9841af6f8e3c', 'loadClassLoader'));
|
||||||
|
|
||||||
$map = require __DIR__ . '/autoload_namespaces.php';
|
$map = require __DIR__ . '/autoload_namespaces.php';
|
||||||
foreach ($map as $namespace => $path) {
|
foreach ($map as $namespace => $path) {
|
||||||
@ -42,14 +42,14 @@ class ComposerAutoloaderInit5f8b99c769a3ccbc962bd7a5595128da
|
|||||||
|
|
||||||
$includeFiles = require __DIR__ . '/autoload_files.php';
|
$includeFiles = require __DIR__ . '/autoload_files.php';
|
||||||
foreach ($includeFiles as $file) {
|
foreach ($includeFiles as $file) {
|
||||||
composerRequire5f8b99c769a3ccbc962bd7a5595128da($file);
|
composerRequire08690efdd2fbfd1e6b9f9841af6f8e3c($file);
|
||||||
}
|
}
|
||||||
|
|
||||||
return $loader;
|
return $loader;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
function composerRequire5f8b99c769a3ccbc962bd7a5595128da($file)
|
function composerRequire08690efdd2fbfd1e6b9f9841af6f8e3c($file)
|
||||||
{
|
{
|
||||||
require $file;
|
require $file;
|
||||||
}
|
}
|
||||||
|
86
vendor/composer/installed.json
vendored
86
vendor/composer/installed.json
vendored
@ -1,43 +1,4 @@
|
|||||||
[
|
[
|
||||||
{
|
|
||||||
"name": "fguillot/picofarad",
|
|
||||||
"version": "dev-master",
|
|
||||||
"version_normalized": "9999999-dev",
|
|
||||||
"source": {
|
|
||||||
"type": "git",
|
|
||||||
"url": "https://github.com/fguillot/picoFarad.git",
|
|
||||||
"reference": "749506cd204ae05c3cc8894be1b4302b4aed6e53"
|
|
||||||
},
|
|
||||||
"dist": {
|
|
||||||
"type": "zip",
|
|
||||||
"url": "https://api.github.com/repos/fguillot/picoFarad/zipball/749506cd204ae05c3cc8894be1b4302b4aed6e53",
|
|
||||||
"reference": "749506cd204ae05c3cc8894be1b4302b4aed6e53",
|
|
||||||
"shasum": ""
|
|
||||||
},
|
|
||||||
"require": {
|
|
||||||
"php": ">=5.3.0"
|
|
||||||
},
|
|
||||||
"time": "2015-01-17 23:58:31",
|
|
||||||
"type": "library",
|
|
||||||
"installation-source": "dist",
|
|
||||||
"autoload": {
|
|
||||||
"psr-0": {
|
|
||||||
"PicoFarad": "lib/"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"notification-url": "https://packagist.org/downloads/",
|
|
||||||
"license": [
|
|
||||||
"Unlicense"
|
|
||||||
],
|
|
||||||
"authors": [
|
|
||||||
{
|
|
||||||
"name": "Frédéric Guillot",
|
|
||||||
"homepage": "http://fredericguillot.com"
|
|
||||||
}
|
|
||||||
],
|
|
||||||
"description": "Minimalist micro-framework",
|
|
||||||
"homepage": "https://github.com/fguillot/picoFarad"
|
|
||||||
},
|
|
||||||
{
|
{
|
||||||
"name": "fguillot/json-rpc",
|
"name": "fguillot/json-rpc",
|
||||||
"version": "dev-master",
|
"version": "dev-master",
|
||||||
@ -155,6 +116,45 @@
|
|||||||
"description": "Minimalist database query builder",
|
"description": "Minimalist database query builder",
|
||||||
"homepage": "https://github.com/fguillot/picoDb"
|
"homepage": "https://github.com/fguillot/picoDb"
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
"name": "fguillot/picofarad",
|
||||||
|
"version": "dev-master",
|
||||||
|
"version_normalized": "9999999-dev",
|
||||||
|
"source": {
|
||||||
|
"type": "git",
|
||||||
|
"url": "https://github.com/fguillot/picoFarad.git",
|
||||||
|
"reference": "1bc48a4367adf359f3439c2e0ae20a7d299d8ccd"
|
||||||
|
},
|
||||||
|
"dist": {
|
||||||
|
"type": "zip",
|
||||||
|
"url": "https://api.github.com/repos/fguillot/picoFarad/zipball/1bc48a4367adf359f3439c2e0ae20a7d299d8ccd",
|
||||||
|
"reference": "1bc48a4367adf359f3439c2e0ae20a7d299d8ccd",
|
||||||
|
"shasum": ""
|
||||||
|
},
|
||||||
|
"require": {
|
||||||
|
"php": ">=5.3.0"
|
||||||
|
},
|
||||||
|
"time": "2015-02-01 19:40:13",
|
||||||
|
"type": "library",
|
||||||
|
"installation-source": "dist",
|
||||||
|
"autoload": {
|
||||||
|
"psr-0": {
|
||||||
|
"PicoFarad": "lib/"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"notification-url": "https://packagist.org/downloads/",
|
||||||
|
"license": [
|
||||||
|
"Unlicense"
|
||||||
|
],
|
||||||
|
"authors": [
|
||||||
|
{
|
||||||
|
"name": "Frédéric Guillot",
|
||||||
|
"homepage": "http://fredericguillot.com"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"description": "Minimalist micro-framework",
|
||||||
|
"homepage": "https://github.com/fguillot/picoFarad"
|
||||||
|
},
|
||||||
{
|
{
|
||||||
"name": "fguillot/picofeed",
|
"name": "fguillot/picofeed",
|
||||||
"version": "dev-master",
|
"version": "dev-master",
|
||||||
@ -162,12 +162,12 @@
|
|||||||
"source": {
|
"source": {
|
||||||
"type": "git",
|
"type": "git",
|
||||||
"url": "https://github.com/fguillot/picoFeed.git",
|
"url": "https://github.com/fguillot/picoFeed.git",
|
||||||
"reference": "9253c3d5ff1148a5175bf24633b73725832437c8"
|
"reference": "7f45ed03621778b30db0ff89a09f98d67096c253"
|
||||||
},
|
},
|
||||||
"dist": {
|
"dist": {
|
||||||
"type": "zip",
|
"type": "zip",
|
||||||
"url": "https://api.github.com/repos/fguillot/picoFeed/zipball/9253c3d5ff1148a5175bf24633b73725832437c8",
|
"url": "https://api.github.com/repos/fguillot/picoFeed/zipball/7f45ed03621778b30db0ff89a09f98d67096c253",
|
||||||
"reference": "9253c3d5ff1148a5175bf24633b73725832437c8",
|
"reference": "7f45ed03621778b30db0ff89a09f98d67096c253",
|
||||||
"shasum": ""
|
"shasum": ""
|
||||||
},
|
},
|
||||||
"require": {
|
"require": {
|
||||||
@ -178,7 +178,7 @@
|
|||||||
"ext-xml": "*",
|
"ext-xml": "*",
|
||||||
"php": ">=5.3.0"
|
"php": ">=5.3.0"
|
||||||
},
|
},
|
||||||
"time": "2015-01-29 02:00:49",
|
"time": "2015-01-31 22:07:02",
|
||||||
"type": "library",
|
"type": "library",
|
||||||
"installation-source": "dist",
|
"installation-source": "dist",
|
||||||
"autoload": {
|
"autoload": {
|
||||||
|
@ -123,7 +123,7 @@ function csp(array $policies = array())
|
|||||||
|
|
||||||
foreach ($hosts as &$host) {
|
foreach ($hosts as &$host) {
|
||||||
|
|
||||||
if ($host === '*' || $host === 'self' || strpos($host, 'http') === 0) {
|
if ($host === '*' || $host === "'self'" || strpos($host, 'http') === 0) {
|
||||||
$acl .= $host.' ';
|
$acl .= $host.' ';
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -157,47 +157,14 @@ abstract class Client
|
|||||||
*/
|
*/
|
||||||
protected $status_code = 0;
|
protected $status_code = 0;
|
||||||
|
|
||||||
/**
|
|
||||||
* HTTP response body
|
|
||||||
*
|
|
||||||
* @access protected
|
|
||||||
* @var string
|
|
||||||
*/
|
|
||||||
protected $body = '';
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Body size
|
|
||||||
*
|
|
||||||
* @access protected
|
|
||||||
* @var integer
|
|
||||||
*/
|
|
||||||
protected $body_length = 0;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* HTTP response headers
|
|
||||||
*
|
|
||||||
* @access protected
|
|
||||||
* @var array
|
|
||||||
*/
|
|
||||||
protected $headers = array();
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Counter on the number of header received
|
|
||||||
*
|
|
||||||
* @access protected
|
|
||||||
* @var integer
|
|
||||||
*/
|
|
||||||
protected $headers_counter = 0;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Do the HTTP request
|
* Do the HTTP request
|
||||||
*
|
*
|
||||||
* @abstract
|
* @abstract
|
||||||
* @access public
|
* @access public
|
||||||
* @param bool $follow_location Flag used when there is an open_basedir restriction
|
|
||||||
* @return array
|
* @return array
|
||||||
*/
|
*/
|
||||||
abstract public function doRequest($follow_location = true);
|
abstract public function doRequest();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get client instance: curl or stream driver
|
* Get client instance: curl or stream driver
|
||||||
@ -295,48 +262,6 @@ abstract class Client
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* Handle manually redirections when there is an open base dir restriction
|
|
||||||
*
|
|
||||||
* @access private
|
|
||||||
* @param string $location Redirected URL
|
|
||||||
* @return array
|
|
||||||
*/
|
|
||||||
public function handleRedirection($location)
|
|
||||||
{
|
|
||||||
$nb_redirects = 0;
|
|
||||||
$result = array();
|
|
||||||
$this->url = Url::resolve($location, $this->url);
|
|
||||||
$this->body = '';
|
|
||||||
$this->body_length = 0;
|
|
||||||
$this->headers = array();
|
|
||||||
$this->headers_counter = 0;
|
|
||||||
|
|
||||||
while (true) {
|
|
||||||
|
|
||||||
$nb_redirects++;
|
|
||||||
|
|
||||||
if ($nb_redirects >= $this->max_redirects) {
|
|
||||||
throw new MaxRedirectException('Maximum number of redirections reached');
|
|
||||||
}
|
|
||||||
|
|
||||||
$result = $this->doRequest(false);
|
|
||||||
|
|
||||||
if ($result['status'] == 301 || $result['status'] == 302) {
|
|
||||||
$this->url = $result['headers']['Location'];
|
|
||||||
$this->body = '';
|
|
||||||
$this->body_length = 0;
|
|
||||||
$this->headers = array();
|
|
||||||
$this->headers_counter = 0;
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return $result;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Check if a request has been modified according to the parameters
|
* Check if a request has been modified according to the parameters
|
||||||
*
|
*
|
||||||
|
@ -12,6 +12,38 @@ use PicoFeed\Logging\Logger;
|
|||||||
*/
|
*/
|
||||||
class Curl extends Client
|
class Curl extends Client
|
||||||
{
|
{
|
||||||
|
/**
|
||||||
|
* HTTP response body
|
||||||
|
*
|
||||||
|
* @access private
|
||||||
|
* @var string
|
||||||
|
*/
|
||||||
|
private $body = '';
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Body size
|
||||||
|
*
|
||||||
|
* @access private
|
||||||
|
* @var integer
|
||||||
|
*/
|
||||||
|
private $body_length = 0;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* HTTP response headers
|
||||||
|
*
|
||||||
|
* @access private
|
||||||
|
* @var array
|
||||||
|
*/
|
||||||
|
private $headers = array();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Counter on the number of header received
|
||||||
|
*
|
||||||
|
* @access private
|
||||||
|
* @var integer
|
||||||
|
*/
|
||||||
|
private $headers_counter = 0;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* cURL callback to read the HTTP body
|
* cURL callback to read the HTTP body
|
||||||
*
|
*
|
||||||
@ -228,6 +260,48 @@ class Curl extends Client
|
|||||||
return $follow_location && ini_get('open_basedir') !== '' && ($status == 301 || $status == 302);
|
return $follow_location && ini_get('open_basedir') !== '' && ($status == 301 || $status == 302);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Handle manually redirections when there is an open base dir restriction
|
||||||
|
*
|
||||||
|
* @access private
|
||||||
|
* @param string $location Redirected URL
|
||||||
|
* @return array
|
||||||
|
*/
|
||||||
|
private function handleRedirection($location)
|
||||||
|
{
|
||||||
|
$nb_redirects = 0;
|
||||||
|
$result = array();
|
||||||
|
$this->url = Url::resolve($location, $this->url);
|
||||||
|
$this->body = '';
|
||||||
|
$this->body_length = 0;
|
||||||
|
$this->headers = array();
|
||||||
|
$this->headers_counter = 0;
|
||||||
|
|
||||||
|
while (true) {
|
||||||
|
|
||||||
|
$nb_redirects++;
|
||||||
|
|
||||||
|
if ($nb_redirects >= $this->max_redirects) {
|
||||||
|
throw new MaxRedirectException('Maximum number of redirections reached');
|
||||||
|
}
|
||||||
|
|
||||||
|
$result = $this->doRequest(false);
|
||||||
|
|
||||||
|
if ($result['status'] == 301 || $result['status'] == 302) {
|
||||||
|
$this->url = Url::resolve($result['headers']['Location'], $this->url);
|
||||||
|
$this->body = '';
|
||||||
|
$this->body_length = 0;
|
||||||
|
$this->headers = array();
|
||||||
|
$this->headers_counter = 0;
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return $result;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Handle cURL errors (throw individual exceptions)
|
* Handle cURL errors (throw individual exceptions)
|
||||||
*
|
*
|
||||||
|
@ -53,12 +53,13 @@ class HttpHeaders implements ArrayAccess
|
|||||||
*/
|
*/
|
||||||
public static function parse(array $lines)
|
public static function parse(array $lines)
|
||||||
{
|
{
|
||||||
$status = 200;
|
$status = 0;
|
||||||
$headers = array();
|
$headers = array();
|
||||||
|
|
||||||
foreach ($lines as $line) {
|
foreach ($lines as $line) {
|
||||||
|
|
||||||
if (strpos($line, 'HTTP') === 0) {
|
if (strpos($line, 'HTTP') === 0) {
|
||||||
|
$headers = array();
|
||||||
$status = (int) substr($line, 9, 3);
|
$status = (int) substr($line, 9, 3);
|
||||||
}
|
}
|
||||||
else if (strpos($line, ':') !== false) {
|
else if (strpos($line, ':') !== false) {
|
||||||
|
@ -48,6 +48,23 @@ class Stream extends Client
|
|||||||
return $headers;
|
return $headers;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Construct the final URL from location headers
|
||||||
|
*
|
||||||
|
* @access private
|
||||||
|
* @param array $headers List of HTTP response header
|
||||||
|
*/
|
||||||
|
private function setEffectiveUrl($headers)
|
||||||
|
{
|
||||||
|
foreach($headers as $header) {
|
||||||
|
if (stripos($header, 'Location') === 0) {
|
||||||
|
list($name, $value) = explode(': ', $header);
|
||||||
|
|
||||||
|
$this->url = Url::resolve($value, $this->url);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Prepare stream context
|
* Prepare stream context
|
||||||
*
|
*
|
||||||
@ -61,7 +78,7 @@ class Stream extends Client
|
|||||||
'method' => 'GET',
|
'method' => 'GET',
|
||||||
'protocol_version' => 1.1,
|
'protocol_version' => 1.1,
|
||||||
'timeout' => $this->timeout,
|
'timeout' => $this->timeout,
|
||||||
'follow_location' => 0,
|
'max_redirects' => $this->max_redirects,
|
||||||
)
|
)
|
||||||
);
|
);
|
||||||
|
|
||||||
@ -89,10 +106,9 @@ class Stream extends Client
|
|||||||
* Do the HTTP request
|
* Do the HTTP request
|
||||||
*
|
*
|
||||||
* @access public
|
* @access public
|
||||||
* @param bool $follow_location Flag used when there is an open_basedir restriction
|
* @return array HTTP response ['body' => ..., 'status' => ..., 'headers' => ...]
|
||||||
* @return array HTTP response ['body' => ..., 'status' => ..., 'headers' => ...]
|
|
||||||
*/
|
*/
|
||||||
public function doRequest($follow_location = false)
|
public function doRequest()
|
||||||
{
|
{
|
||||||
// Create context
|
// Create context
|
||||||
$context = stream_context_create($this->prepareContext());
|
$context = stream_context_create($this->prepareContext());
|
||||||
@ -114,20 +130,16 @@ class Stream extends Client
|
|||||||
// Get HTTP headers response
|
// Get HTTP headers response
|
||||||
$metadata = stream_get_meta_data($stream);
|
$metadata = stream_get_meta_data($stream);
|
||||||
|
|
||||||
|
fclose($stream);
|
||||||
|
|
||||||
if ($metadata['timed_out']) {
|
if ($metadata['timed_out']) {
|
||||||
throw new TimeoutException('Operation timeout');
|
throw new TimeoutException('Operation timeout');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
$this->setEffectiveUrl($metadata['wrapper_data']);
|
||||||
|
|
||||||
list($status, $headers) = HttpHeaders::parse($metadata['wrapper_data']);
|
list($status, $headers) = HttpHeaders::parse($metadata['wrapper_data']);
|
||||||
|
|
||||||
fclose($stream);
|
|
||||||
|
|
||||||
// Do redirect manual to get only the headers of the last request and
|
|
||||||
// the final url
|
|
||||||
if ($status == 301 || $status == 302) {
|
|
||||||
return $this->handleRedirection($headers['Location']);
|
|
||||||
}
|
|
||||||
|
|
||||||
return array(
|
return array(
|
||||||
'status' => $status,
|
'status' => $status,
|
||||||
'body' => $this->decodeBody($body, $headers),
|
'body' => $this->decodeBody($body, $headers),
|
||||||
|
@ -18,18 +18,17 @@ class CurlTest extends PHPUnit_Framework_TestCase
|
|||||||
$this->assertEquals('text/html; charset=utf-8', $result['headers']['Content-Type']);
|
$this->assertEquals('text/html; charset=utf-8', $result['headers']['Content-Type']);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
public function testRedirect()
|
public function testRedirect()
|
||||||
{
|
{
|
||||||
$client = new Curl;
|
$client = new Curl;
|
||||||
$client->setUrl('http://www.miniflux.net/index.html');
|
$client->setUrl('http://rss.feedsportal.com/c/629/f/502199/s/42e50391/sc/44/l/0L0S0A1net0N0Ceditorial0C6437220Candroid0Egoogle0Enow0Es0Eouvre0Eaux0Eapplications0Etierces0C0T0Dxtor0FRSS0E16/story01.htm');
|
||||||
$result = $client->doRequest();
|
$result = $client->doRequest();
|
||||||
|
|
||||||
$this->assertTrue(is_array($result));
|
$this->assertTrue(is_array($result));
|
||||||
$this->assertEquals(200, $result['status']);
|
$this->assertEquals(200, $result['status']);
|
||||||
$this->assertEquals('<!DOCTYPE', substr($result['body'], 0, 9));
|
$this->assertEquals('<!DOCTYPE', substr($result['body'], 0, 9));
|
||||||
$this->assertEquals('text/html; charset=utf-8', $result['headers']['Content-Type']);
|
$this->assertEquals('text/html', $result['headers']['Content-Type']);
|
||||||
$this->assertEquals('http://miniflux.net/', $client->getUrl());
|
$this->assertEquals('http://www.01net.com/editorial/643722/android-google-now-s-ouvre-aux-applications-tierces/', str_replace('#?xtor=RSS-16', '', $client->getUrl()));
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -30,14 +30,14 @@ class StreamTest extends PHPUnit_Framework_TestCase
|
|||||||
public function testRedirect()
|
public function testRedirect()
|
||||||
{
|
{
|
||||||
$client = new Stream;
|
$client = new Stream;
|
||||||
$client->setUrl('http://www.miniflux.net/index.html');
|
$client->setUrl('http://rss.feedsportal.com/c/629/f/502199/s/42e50391/sc/44/l/0L0S0A1net0N0Ceditorial0C6437220Candroid0Egoogle0Enow0Es0Eouvre0Eaux0Eapplications0Etierces0C0T0Dxtor0FRSS0E16/story01.htm');
|
||||||
$result = $client->doRequest();
|
$result = $client->doRequest();
|
||||||
|
|
||||||
$this->assertTrue(is_array($result));
|
$this->assertTrue(is_array($result));
|
||||||
$this->assertEquals(200, $result['status']);
|
$this->assertEquals(200, $result['status']);
|
||||||
$this->assertEquals('<!DOCTYPE', substr($result['body'], 0, 9));
|
$this->assertEquals('<!DOCTYPE', substr($result['body'], 0, 9));
|
||||||
$this->assertEquals('text/html; charset=utf-8', $result['headers']['Content-Type']);
|
$this->assertEquals('text/html', $result['headers']['Content-Type']);
|
||||||
$this->assertEquals('http://miniflux.net/', $client->getUrl());
|
$this->assertEquals('http://www.01net.com/editorial/643722/android-google-now-s-ouvre-aux-applications-tierces/#?xtor=RSS-16', $client->getUrl());
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -32,17 +32,17 @@ class DateParserTest extends PHPUnit_Framework_TestCase
|
|||||||
$this->assertEquals('2010-08-20', date('Y-m-d', $parser->getTimestamp('2010-08-20Thh:08:ssZ')));
|
$this->assertEquals('2010-08-20', date('Y-m-d', $parser->getTimestamp('2010-08-20Thh:08:ssZ')));
|
||||||
$this->assertEquals(1288648057, $parser->getTimestamp('Mon, 01 Nov 2010 21:47:37 UT'));
|
$this->assertEquals(1288648057, $parser->getTimestamp('Mon, 01 Nov 2010 21:47:37 UT'));
|
||||||
$this->assertEquals(1346069615, $parser->getTimestamp('Mon Aug 27 2012 12:13:35 GMT-0700 (PDT)'));
|
$this->assertEquals(1346069615, $parser->getTimestamp('Mon Aug 27 2012 12:13:35 GMT-0700 (PDT)'));
|
||||||
$this->assertEquals(time(), $parser->getTimestamp('Tue, 3 Febuary 2010 00:00:00 IST'), 1);
|
$this->assertEquals(time(), $parser->getTimestamp('Tue, 3 Febuary 2010 00:00:00 IST'), '', 1);
|
||||||
$this->assertEquals(time(), $parser->getTimestamp('############# EST'), 1);
|
$this->assertEquals(time(), $parser->getTimestamp('############# EST'), '', 1);
|
||||||
$this->assertEquals(time(), $parser->getTimestamp('Wed, 30 Nov -0001 00:00:00 +0000'), 1);
|
$this->assertEquals(time(), $parser->getTimestamp('Wed, 30 Nov -0001 00:00:00 +0000'), '', 1);
|
||||||
$this->assertEquals(time(), $parser->getTimestamp('čet, 24 maj 2012 00:00:00'), 1);
|
$this->assertEquals(time(), $parser->getTimestamp('čet, 24 maj 2012 00:00:00'), '', 1);
|
||||||
$this->assertEquals(time(), $parser->getTimestamp('-0-0T::Z'), 1);
|
$this->assertEquals(time(), $parser->getTimestamp('-0-0T::Z'), '', 1);
|
||||||
$this->assertEquals(time(), $parser->getTimestamp('Wed, 18 2012'), 1);
|
$this->assertEquals(time(), $parser->getTimestamp('Wed, 18 2012'), '', 1);
|
||||||
$this->assertEquals(time(), $parser->getTimestamp("'2009-09-30 CDT16:09:54"), 1);
|
$this->assertEquals(time(), $parser->getTimestamp("'2009-09-30 CDT16:09:54"), '', 1);
|
||||||
$this->assertEquals(time(), $parser->getTimestamp('ary 8 Jan 2013 00:00:00 GMT'), 1);
|
$this->assertEquals(time(), $parser->getTimestamp('ary 8 Jan 2013 00:00:00 GMT'), '', 1);
|
||||||
$this->assertEquals(time(), $parser->getTimestamp('Sat, 11 00:00:01 GMT'), 1);
|
$this->assertEquals(time(), $parser->getTimestamp('Sat, 11 00:00:01 GMT'), '', 1);
|
||||||
$this->assertEquals(1370631743, $parser->getTimestamp('Fri Jun 07 2013 19:02:23 GMT+0000 (UTC)'));
|
$this->assertEquals(1370631743, $parser->getTimestamp('Fri Jun 07 2013 19:02:23 GMT+0000 (UTC)'));
|
||||||
$this->assertEquals(1377412225, $parser->getTimestamp('25/08/2013 06:30:25 م'));
|
$this->assertEquals(1377412225, $parser->getTimestamp('25/08/2013 06:30:25 م'));
|
||||||
$this->assertEquals(time(), $parser->getTimestamp('+0400'),1);
|
$this->assertEquals(time(), $parser->getTimestamp('+0400'), '', 1);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -93,7 +93,7 @@ class Rss20ParserTest extends PHPUnit_Framework_TestCase
|
|||||||
|
|
||||||
$parser = new Rss20(file_get_contents('tests/fixtures/fulltextrss.xml'));
|
$parser = new Rss20(file_get_contents('tests/fixtures/fulltextrss.xml'));
|
||||||
$feed = $parser->execute();
|
$feed = $parser->execute();
|
||||||
$this->assertEquals(time(), $feed->getDate(), 1);
|
$this->assertEquals(time(), $feed->getDate(), '', 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
public function testFeedLanguage()
|
public function testFeedLanguage()
|
||||||
|
@ -18,13 +18,13 @@ class Rss91ParserTest extends PHPUnit_Framework_TestCase
|
|||||||
$this->assertEquals('', $feed->getFeedUrl());
|
$this->assertEquals('', $feed->getFeedUrl());
|
||||||
$this->assertEquals('http://writetheweb.com/', $feed->getSiteUrl());
|
$this->assertEquals('http://writetheweb.com/', $feed->getSiteUrl());
|
||||||
$this->assertEquals('http://writetheweb.com/', $feed->getId());
|
$this->assertEquals('http://writetheweb.com/', $feed->getId());
|
||||||
$this->assertEquals(time(), $feed->getDate(), 1);
|
$this->assertEquals(time(), $feed->getDate(), '', 1);
|
||||||
$this->assertEquals(6, count($feed->items));
|
$this->assertEquals(6, count($feed->items));
|
||||||
|
|
||||||
$this->assertEquals('Giving the world a pluggable Gnutella', $feed->items[0]->getTitle());
|
$this->assertEquals('Giving the world a pluggable Gnutella', $feed->items[0]->getTitle());
|
||||||
$this->assertEquals('http://writetheweb.com/read.php?item=24', $feed->items[0]->getUrl());
|
$this->assertEquals('http://writetheweb.com/read.php?item=24', $feed->items[0]->getUrl());
|
||||||
$this->assertEquals('085a9133a75542f878fa73ee2afbb6a2350b6c4fb125e6d8ca09478c47702111', $feed->items[0]->getId());
|
$this->assertEquals('085a9133a75542f878fa73ee2afbb6a2350b6c4fb125e6d8ca09478c47702111', $feed->items[0]->getId());
|
||||||
$this->assertEquals(time(), $feed->items[0]->getDate(), 1);
|
$this->assertEquals(time(), $feed->items[0]->getDate(), '', 1);
|
||||||
$this->assertEquals('webmaster@writetheweb.com', $feed->items[0]->getAuthor());
|
$this->assertEquals('webmaster@writetheweb.com', $feed->items[0]->getAuthor());
|
||||||
$this->assertTrue(strpos($feed->items[1]->getContent(), '<p>After a period of dormancy') === 0);
|
$this->assertTrue(strpos($feed->items[1]->getContent(), '<p>After a period of dormancy') === 0);
|
||||||
}
|
}
|
||||||
|
@ -18,7 +18,7 @@ class Rss92ParserTest extends PHPUnit_Framework_TestCase
|
|||||||
$this->assertEquals('', $feed->getFeedUrl());
|
$this->assertEquals('', $feed->getFeedUrl());
|
||||||
$this->assertEquals('http://www.universfreebox.com/', $feed->getSiteUrl());
|
$this->assertEquals('http://www.universfreebox.com/', $feed->getSiteUrl());
|
||||||
$this->assertEquals('http://www.universfreebox.com/', $feed->getId());
|
$this->assertEquals('http://www.universfreebox.com/', $feed->getId());
|
||||||
$this->assertEquals(time(), $feed->date, 1);
|
$this->assertEquals(time(), $feed->date, '', 1);
|
||||||
$this->assertEquals(30, count($feed->items));
|
$this->assertEquals(30, count($feed->items));
|
||||||
|
|
||||||
$this->assertEquals('Retour de Xavier Niel sur Twitter, « sans initiative privée, pas de révolution #Born2code »', $feed->items[0]->title);
|
$this->assertEquals('Retour de Xavier Niel sur Twitter, « sans initiative privée, pas de révolution #Born2code »', $feed->items[0]->title);
|
||||||
|
Loading…
Reference in New Issue
Block a user