| Conditions | 1 |
| Paths | 1 |
| Total Lines | 53 |
| Code Lines | 40 |
| Lines | 0 |
| Ratio | 0 % |
| Changes | 0 | ||
Small methods make your code easier to understand, in particular if combined with a good name. Besides, if your method is small, finding a good name is usually much easier.
For example, if you find yourself adding comments to a method's body, this is usually a good sign to extract the commented part to a new method, and use the comment as a starting point when coming up with a good name for this new method.
Commonly applied refactorings include:
If many parameters/temporary variables are present:
| 1 | <?php |
||
| 73 | public function testRssConfigurationIsPresentOnXml(): void |
||
| 74 | { |
||
| 75 | $this->postRepository->withAudio()->willReturn(new AudioEpisodeCollection()); |
||
| 76 | |||
| 77 | $outputFile = $this->generateRssFeed->execute($this->rssConfiguration); |
||
| 78 | $reader = new SimpleXMLElement($outputFile->content()); |
||
| 79 | |||
| 80 | $this->assertEquals($this->rssConfiguration->title(), $reader->channel->title); |
||
| 81 | $this->assertEquals($this->rssConfiguration->url(), $reader->channel->link); |
||
| 82 | $this->assertEquals($this->rssConfiguration->description(), $reader->channel->description); |
||
| 83 | $this->assertEquals( |
||
| 84 | $this->rssConfiguration->lastBuildDate()->format(ChannelBuilder::DATE_FORMAT), |
||
| 85 | $reader->channel->lastBuildDate |
||
| 86 | ); |
||
| 87 | $this->assertEquals($this->rssConfiguration->language(), $reader->channel->language); |
||
| 88 | $this->assertEquals($this->rssConfiguration->generator(), $reader->channel->generator); |
||
| 89 | $this->assertEquals($this->rssConfiguration->managingEditor(), $reader->channel->managingEditor); |
||
| 90 | $this->assertEquals($this->rssConfiguration->category(), $reader->channel->category); |
||
| 91 | |||
| 92 | $this->assertEquals($this->rssConfiguration->title(), $reader->channel->image->title); |
||
| 93 | $this->assertEquals($this->rssConfiguration->imageUrl(), $reader->channel->image->url); |
||
| 94 | $this->assertEquals($this->rssConfiguration->url(), $reader->channel->image->link); |
||
| 95 | |||
| 96 | $atomLink = $reader->xpath('channel/atom:link')[0]; |
||
| 97 | $this->assertEquals($this->rssConfiguration->feedUrl(), $atomLink['href']); |
||
| 98 | $this->assertEquals('self', $atomLink['rel']); |
||
| 99 | $this->assertEquals('application/rss+xml', $atomLink['type']); |
||
| 100 | |||
| 101 | $this->assertEquals($this->rssConfiguration->subtitle(), $reader->xpath('channel/itunes:subtitle')[0]); |
||
| 102 | $this->assertEquals($this->rssConfiguration->description(), $reader->xpath('channel/itunes:summary')[0]); |
||
| 103 | $this->assertEquals($this->rssConfiguration->author(), $reader->xpath('channel/itunes:author')[0]); |
||
| 104 | $this->assertEquals($this->rssConfiguration->explicit(), $reader->xpath('channel/itunes:explicit')[0]); |
||
| 105 | $this->assertEquals($this->rssConfiguration->type(), $reader->xpath('channel/itunes:type')[0]); |
||
| 106 | $this->assertEquals( |
||
| 107 | $this->rssConfiguration->category(), |
||
| 108 | $reader->xpath('channel/itunes:category')[0]['text'] |
||
| 109 | ); |
||
| 110 | $this->assertEquals( |
||
| 111 | $this->rssConfiguration->imageUrl(), |
||
| 112 | $reader->xpath('channel/itunes:image')[0]['href'] |
||
| 113 | ); |
||
| 114 | $this->assertEquals( |
||
| 115 | $this->rssConfiguration->author(), |
||
| 116 | $reader->xpath('channel/itunes:owner/itunes:name')[0] |
||
| 117 | ); |
||
| 118 | $this->assertEquals( |
||
| 119 | $this->rssConfiguration->email(), |
||
| 120 | $reader->xpath('channel/itunes:owner/itunes:email')[0] |
||
| 121 | ); |
||
| 122 | |||
| 123 | $this->assertEquals( |
||
| 124 | $this->rssConfiguration->description(), |
||
| 125 | $reader->xpath('channel/googleplay:description')[0] |
||
| 126 | ); |
||
| 178 |