Reduce duplication in actions listing visits

This commit is contained in:
Alejandro Celaya
2024-11-20 09:45:18 +01:00
parent 0c75202936
commit d7e300e2d5
8 changed files with 83 additions and 91 deletions

View File

@@ -21,9 +21,8 @@ final class OrphanVisitsParams extends VisitsParams
parent::__construct($dateRange, $page, $itemsPerPage, $excludeBots);
}
public static function fromRawData(array $query): self
public static function fromVisitsParamsAndRawData(VisitsParams $visitsParams, array $query): self
{
$visitsParams = parent::fromRawData($query);
$type = $query['type'] ?? null;
return new self(

View File

@@ -27,7 +27,7 @@ class OrphanVisitsPaginatorAdapterTest extends TestCase
protected function setUp(): void
{
$this->repo = $this->createMock(VisitRepositoryInterface::class);
$this->params = OrphanVisitsParams::fromRawData([]);
$this->params = new OrphanVisitsParams();
$this->apiKey = ApiKey::create();
$this->adapter = new OrphanVisitsPaginatorAdapter($this->repo, $this->params, $this->apiKey);