-
Notifications
You must be signed in to change notification settings - Fork 33
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
fix: RRSet save comments #144
Merged
Merged
Changes from 3 commits
Commits
Show all changes
6 commits
Select commit
Hold shift + click to select a range
8c70c71
fix: add transformer for comments
bennetgallein dda4634
chore: add tests for comment-transformer
bennetgallein 1749c37
fix: added comments to every other place on zone creation
bennetgallein d26297d
chore: extended tests
bennetgallein ffd4314
chore: formatting
bennetgallein 865754b
chore: order of function args in comment
bennetgallein File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
<?php | ||
|
||
namespace Exonet\Powerdns\Transformers; | ||
|
||
class CommentTransformer extends Transformer | ||
{ | ||
/** | ||
* {@inheritdoc} | ||
*/ | ||
public function transform() | ||
{ | ||
return (object) [ | ||
'content' => $this->data->getContent(), | ||
'account' => $this->data->getAccount(), | ||
'modified_at' => $this->data->getModifiedAt(), | ||
]; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change | ||||||||
---|---|---|---|---|---|---|---|---|---|---|
|
@@ -13,13 +13,14 @@ class HelperTest extends TestCase | |||||||||
{ | ||||||||||
public function testWithArguments(): void | ||||||||||
{ | ||||||||||
$result = Helper::createResourceRecord('unit.test.', 'www', RecordType::A, '127.0.0.1', 1337); | ||||||||||
$result = Helper::createResourceRecord('unit.test.', 'www', RecordType::A, '127.0.0.1', 1337, [['content' => 'Hello World', 'account' => 'Tester']]); | ||||||||||
|
||||||||||
self::assertSame('www.unit.test.', $result->getName()); | ||||||||||
self::assertSame('A', $result->getType()); | ||||||||||
self::assertSame(1337, $result->getTtl()); | ||||||||||
self::assertCount(1, $result->getRecords()); | ||||||||||
self::assertSame('127.0.0.1', $result->getRecords()[0]->getContent()); | ||||||||||
self::assertSame('Hello World', $result->getComments()[0]->getContent()); | ||||||||||
} | ||||||||||
|
||||||||||
public function testWithArray(): void | ||||||||||
|
@@ -31,6 +32,18 @@ public function testWithArray(): void | |||||||||
'type' => RecordType::A, | ||||||||||
'content' => ['127.0.0.1', '127.0.0.2'], | ||||||||||
'ttl' => 1337, | ||||||||||
'comments' => [ | ||||||||||
[ | ||||||||||
'content' => "Hello", | ||||||||||
'account' => 'rooti', | ||||||||||
'modified_at' => 999 | ||||||||||
], | ||||||||||
[ | ||||||||||
'content' => "World", | ||||||||||
'account' => 'rooti', | ||||||||||
'modified_at' => 111 | ||||||||||
] | ||||||||||
] | ||||||||||
] | ||||||||||
); | ||||||||||
|
||||||||||
|
@@ -40,6 +53,7 @@ public function testWithArray(): void | |||||||||
self::assertCount(2, $result->getRecords()); | ||||||||||
self::assertSame('127.0.0.1', $result->getRecords()[0]->getContent()); | ||||||||||
self::assertSame('127.0.0.2', $result->getRecords()[1]->getContent()); | ||||||||||
self::assertSame(111, $result->getComments()[1]->getModifiedAt()); | ||||||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
|
||||||||||
} | ||||||||||
|
||||||||||
public function testWithApiResponse(): void | ||||||||||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.