-
Notifications
You must be signed in to change notification settings - Fork 0
fix: lowercase questions #18
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
Conversation
WalkthroughThis pull request modifies the DNS Message classes to use promoted properties in constructors. The Question class changes from a promoted property constructor to explicitly assigning a lowercase-normalized name to a public property. The Record class introduces promoted public properties for type, class, ttl, rdata, and optional priority, weight, and port fields. A class-level docblock is added to Record. Four new unit tests validate constructor behavior for Questions with name normalization, Zone/File export and import operations with template records, and Zone constructor acceptance of template records. Estimated code review effort🎯 2 (Simple) | ⏱️ ~12 minutes
Pre-merge checks and finishing touches❌ Failed checks (1 warning)
✅ Passed checks (2 passed)
✨ Finishing touches
🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
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.
Actionable comments posted: 2
🧹 Nitpick comments (2)
tests/unit/DNS/Message/QuestionTest.php (1)
11-16: Consider testing with mixed case input.The first test uses already-lowercase input, so it doesn't verify case normalization. Consider using mixed case like
'Www.Example.Com'to make the test more meaningful, or remove it sincetestConstructorSetsNameCaseInsensitivealready validates the lowercase behavior.Example:
public function testConstructorSetsName(): void { - $question = new Question('www.example.com', Record::TYPE_A, Record::CLASS_IN); + $question = new Question('Www.Example.Com', Record::TYPE_A, Record::CLASS_IN); $this->assertSame('www.example.com', $question->name); }tests/unit/DNS/Zone/FileTest.php (1)
550-567: Use conventional IPv6 address format.While
'b:b::b:b:b'is technically valid IPv6, it's unconventional. Use standard test addresses like'2001:db8::1'for better readability and consistency with other tests.$ORIGIN example.com. %s -www 600 IN AAAA b:b::b:b:b +www 600 IN AAAA 2001:db8::1 ZONE, self::DEFAULT_SOA ); $zone = File::import($contents); $this->assertInstanceOf(Zone::class, $zone); $this->assertCount(1, $zone->records); $this->assertSame('www.example.com', $zone->records[0]->name); - $this->assertSame('b:b::b:b:b', $zone->records[0]->rdata); + $this->assertSame('2001:db8::1', $zone->records[0]->rdata);
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (5)
src/DNS/Message/Question.php(1 hunks)src/DNS/Message/Record.php(2 hunks)tests/unit/DNS/Message/QuestionTest.php(1 hunks)tests/unit/DNS/Zone/FileTest.php(1 hunks)tests/unit/DNS/ZoneTest.php(1 hunks)
🧰 Additional context used
🧬 Code graph analysis (4)
tests/unit/DNS/Message/QuestionTest.php (2)
src/DNS/Message/Question.php (1)
Question(7-54)src/DNS/Message/Record.php (1)
Record(10-542)
tests/unit/DNS/ZoneTest.php (2)
src/DNS/Message/Record.php (1)
Record(10-542)src/DNS/Zone.php (1)
Zone(10-72)
tests/unit/DNS/Zone/FileTest.php (2)
src/DNS/Message/Record.php (1)
Record(10-542)src/DNS/Zone/File.php (2)
File(13-815)export(130-188)
src/DNS/Message/Question.php (2)
src/DNS/Message/Record.php (2)
__construct(113-124)Record(10-542)src/DNS/Message.php (1)
__construct(32-68)
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (1)
- GitHub Check: Unit & E2E
🔇 Additional comments (3)
src/DNS/Message/Record.php (2)
7-9: LGTM! Clear class documentation.The class-level docblock appropriately describes the Record class purpose.
101-124: Excellent constructor documentation.The detailed docblock clearly documents all parameters, their types, default values, and usage context. The implementation correctly normalizes the domain name to lowercase while using promoted properties for other fields.
src/DNS/Message/Question.php (1)
9-17: LGTM! Correct implementation of case-insensitive name handling.The change from promoted property to explicit assignment enables lowercase normalization of domain names, which is essential for case-insensitive DNS lookups. The pattern is consistent with the Record class implementation.
Summary by CodeRabbit
New Features
Tests