| Conditions | 1 |
| Paths | 1 |
| Total Lines | 33 |
| Lines | 0 |
| Ratio | 0 % |
| Changes | 0 | ||
| 1 | <?php |
||
| 17 | public function testFromApi(): void |
||
| 18 | { |
||
| 19 | $data = <<<'EOD' |
||
| 20 | { |
||
| 21 | "name" : "Roll Over Beethoven", |
||
| 22 | "info": "This is a song", |
||
| 23 | "tape": 1, |
||
| 24 | "cover" : { |
||
| 25 | "mbid" : "592a3b6d-c42b-4567-99c9-ecf63bd66499", |
||
| 26 | "tmid" : 734540, |
||
| 27 | "name" : "Chuck Berry", |
||
| 28 | "sortName" : "Berry, Chuck", |
||
| 29 | "disambiguation" : "", |
||
| 30 | "url" : "https://www.setlist.fm/setlists/chuck-berry-63d6a2b7.html" |
||
| 31 | }, |
||
| 32 | "with" : { |
||
| 33 | "mbid" : "b10bbbfc-cf9e-42e0-be17-e2c3e1d2600d", |
||
| 34 | "tmid" : 735610, |
||
| 35 | "name" : "The Beatles", |
||
| 36 | "sortName" : "Beatles, The", |
||
| 37 | "disambiguation" : "", |
||
| 38 | "url" : "https://www.setlist.fm/setlists/the-beatles-23d6a88b.html" |
||
| 39 | } |
||
| 40 | } |
||
| 41 | EOD; |
||
| 42 | |||
| 43 | $song = Song::fromApi(json_decode($data, true)); |
||
| 44 | $this->assertSame('Roll Over Beethoven', $song->getName()); |
||
| 45 | $this->assertSame('This is a song', $song->getInfo()); |
||
| 46 | $this->assertNotNull($song->getCover()); |
||
| 47 | $this->assertNotNull($song->getFeaturings()); |
||
| 48 | $this->assertTrue($song->isTaped()); |
||
| 49 | } |
||
| 50 | } |
||
| 51 |