200でなかったときのテストを削除
4xxや5xxの場合は`\GuzzleHttp\Exception\BadResponseException`が発生するので、今まであったelseのところには到達しなかった
This commit is contained in:
		@@ -24,7 +24,6 @@ class XtubeResolver implements Resolver
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        $res = $this->client->get($url);
 | 
			
		||||
        if ($res->getStatusCode() === 200) {
 | 
			
		||||
        $html = (string) $res->getBody();
 | 
			
		||||
        $metadata = new Metadata();
 | 
			
		||||
        $crawler = new Crawler($html);
 | 
			
		||||
@@ -39,8 +38,5 @@ class XtubeResolver implements Resolver
 | 
			
		||||
        $metadata->tags = $crawler->filter('.tagsCategories a')->extract('_text');
 | 
			
		||||
 | 
			
		||||
        return $metadata;
 | 
			
		||||
        } else {
 | 
			
		||||
            throw new \RuntimeException("{$res->getStatusCode()}: $url");
 | 
			
		||||
        }
 | 
			
		||||
    }
 | 
			
		||||
}
 | 
			
		||||
 
 | 
			
		||||
@@ -42,13 +42,4 @@ class XtubeResolverTest extends TestCase
 | 
			
		||||
        $this->createResolver(XtubeResolver::class, '');
 | 
			
		||||
        $this->resolver->resolve('https://www.xtube.com/gallery/black-celebs-free-7686657');
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    public function testNotOK()
 | 
			
		||||
    {
 | 
			
		||||
        $this->expectException(\RuntimeException::class);
 | 
			
		||||
        $this->expectExceptionMessage('404: https://www.xtube.com/video-watch/notfound-404');
 | 
			
		||||
 | 
			
		||||
        $this->createResolver(XtubeResolver::class, '', [], 404);
 | 
			
		||||
        $this->resolver->resolve('https://www.xtube.com/video-watch/notfound-404');
 | 
			
		||||
    }
 | 
			
		||||
}
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user