✨ Add IP#79
Conversation
📝 WalkthroughWalkthroughA new Changes
Estimated code review effort🎯 2 (Simple) | ⏱️ ~8 minutes Poem
🚥 Pre-merge checks | ✅ 2 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (2 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches📝 Generate docstrings
🧪 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.
🧹 Nitpick comments (1)
tests/Unit/Extensions/InternetExtensionTest.php (1)
63-72: StrengthentestIp()to assert both IPv4 and IPv6 are produced.Current assertions validate format only; they won’t catch a regression where
ip()always returns a single IP family.Suggested test hardening
public function testIp(): void { $faker = new Container(false); + $seenIpv4 = false; + $seenIpv6 = false; for ($i = 0; $i < 50; $i++) { $result = $faker->ip(); - $this->assertNotFalse(filter_var($result, FILTER_VALIDATE_IP, FILTER_FLAG_IPV4) || filter_var($result, FILTER_VALIDATE_IP, FILTER_FLAG_IPV6)); + $isIpv4 = false !== filter_var($result, FILTER_VALIDATE_IP, FILTER_FLAG_IPV4); + $isIpv6 = false !== filter_var($result, FILTER_VALIDATE_IP, FILTER_FLAG_IPV6); + + $this->assertTrue($isIpv4 || $isIpv6); + $seenIpv4 = $seenIpv4 || $isIpv4; + $seenIpv6 = $seenIpv6 || $isIpv6; } + + $this->assertTrue($seenIpv4, 'Expected at least one IPv4 address'); + $this->assertTrue($seenIpv6, 'Expected at least one IPv6 address'); }🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@tests/Unit/Extensions/InternetExtensionTest.php` around lines 63 - 72, The testIp() currently only checks that each Container->ip() result is a valid IP but doesn't ensure both families are produced; modify testIp() to track whether an IPv4 and an IPv6 have been seen across the loop (e.g., booleans ipv4Seen and ipv6Seen), update them by checking each $result with FILTER_FLAG_IPV4 and FILTER_FLAG_IPV6, keep the existing per-iteration validation, and after the loop assert that both ipv4Seen and ipv6Seen are true to catch regressions where ip() returns only one family.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Nitpick comments:
In `@tests/Unit/Extensions/InternetExtensionTest.php`:
- Around line 63-72: The testIp() currently only checks that each
Container->ip() result is a valid IP but doesn't ensure both families are
produced; modify testIp() to track whether an IPv4 and an IPv6 have been seen
across the loop (e.g., booleans ipv4Seen and ipv6Seen), update them by checking
each $result with FILTER_FLAG_IPV4 and FILTER_FLAG_IPV6, keep the existing
per-iteration validation, and after the loop assert that both ipv4Seen and
ipv6Seen are true to catch regressions where ip() returns only one family.
ℹ️ Review info
⚙️ Run configuration
Configuration used: defaults
Review profile: CHILL
Plan: Pro
Run ID: 853e6828-506e-4c14-bcce-d13f7248ec2b
📒 Files selected for processing (2)
src/Extensions/InternetExtension.phptests/Unit/Extensions/InternetExtensionTest.php
Summary by CodeRabbit
New Features
Tests