OGPResolverTestをrevert、Guzzleの例外を期待するように変更

This commit is contained in:
shibafu 2019-09-10 22:34:15 +09:00
parent ccade6ff9f
commit 2c4eaccf43

View File

@ -3,12 +3,21 @@
namespace Tests\Unit\MetadataResolver; namespace Tests\Unit\MetadataResolver;
use App\MetadataResolver\OGPResolver; use App\MetadataResolver\OGPResolver;
use GuzzleHttp\Exception\BadResponseException;
use Tests\TestCase; use Tests\TestCase;
class OGPResolverTest extends TestCase class OGPResolverTest extends TestCase
{ {
use CreateMockedResolver; use CreateMockedResolver;
public function testMissingUrl()
{
$this->createResolver(OGPResolver::class, '', [], 404);
$this->expectException(BadResponseException::class);
$this->resolver->resolve('http://example.com/404');
}
public function testResolve() public function testResolve()
{ {
$response = <<< 'HTML' $response = <<< 'HTML'