Skip to content

Commit

Permalink
fix test
Browse files Browse the repository at this point in the history
  • Loading branch information
freekmurze committed May 13, 2017
1 parent 9872465 commit 1bfa453
Show file tree
Hide file tree
Showing 10 changed files with 160 additions and 151 deletions.
28 changes: 13 additions & 15 deletions tests/DummyRepository.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,12 @@

class DummyRepository
{
public function getAll()
/** @var \Illuminate\Support\Collection */
public $items;

public function __construct()
{
return collect([
$this->items = collect([
new DummyItem(),
new DummyItem(),
new DummyItem(),
Expand All @@ -15,20 +18,15 @@ public function getAll()
]);
}

public function getAllWithArguments($filter = '')
public function getAll()
{
if ($filter != '') {
return collect([
new DummyItem(),
]);
}
return $this->items;
}

return collect([
new DummyItem(),
new DummyItem(),
new DummyItem(),
new DummyItem(),
new DummyItem(),
]);
public function getAllWithArguments(string $filter = '')
{
return $filter === 'first'
? collect($this->items->first())
: $this->items;
}
}
2 changes: 1 addition & 1 deletion tests/FeedTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ public function all_feed_items_have_expected_data()
collect($this->feedNames)->each(function (string $feedName) {
$generatedFeedContent = $this->call('GET', "/feedBaseUrl/{$feedName}")->getContent();

$this->assertMatchesXmlSnapshot($generatedFeedContent);
$this->assertMatchesSnapshot($generatedFeedContent);
});
}

Expand Down
2 changes: 1 addition & 1 deletion tests/TestCase.php
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ protected function getEnvironmentSetUp($app)
'description' => 'This is feed 2 from the unit tests',
],
[
'items' => ['Spatie\Feed\Test\DummyRepository@getAllWithArguments', 'filter'],
'items' => ['Spatie\Feed\Test\DummyRepository@getAllWithArguments', 'first'],
'url' => '/feed3',
'title' => 'Feed 3',
'description' => 'This is feed 3 from the unit tests',
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,68 @@
<?php return '<?xml version="1.0" encoding="UTF-8"?>
<feed xmlns="http://www.w3.org/2005/Atom">
<id>http://localhost/feedBaseUrl/feed1</id>
<link href="http://localhost/feedBaseUrl/feed1"></link>
<title><![CDATA[Feed 1]]></title>
<updated>2016-01-01T00:00:00+01:00</updated>
<entry>
<title><![CDATA[feedItemTitle]]></title>
<link rel="alternate" href="https://localhost/news/testItem1" />
<id>http://localhost/1</id>
<author>
<name> <![CDATA[feedItemAuthor]]></name>
</author>
<summary type="html">
<![CDATA[feedItemSummary]]>
</summary>
<updated>2016-01-01T00:00:00+01:00</updated>
</entry>
<entry>
<title><![CDATA[feedItemTitle]]></title>
<link rel="alternate" href="https://localhost/news/testItem1" />
<id>http://localhost/1</id>
<author>
<name> <![CDATA[feedItemAuthor]]></name>
</author>
<summary type="html">
<![CDATA[feedItemSummary]]>
</summary>
<updated>2016-01-01T00:00:00+01:00</updated>
</entry>
<entry>
<title><![CDATA[feedItemTitle]]></title>
<link rel="alternate" href="https://localhost/news/testItem1" />
<id>http://localhost/1</id>
<author>
<name> <![CDATA[feedItemAuthor]]></name>
</author>
<summary type="html">
<![CDATA[feedItemSummary]]>
</summary>
<updated>2016-01-01T00:00:00+01:00</updated>
</entry>
<entry>
<title><![CDATA[feedItemTitle]]></title>
<link rel="alternate" href="https://localhost/news/testItem1" />
<id>http://localhost/1</id>
<author>
<name> <![CDATA[feedItemAuthor]]></name>
</author>
<summary type="html">
<![CDATA[feedItemSummary]]>
</summary>
<updated>2016-01-01T00:00:00+01:00</updated>
</entry>
<entry>
<title><![CDATA[feedItemTitle]]></title>
<link rel="alternate" href="https://localhost/news/testItem1" />
<id>http://localhost/1</id>
<author>
<name> <![CDATA[feedItemAuthor]]></name>
</author>
<summary type="html">
<![CDATA[feedItemSummary]]>
</summary>
<updated>2016-01-01T00:00:00+01:00</updated>
</entry>
</feed>
';

This file was deleted.

Original file line number Diff line number Diff line change
@@ -0,0 +1,68 @@
<?php return '<?xml version="1.0" encoding="UTF-8"?>
<feed xmlns="http://www.w3.org/2005/Atom">
<id>http://localhost/feedBaseUrl/feed2</id>
<link href="http://localhost/feedBaseUrl/feed2"></link>
<title><![CDATA[Feed 2]]></title>
<updated>2016-01-01T00:00:00+01:00</updated>
<entry>
<title><![CDATA[feedItemTitle]]></title>
<link rel="alternate" href="https://localhost/news/testItem1" />
<id>http://localhost/1</id>
<author>
<name> <![CDATA[feedItemAuthor]]></name>
</author>
<summary type="html">
<![CDATA[feedItemSummary]]>
</summary>
<updated>2016-01-01T00:00:00+01:00</updated>
</entry>
<entry>
<title><![CDATA[feedItemTitle]]></title>
<link rel="alternate" href="https://localhost/news/testItem1" />
<id>http://localhost/1</id>
<author>
<name> <![CDATA[feedItemAuthor]]></name>
</author>
<summary type="html">
<![CDATA[feedItemSummary]]>
</summary>
<updated>2016-01-01T00:00:00+01:00</updated>
</entry>
<entry>
<title><![CDATA[feedItemTitle]]></title>
<link rel="alternate" href="https://localhost/news/testItem1" />
<id>http://localhost/1</id>
<author>
<name> <![CDATA[feedItemAuthor]]></name>
</author>
<summary type="html">
<![CDATA[feedItemSummary]]>
</summary>
<updated>2016-01-01T00:00:00+01:00</updated>
</entry>
<entry>
<title><![CDATA[feedItemTitle]]></title>
<link rel="alternate" href="https://localhost/news/testItem1" />
<id>http://localhost/1</id>
<author>
<name> <![CDATA[feedItemAuthor]]></name>
</author>
<summary type="html">
<![CDATA[feedItemSummary]]>
</summary>
<updated>2016-01-01T00:00:00+01:00</updated>
</entry>
<entry>
<title><![CDATA[feedItemTitle]]></title>
<link rel="alternate" href="https://localhost/news/testItem1" />
<id>http://localhost/1</id>
<author>
<name> <![CDATA[feedItemAuthor]]></name>
</author>
<summary type="html">
<![CDATA[feedItemSummary]]>
</summary>
<updated>2016-01-01T00:00:00+01:00</updated>
</entry>
</feed>
';

This file was deleted.

Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
<?php return '<?xml version="1.0" encoding="UTF-8"?>
<feed xmlns="http://www.w3.org/2005/Atom">
<id>http://localhost/feedBaseUrl/feed3</id>
<link href="http://localhost/feedBaseUrl/feed3"></link>
<title><![CDATA[Feed 3]]></title>
<updated></updated>
</feed>
';

This file was deleted.

Original file line number Diff line number Diff line change
@@ -1,6 +1,4 @@
<?php

return '<link rel="alternate" type="application/rss+xml" href="http://localhost/feedBaseUrl/feed1" title="Feed 1">
<?php return '<link rel="alternate" type="application/rss+xml" href="http://localhost/feedBaseUrl/feed1" title="Feed 1">
<link rel="alternate" type="application/rss+xml" href="http://localhost/feedBaseUrl/feed2" title="Feed 2">
<link rel="alternate" type="application/rss+xml" href="http://localhost/feedBaseUrl/feed3" title="Feed 3">
';

0 comments on commit 1bfa453

Please sign in to comment.