mirror of
https://github.com/shlinkio/shlink.git
synced 2025-03-28 04:22:04 +03:00
Add API test for type-filtering in orphan visits list
This commit is contained in:
parent
f17b641d46
commit
430883987a
1 changed files with 18 additions and 0 deletions
|
@ -8,6 +8,7 @@ use GuzzleHttp\RequestOptions;
|
||||||
use PHPUnit\Framework\Attributes\DataProvider;
|
use PHPUnit\Framework\Attributes\DataProvider;
|
||||||
use PHPUnit\Framework\Attributes\Test;
|
use PHPUnit\Framework\Attributes\Test;
|
||||||
use Shlinkio\Shlink\Common\Paginator\Paginator;
|
use Shlinkio\Shlink\Common\Paginator\Paginator;
|
||||||
|
use Shlinkio\Shlink\Core\Visit\Model\OrphanVisitType;
|
||||||
use Shlinkio\Shlink\TestUtils\ApiTest\ApiTestCase;
|
use Shlinkio\Shlink\TestUtils\ApiTest\ApiTestCase;
|
||||||
|
|
||||||
class OrphanVisitsTest extends ApiTestCase
|
class OrphanVisitsTest extends ApiTestCase
|
||||||
|
@ -68,6 +69,23 @@ class OrphanVisitsTest extends ApiTestCase
|
||||||
1,
|
1,
|
||||||
[self::REGULAR_NOT_FOUND],
|
[self::REGULAR_NOT_FOUND],
|
||||||
];
|
];
|
||||||
|
yield 'base_url only' => [['type' => OrphanVisitType::BASE_URL->value], 1, 1, [self::BASE_URL]];
|
||||||
|
yield 'regular_404 only' => [['type' => OrphanVisitType::REGULAR_404->value], 1, 1, [self::REGULAR_NOT_FOUND]];
|
||||||
|
yield 'invalid_short_url only' => [
|
||||||
|
['type' => OrphanVisitType::INVALID_SHORT_URL->value],
|
||||||
|
1,
|
||||||
|
1,
|
||||||
|
[self::INVALID_SHORT_URL],
|
||||||
|
];
|
||||||
|
}
|
||||||
|
|
||||||
|
#[Test]
|
||||||
|
public function errorIsReturnedForInvalidType(): void
|
||||||
|
{
|
||||||
|
$resp = $this->callApiWithKey(self::METHOD_GET, '/visits/orphan', [
|
||||||
|
RequestOptions::QUERY => ['type' => 'invalid'],
|
||||||
|
]);
|
||||||
|
self::assertEquals(400, $resp->getStatusCode());
|
||||||
}
|
}
|
||||||
|
|
||||||
#[Test]
|
#[Test]
|
||||||
|
|
Loading…
Add table
Reference in a new issue