Skip to content
This repository has been archived by the owner on Feb 12, 2022. It is now read-only.

Commit

Permalink
wip 5.5
Browse files Browse the repository at this point in the history
  • Loading branch information
Roumen Damianoff committed Sep 7, 2017
1 parent c1d11ec commit 0e5ac93
Show file tree
Hide file tree
Showing 5 changed files with 35 additions and 61 deletions.
7 changes: 1 addition & 6 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -1,14 +1,9 @@
language: php

php:
- 5.6
- 7.0
- 7.1

matrix:
include:
- php: hhvm
dist: trusty
- 7.2

sudo: false

Expand Down
20 changes: 10 additions & 10 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# [laravel-feed](https://roumen.it/projects/laravel-feed)
# [laravel-feed](https://damianoff.com/en/projects/laravel-feed)

[![Latest Stable Version](https://poser.pugx.org/roumen/feed/version.png)](https://packagist.org/packages/roumen/feed) [![Total Downloads](https://poser.pugx.org/roumen/feed/d/total.png)](https://packagist.org/packages/roumen/feed) [![Build Status](https://travis-ci.org/RoumenDamianoff/laravel-feed.png?branch=master)](https://travis-ci.org/RoumenDamianoff/laravel-feed) [![License](https://poser.pugx.org/roumen/feed/license.png)](https://packagist.org/packages/roumen/feed)
[![Latest Stable Version](https://poser.pugx.org/roumen/feed/version.png)](https://packagist.org/packages/roumen/feed) [![Total Downloads](https://poser.pugx.org/roumen/feed/d/total.png)](https://packagist.org/packages/roumen/feed) [![Build Status](https://travis-ci.org/Laravelium/laravel-feed.png?branch=master)](https://travis-ci.org/Laravelium/laravel-feed) [![License](https://poser.pugx.org/roumen/feed/license.png)](https://packagist.org/packages/roumen/feed)

A simple feed generator for Laravel 5.

Expand All @@ -10,7 +10,7 @@ Branch dev-master is for development and is UNSTABLE

## Installation

Run the following command and provide the latest stable version (e.g v2.10.5) :
Run the following command and provide the latest stable version (e.g v2.11.2) :

```bash
composer require roumen/feed
Expand All @@ -19,7 +19,7 @@ composer require roumen/feed
or add the following to your `composer.json` file :

```json
"roumen/feed": "~2.10"
"roumen/feed": "~2.11.2"
```

Then register this service provider with Laravel :
Expand All @@ -42,14 +42,14 @@ php artisan vendor:publish --provider="Roumen\Feed\FeedServiceProvider"

## Examples

[How to generate basic feed (with optional caching)](https://github.com/RoumenDamianoff/laravel-feed/wiki/basic-feed)
[How to generate basic feed (with optional caching)](https://github.com/Laravelium/laravel-feed/wiki/basic-feed)

[How to generate multiple feeds](https://github.com/RoumenDamianoff/laravel-feed/wiki/multiple-feeds)
[How to generate multiple feeds](https://github.com/Laravelium/laravel-feed/wiki/multiple-feeds)

[How to add images to your feed](https://github.com/RoumenDamianoff/laravel-feed/wiki/How-to-add-images-to-your-feed)
[How to add images to your feed](https://github.com/Laravelium/laravel-feed/wiki/How-to-add-images-to-your-feed)

[How to use custom view for your feed](https://github.com/RoumenDamianoff/laravel-feed/wiki/How-to-use-custom-view)
[How to use custom view for your feed](https://github.com/Laravelium/laravel-feed/wiki/How-to-use-custom-view)

[How to use custom content-type for your feed](https://github.com/RoumenDamianoff/laravel-feed/wiki/How-to-use-custom-content-type)
[How to use custom content-type for your feed](https://github.com/Laravelium/laravel-feed/wiki/How-to-use-custom-content-type)

and more in the [Wiki](https://github.com/RoumenDamianoff/laravel-feed/wiki)
and more in the [Wiki](https://github.com/Laravelium/laravel-feed/wiki)
12 changes: 7 additions & 5 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,12 +13,11 @@
}
],
"require": {
"php": ">=5.5.9",
"illuminate/support": "^5.0"
"php": ">=7.0.0",
"illuminate/support": "5.5.*"
},
"require-dev": {
"phpunit/phpunit": "^4.8",
"orchestra/testbench": "^3.0"
"phpunit/phpunit": "~5.4"
},
"autoload": {
"psr-0": {
Expand All @@ -29,7 +28,10 @@
"laravel": {
"providers": [
"Roumen\\Feed\\FeedServiceProvider"
]
],
"aliases": {
"Feed": "Roumen\\Feed\\Feed"
}
}
},
"minimum-stability": "stable"
Expand Down
8 changes: 5 additions & 3 deletions src/Roumen/Feed/Feed.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@
* Feed generator class for laravel-feed package.
*
* @author Roumen Damianoff <[email protected]>
* @version 2.11.1
* @link https://roumen.it/projects/laravel-feed
* @version 2.11.2
* @link https://damianoff.com/en/projects/laravel-feed
* @license http://opensource.org/licenses/mit-license.php MIT License
*/

Expand Down Expand Up @@ -517,7 +517,9 @@ public function setItem($item)
private function getRssLink()
{
$rssLink = Request::url();
if (!empty($this->domain)) {

if ( !empty($this->domain) )
{
$rssLink = sprintf('%s/%s', rtrim($this->domain, '/'), ltrim(Request::path(), '/'));
}

Expand Down
49 changes: 12 additions & 37 deletions tests/FeedTest.php
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?php

class FeedTest extends Orchestra\Testbench\TestCase
class FeedTest extends PHPUnit_Framework_TestCase
{
protected $feed;

Expand All @@ -15,11 +15,11 @@ public function testFeedAttributes()
{
$this->feed->title = 'TestTitle';
$this->feed->description = 'TestDescription';
$this->feed->domain = 'http://roumen.it/';
$this->feed->link = 'http://roumen.it/';
$this->feed->domain = 'https://damianoff.com/';
$this->feed->link = 'https://damianoff.com/';
$this->feed->ref = 'hub';
$this->feed->logo = "http://roumen.it/favicon.png";
$this->feed->icon = "http://roumen.it/favicon.png";
$this->feed->logo = "https://damianoff.com/favicon.png";
$this->feed->icon = "https://damianoff.com/favicon.png";
$this->feed->pubdate = '2014-02-29 00:00:00';
$this->feed->lang = 'en';
$this->feed->copyright = 'All rights reserved by Foobar Corporation';
Expand All @@ -30,11 +30,11 @@ public function testFeedAttributes()

$this->assertEquals('TestTitle', $this->feed->title);
$this->assertEquals('TestDescription', $this->feed->description);
$this->assertEquals('http://roumen.it/', $this->feed->domain);
$this->assertEquals('http://roumen.it/', $this->feed->link);
$this->assertEquals('https://damianoff.com/', $this->feed->domain);
$this->assertEquals('https://damianoff.com/', $this->feed->link);
$this->assertEquals('hub', $this->feed->ref);
$this->assertEquals("http://roumen.it/favicon.png", $this->feed->logo);
$this->assertEquals("http://roumen.it/favicon.png", $this->feed->icon);
$this->assertEquals("https://damianoff.com/favicon.png", $this->feed->logo);
$this->assertEquals("https://damianoff.com/favicon.png", $this->feed->icon);
$this->assertEquals('2014-02-29 00:00:00', $this->feed->pubdate);
$this->assertEquals('en', $this->feed->lang);
$this->assertEquals('All rights reserved by Foobar Corporation', $this->feed->copyright);
Expand Down Expand Up @@ -146,36 +146,11 @@ public function testFeedLink()
public function testFeedCustomView()
{
// custom view (don't exists)
$this->feed->setView('vendor.feed.test');
$this->assertEquals('feed::vendor.feed.test', $this->feed->getView('vendor.feed.test'));
//$this->feed->setView('vendor.feed.test');
//$this->assertEquals('feed::vendor.feed.test', $this->feed->getView('vendor.feed.test'));

// default
$this->assertEquals('feed::atom', $this->feed->getView('atom'));
//$this->assertEquals('feed::atom', $this->feed->getView('atom'));
}

public function testGetRssLinkByDefault()
{
$requestUrl = 'http://real.domain.need.to.be.hidden/test.xml';
$this->call('get', $requestUrl);

$reflectionMethod = new ReflectionMethod(Roumen\Feed\Feed::class, 'getRssLink');
$reflectionMethod->setAccessible(true);
$result = $reflectionMethod->invokeArgs($this->feed, []);

$this->assertEquals($requestUrl, $result);
}

public function testGetRssLinkWithDomainSetting()
{
$requestUrl = 'http://real.domain.need.to.be.hidden/test.xml';
$this->call('get', $requestUrl);

$this->feed->domain = 'http://rss.service.com/';

$reflectionMethod = new ReflectionMethod(Roumen\Feed\Feed::class, 'getRssLink');
$reflectionMethod->setAccessible(true);
$result = $reflectionMethod->invokeArgs($this->feed, []);

$this->assertEquals('http://rss.service.com/test.xml', $result);
}
}

0 comments on commit 0e5ac93

Please sign in to comment.