Skip to content
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 6 commits into from
Oct 23, 2023

Conversation

bennetgallein
Copy link
Contributor

Description

Hello, while testing i realized that the code-side of updating/adding comments is there, just missing in the transformers for the actual request. This PR adds the functionality and should work as expected.

Relevant docs: https://doc.powerdns.com/authoritative/http-api/zone.html#rrset

Motivation and context

Well

How has this been tested?

./run-test script runs through no problem, changing my local development env to my github repo and adding/updating comments updates them accordingly

Include details of your testing environment, and the tests you ran to
see how your change affects other areas of the code, etc.

Screenshots (if appropriate)

Checklist:

Go over all the following points, and put an x in all the boxes that apply.

Please, please, please, don't send your pull request until all of the boxes are ticked. Once your pull request is created, it will trigger a build on our continuous integration server to make sure your tests pass.

  • I have read the CONTRIBUTING document.
  • My pull request addresses exactly one patch/feature.
  • My pull request contains a title that can be used as a release note.
  • I have created a branch for this patch/feature.
  • Each individual commit in the pull request is meaningful.
  • I have added tests to cover my changes.
  • If my change requires a change to the documentation, I have updated it accordingly.

If you're unsure about any of these, don't hesitate to ask. We're here to help!

@robbinjanssen robbinjanssen added the new-feature New features or options. label Oct 18, 2023
@trizz trizz self-assigned this Oct 18, 2023

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());
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
self::assertSame('Hello World', $result->getComments()[0]->getContent());
self::assertSame('Hello World', $result->getComments()[0]->getContent());
self::assertSame('Tester', $result->getComments()[0]->getAccount());

@@ -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());
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
self::assertSame(111, $result->getComments()[1]->getModifiedAt());
self::assertSame(111, $result->getComments()[1]->getModifiedAt());
self::assertSame('World', $result->getComments()[1]->getContent());
self::assertSame('rooti', $result->getComments()[1]->getAccount());

@trizz
Copy link
Member

trizz commented Oct 18, 2023

Hi @bennetgallein

Thanks for your PR! It's looking good, but I've made some small suggestions in your tests because you forgot to add some assertions. Also, please run php-cs-fixer to fix this files. Because this is a PR the required GitHub action can't commit to your fork.

@bennetgallein
Copy link
Contributor Author

Relevant files are updated 👍 My auto-formatter wants to format differently so no saving + formatting for me :)

@bennetgallein
Copy link
Contributor Author

On another note: I don't think it's very friendly to have the syntax for the Zone->create method in mind (with the comments double array and stuff. If it's ok I would like to introduce the alternative of passing in the Objects (e.g. a ResourceRecord-Instance and an array of Comment-Instances). Let me know if that's something that would be approved

@bennet-esyoil
Copy link

ping ping @trizz :)

@bennetgallein bennetgallein requested a review from trizz October 20, 2023 19:01
src/Zone.php Outdated Show resolved Hide resolved
@robbinjanssen
Copy link
Member

robbinjanssen commented Oct 23, 2023

@bennetgallein i've created a discussion for your suggestion about the syntax, can you maybe provide a bit of pseudo code there of what you want to achieve? :)

@robbinjanssen robbinjanssen merged commit 3894d96 into exonet:master Oct 23, 2023
2 checks passed
@bennetgallein bennetgallein deleted the fix/save-comments branch October 23, 2023 12:20
@robbinjanssen
Copy link
Member

Published as v4.5.0! 👍🏻 Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
new-feature New features or options.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants