| Conditions | 1 |
| Paths | 1 |
| Total Lines | 19 |
| Lines | 0 |
| Ratio | 0 % |
| Changes | 0 | ||
| 1 | <?php |
||
| 17 | public function testFromApi(): void |
||
| 18 | { |
||
| 19 | $data = <<<'EOD' |
||
| 20 | { |
||
| 21 | "userId": "Metal-42", |
||
| 22 | "fullname": "Max", |
||
| 23 | "about": "Some dummy text", |
||
| 24 | "website": "http://example.com", |
||
| 25 | "url": "https://www.setlist.fm/user/Metal-42" |
||
| 26 | } |
||
| 27 | EOD; |
||
| 28 | |||
| 29 | $user = User::fromApi(json_decode($data, true)); |
||
| 30 | $this->assertSame('Metal-42', $user->getId()); |
||
| 31 | $this->assertSame('Some dummy text', $user->getAbout()); |
||
| 32 | $this->assertSame('Max', $user->getFullname()); |
||
| 33 | $this->assertSame('http://example.com', $user->getWebsite()); |
||
| 34 | $this->assertSame('https://www.setlist.fm/user/Metal-42', $user->getUrl()); |
||
| 35 | } |
||
| 36 | } |
||
| 37 |