mirror of
https://github.com/shlinkio/shlink.git
synced 2026-03-12 01:54:41 +08:00
Updated to coding standard v2.1
This commit is contained in:
@@ -43,7 +43,7 @@ class ShortUrlRepositoryTest extends DatabaseTestCase
|
||||
|
||||
$notYetValid = new ShortUrl(
|
||||
'bar',
|
||||
ShortUrlMeta::createFromParams(Chronos::now()->addMonth(), null, 'bar_very_long_text')
|
||||
ShortUrlMeta::createFromParams(Chronos::now()->addMonth(), null, 'bar_very_long_text'),
|
||||
);
|
||||
$this->getEntityManager()->persist($notYetValid);
|
||||
|
||||
@@ -82,11 +82,11 @@ class ShortUrlRepositoryTest extends DatabaseTestCase
|
||||
$this->assertSame($withDomain, $this->repo->findOneByShortCode($withDomain->getShortCode(), 'example.com'));
|
||||
$this->assertSame(
|
||||
$withDomainDuplicatingRegular,
|
||||
$this->repo->findOneByShortCode($withDomainDuplicatingRegular->getShortCode(), 'doma.in')
|
||||
$this->repo->findOneByShortCode($withDomainDuplicatingRegular->getShortCode(), 'doma.in'),
|
||||
);
|
||||
$this->assertSame(
|
||||
$regularOne,
|
||||
$this->repo->findOneByShortCode($withDomainDuplicatingRegular->getShortCode(), 'other-domain.com')
|
||||
$this->repo->findOneByShortCode($withDomainDuplicatingRegular->getShortCode(), 'other-domain.com'),
|
||||
);
|
||||
$this->assertNull($this->repo->findOneByShortCode('invalid'));
|
||||
$this->assertNull($this->repo->findOneByShortCode($withDomain->getShortCode()));
|
||||
@@ -160,7 +160,7 @@ class ShortUrlRepositoryTest extends DatabaseTestCase
|
||||
|
||||
$this->assertCount(
|
||||
2,
|
||||
$this->repo->findList(null, null, null, [], null, new DateRange(Chronos::now()->subDays(2)))
|
||||
$this->repo->findList(null, null, null, [], null, new DateRange(Chronos::now()->subDays(2))),
|
||||
);
|
||||
$this->assertEquals(2, $this->repo->countList(null, [], new DateRange(Chronos::now()->subDays(2))));
|
||||
}
|
||||
@@ -192,7 +192,7 @@ class ShortUrlRepositoryTest extends DatabaseTestCase
|
||||
|
||||
$shortUrlWithDomain = new ShortUrl(
|
||||
'foo',
|
||||
ShortUrlMeta::createFromRawData(['domain' => 'doma.in', 'customSlug' => 'another-slug'])
|
||||
ShortUrlMeta::createFromRawData(['domain' => 'doma.in', 'customSlug' => 'another-slug']),
|
||||
);
|
||||
$this->getEntityManager()->persist($shortUrlWithDomain);
|
||||
|
||||
|
||||
@@ -22,13 +22,13 @@ class TagRepositoryTest extends DatabaseTestCase
|
||||
}
|
||||
|
||||
/** @test */
|
||||
public function deleteByNameDoesNothingWhenEmptyListIsProvided()
|
||||
public function deleteByNameDoesNothingWhenEmptyListIsProvided(): void
|
||||
{
|
||||
$this->assertEquals(0, $this->repo->deleteByName([]));
|
||||
}
|
||||
|
||||
/** @test */
|
||||
public function allTagsWhichMatchNameAreDeleted()
|
||||
public function allTagsWhichMatchNameAreDeleted(): void
|
||||
{
|
||||
$names = ['foo', 'bar', 'baz'];
|
||||
$toDelete = ['foo', 'baz'];
|
||||
|
||||
@@ -85,10 +85,10 @@ class VisitRepositoryTest extends DatabaseTestCase
|
||||
$this->assertCount(6, $this->repo->findVisitsByShortCode($shortUrl->getShortCode()));
|
||||
$this->assertCount(2, $this->repo->findVisitsByShortCode($shortUrl->getShortCode(), new DateRange(
|
||||
Chronos::parse('2016-01-02'),
|
||||
Chronos::parse('2016-01-03')
|
||||
Chronos::parse('2016-01-03'),
|
||||
)));
|
||||
$this->assertCount(4, $this->repo->findVisitsByShortCode($shortUrl->getShortCode(), new DateRange(
|
||||
Chronos::parse('2016-01-03')
|
||||
Chronos::parse('2016-01-03'),
|
||||
)));
|
||||
$this->assertCount(3, $this->repo->findVisitsByShortCode($shortUrl->getShortCode(), null, 3, 2));
|
||||
$this->assertCount(2, $this->repo->findVisitsByShortCode($shortUrl->getShortCode(), null, 5, 4));
|
||||
@@ -110,10 +110,10 @@ class VisitRepositoryTest extends DatabaseTestCase
|
||||
$this->assertEquals(6, $this->repo->countVisitsByShortCode($shortUrl->getShortCode()));
|
||||
$this->assertEquals(2, $this->repo->countVisitsByShortCode($shortUrl->getShortCode(), new DateRange(
|
||||
Chronos::parse('2016-01-02'),
|
||||
Chronos::parse('2016-01-03')
|
||||
Chronos::parse('2016-01-03'),
|
||||
)));
|
||||
$this->assertEquals(4, $this->repo->countVisitsByShortCode($shortUrl->getShortCode(), new DateRange(
|
||||
Chronos::parse('2016-01-03')
|
||||
Chronos::parse('2016-01-03'),
|
||||
)));
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user