Skip to content

Commit

Permalink
wip
Browse files Browse the repository at this point in the history
  • Loading branch information
freekmurze committed Jun 1, 2021
1 parent 48861f3 commit a0b9c27
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 7 deletions.
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,10 @@

All notable changes to `dns` will be documented in this file

## 2.0.1 - 2021-06-01

- let `getRecords` return an array instead of a custom collection

## 2.0.0 - 2021-05-20

- near-total rewrite
Expand Down
4 changes: 2 additions & 2 deletions src/Dns.php
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ public function getNameserver(): ?string
public function getRecords(
Domain | string $search,
int | string | array $types = DNS_ALL
): Collection {
): array {
$domain = $this->sanitizeDomain(strval($search));
$types = $this->resolveTypes($types);

Expand All @@ -59,7 +59,7 @@ public function getRecords(
);
}

return Collection::make($records);
return $records;
}

protected function getHandler(): Handler
Expand Down
10 changes: 5 additions & 5 deletions tests/DnsTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -141,11 +141,11 @@ public function it_throws_exception_on_failed_to_fetch_dns_record()
->getRecords('spatie.be', DNS_A);
}

protected function assertSeeRecordTypes(Collection $records, array $types)
protected function assertSeeRecordTypes(array $records, array $types)
{
foreach ($types as $type) {
$foundRecords = array_filter(
$records->all(),
$records,
fn (Record $record): bool => is_a($record, $type)
);

Expand All @@ -165,11 +165,11 @@ protected function assertDontSeeRecordTypes(Collection $records, array $types)
}
}

protected function assertOnlySeeRecordTypes(Collection $records, array $types)
protected function assertOnlySeeRecordTypes(array $records, array $types)
{
$expectedCount = count($records->all());
$expectedCount = count($records);

$foundRecords = Collection::make($records->all())
$foundRecords = Collection::make($records)
->filter(fn (Record $record) => $this->recordIsOfType($record, $types));

$this->assertCount($expectedCount, $foundRecords);
Expand Down

0 comments on commit a0b9c27

Please sign in to comment.