From 88028598d1997b604ba6931abca7c6f9ef20526d Mon Sep 17 00:00:00 2001 From: freek Date: Tue, 2 Nov 2021 11:07:22 +0100 Subject: [PATCH] wip --- CHANGELOG.md | 4 ++++ src/Records/Record.php | 6 ++++-- tests/Records/RecordTest.php | 20 ++++++++++++++++++++ 3 files changed, 28 insertions(+), 2 deletions(-) create mode 100644 tests/Records/RecordTest.php diff --git a/CHANGELOG.md b/CHANGELOG.md index 1a028d6..68b3af6 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -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 diff --git a/src/Records/Record.php b/src/Records/Record.php index 6843c34..5f9a183 100644 --- a/src/Records/Record.php +++ b/src/Records/Record.php @@ -17,7 +17,9 @@ */ abstract class Record implements Stringable { - use Macroable; + use Macroable { + __call as protected macroCall; + } protected string $host; protected int $ttl; @@ -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 diff --git a/tests/Records/RecordTest.php b/tests/Records/RecordTest.php new file mode 100644 index 0000000..aff071e --- /dev/null +++ b/tests/Records/RecordTest.php @@ -0,0 +1,20 @@ + 'pong'); + + $record = A::parse('spatie.be. 900 IN A 138.197.187.74'); + + $this->assertEquals('pong', $record->ping()); + } +}