Skip to content

Commit

Permalink
wip
Browse files Browse the repository at this point in the history
  • Loading branch information
freekmurze committed Nov 2, 2021
1 parent 4e970f0 commit 8802859
Show file tree
Hide file tree
Showing 3 changed files with 28 additions and 2 deletions.
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,10 @@ All notable changes to `dns` will be documented in this file

## 2.3.1 - 2021-11-02

- fix macroable behaviour

## 2.3.1 - 2021-11-02

- allow v1 of spatie/macroable

## 2.3.0 - 2021-11-02
Expand Down
6 changes: 4 additions & 2 deletions src/Records/Record.php
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,9 @@
*/
abstract class Record implements Stringable
{
use Macroable;
use Macroable {
__call as protected macroCall;
}

protected string $host;
protected int $ttl;
Expand Down Expand Up @@ -72,7 +74,7 @@ public function __call(string $name, array $arguments)
return $this->$name;
}

throw new BadMethodCallException();
return $this->macroCall($name, $arguments);
}

protected static function lineToArray(string $line, ?int $limit = null): array
Expand Down
20 changes: 20 additions & 0 deletions tests/Records/RecordTest.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
<?php

namespace Spatie\Dns\Test\Records;

use PHPUnit\Framework\TestCase;
use Spatie\Dns\Records\A;
use Spatie\Dns\Records\Record;

class RecordTest extends TestCase
{
/** @test */
public function a_record_is_macroable()
{
Record::macro('ping', fn() => 'pong');

$record = A::parse('spatie.be. 900 IN A 138.197.187.74');

$this->assertEquals('pong', $record->ping());
}
}

1 comment on commit 8802859

@myckhel
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Mr @freekmurze, can you please help us start giving most of your commits some meaningful title 🙏?

Thank you for being a saviour to the community.

Please sign in to comment.