Ensured same long URL can be used multiple times for different short URLs

This commit is contained in:
Alejandro Celaya
2018-09-11 19:44:33 +02:00
parent fcb9121e5a
commit c2dd5b8c47
3 changed files with 13 additions and 33 deletions

View File

@@ -119,21 +119,6 @@ class UrlShortenerTest extends TestCase
$this->urlShortener->urlToShortCode(new Uri('http://foobar.com/12345/hello?foo=bar'));
}
/**
* @test
*/
public function whenShortUrlExistsItsShortcodeIsReturned()
{
$shortUrl = new ShortUrl();
$shortUrl->setShortCode('expected_shortcode');
$repo = $this->prophesize(ObjectRepository::class);
$repo->findOneBy(Argument::any())->willReturn($shortUrl);
$this->em->getRepository(ShortUrl::class)->willReturn($repo->reveal());
$shortCode = $this->urlShortener->urlToShortCode(new Uri('http://foobar.com/12345/hello?foo=bar'));
$this->assertEquals($shortUrl->getShortCode(), $shortCode);
}
/**
* @test
*/