Skip to content

Commit d71e58d

Browse files
committed
refactor tests
1 parent 8477ba6 commit d71e58d

File tree

2 files changed

+22
-30
lines changed

2 files changed

+22
-30
lines changed

resources/views/rss.blade.php

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,15 +3,15 @@
33
<feed xmlns="http://www.w3.org/2005/Atom">
44

55
@foreach($meta as $key => $metaItem)
6-
@if($key == 'link')
6+
@if($key === 'link')
77
<{{ $key }} href="{{ $metaItem }}"></{{ $key }}>
88
@else
99
<{{ $key }}>{{ $metaItem }}</{{ $key }}>
1010
@endif
1111

1212
@endforeach
1313

14-
@foreach( $items as $item)
14+
@foreach($items as $item)
1515

1616
<entry>
1717
<title>
@@ -22,9 +22,11 @@
2222
<id>
2323
{{ $item['id'] }}
2424
</id>
25+
2526
<summary>
2627
{{ $item['summary'] }}
2728
</summary>
29+
2830
<updated>
2931
{{ $item['updated'] }}
3032
</updated>

tests/RssTest.php

Lines changed: 18 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -4,44 +4,34 @@
44

55
class RssTest extends TestCase
66
{
7-
/**
8-
* @test
9-
*/
10-
public function it_registers_route()
7+
/** @test */
8+
public function it_registers_routes_where_feeds_will_be_available()
119
{
1210
$this->assertEquals(200, $this->call('GET', '/en/myfeed')->getStatusCode());
1311
$this->assertEquals(200, $this->call('GET', '/nl/myfeed')->getStatusCode());
1412
}
1513

16-
/**
17-
* @test
18-
*/
19-
public function feed_has_all_models()
14+
/** @test */
15+
public function a_feed_contains_meta_data()
2016
{
2117
$content = $this->call('GET', '/en/myfeed')->getContent();
22-
$this->assertEquals(5, substr_count($content, '<entry>'));
23-
}
2418

25-
/**
26-
* @test
27-
* @dataProvider provider_feed_has_meta
28-
*/
29-
public function feed_has_meta($stringToCheck)
30-
{
31-
$content = $this->call('GET', '/en/myfeed')->getContent();
32-
$this->assertTrue(str_contains($content, $stringToCheck));
19+
$metaData = [
20+
'<description>...</description>',
21+
'<link href="http://blender.192.168.10.10.xip.io/en/feed">',
22+
'<updated>',
23+
24+
];
25+
26+
foreach ($metaData as $metaDataItem) {
27+
$this->assertContains($metaDataItem, $content);
28+
}
3329
}
3430

35-
/**
36-
* @dataProvider
37-
*/
38-
public function provider_feed_has_meta() : array
31+
/** @test */
32+
public function a_feed_contains_all_selected_models()
3933
{
40-
return [
41-
['<description>...</description>'],
42-
['<link href="http://blender.192.168.10.10.xip.io/en/feed">'],
43-
['<updated>'],
44-
45-
];
34+
$content = $this->call('GET', '/en/myfeed')->getContent();
35+
$this->assertEquals(5, substr_count($content, '<entry>'));
4636
}
4737
}

0 commit comments

Comments
 (0)