Skip to content

Update tests & readme#15

Merged
drwho725 merged 2 commits intomasterfrom
update-tests
Feb 9, 2026
Merged

Update tests & readme#15
drwho725 merged 2 commits intomasterfrom
update-tests

Conversation

@drwho725
Copy link
Copy Markdown

@drwho725 drwho725 commented Feb 9, 2026

PR Type

Tests, Documentation


Description

  • Update socket timeout assertions to use float type for strict validation

  • Replace assertEquals with assertSame for timeout type checking

  • Add explicit float cast for ini_get('default_socket_timeout') calls

  • Add Connection Timeout section with float examples and documentation

  • Fix grammar, typos, and improve README accuracy

  • Update version constraint from ~3.0 to ^3.2


Diagram Walkthrough

flowchart LR
  A["Socket Timeout Tests"] -->|"Change to float type"| B["TcpSocket & UdpSocket Tests"]
  A -->|"Use assertSame"| B
  C["README Documentation"] -->|"Add timeout section"| D["Connection Timeout Examples"]
  C -->|"Fix grammar & links"| E["Improved Accuracy"]
  C -->|"Update version"| F["^3.2 Constraint"]
Loading

File Walkthrough

Relevant files
Tests
TcpSocketTest.php
Update TCP socket timeout tests to float type                       

tests/unit/Connection/TcpSocketTest.php

  • Changed timeout parameter from int (10) to float (10.0) in test
    constructors
  • Replaced assertEquals with assertSame for strict float type checking
    on timeout assertions
  • Added explicit (float) cast for ini_get('default_socket_timeout')
    comparison
+4/-4     
UdpSocketTest.php
Update UDP socket timeout tests to float type                       

tests/unit/Connection/UdpSocketTest.php

  • Changed timeout parameter from int (10) to float (10.0) in test
    constructors
  • Replaced assertEquals with assertSame for strict float type checking
    on timeout assertions
  • Added explicit (float) cast for ini_get('default_socket_timeout')
    comparison
+3/-3     
Documentation
README.md
Add timeout documentation and improve README accuracy       

README.md

  • Converted bare URL to markdown link format for domnikl/statsd-php
    repository
  • Updated version constraint from ~3.0 to ^3.2 in composer.json example
  • Fixed grammar error: changed "therefor" to "therefore"
  • Added new Connection Timeout section with float examples for UdpSocket
    and TcpSocket
  • Fixed grammar: changed "options" to "option" and improved sentence
    structure
  • Standardized heading capitalization: "disabling sending of metrics" to
    "Disabling Sending of Metrics"
+20/-8   

- Change timeout parameter from int to float in test constructors
- Replace assertEquals with assertSame for strict type checking
- Add explicit float cast for ini_get('default_socket_timeout')
- Convert bare URL to markdown link
- Update version constraint to ^3.2
- Fix grammar and typos (therefor, options)
- Add Connection Timeout section with float examples
- Standardize heading capitalization
@drwho725 drwho725 self-assigned this Feb 9, 2026
@qodo-slickdeals
Copy link
Copy Markdown

PR Compliance Guide 🔍

Below is a summary of compliance checks for this PR:

Security Compliance
🟢
No security concerns identified No security vulnerabilities detected by AI analysis. Human verification advised for critical code.
Ticket Compliance
🎫 No ticket provided
  • Create ticket/issue
Codebase Duplication Compliance
🟢
No codebase code duplication found No new components were introduced in the PR code
Custom Compliance
🟢
Generic: Comprehensive Audit Trails

Objective: To create a detailed and reliable record of critical system actions for security analysis
and compliance.

Status: Passed

Learn more about managing compliance generic rules or creating your own custom rules

Generic: Meaningful Naming and Self-Documenting Code

Objective: Ensure all identifiers clearly express their purpose and intent, making code
self-documenting

Status: Passed

Learn more about managing compliance generic rules or creating your own custom rules

Generic: Robust Error Handling and Edge Case Management

Objective: Ensure comprehensive error handling that provides meaningful context and graceful
degradation

Status: Passed

Learn more about managing compliance generic rules or creating your own custom rules

Generic: Secure Error Handling

Objective: To prevent the leakage of sensitive system information through error messages while
providing sufficient detail for internal debugging.

Status: Passed

Learn more about managing compliance generic rules or creating your own custom rules

Generic: Secure Logging Practices

Objective: To ensure logs are useful for debugging and auditing without exposing sensitive
information like PII, PHI, or cardholder data.

Status: Passed

Learn more about managing compliance generic rules or creating your own custom rules

Generic: Security-First Input Validation and Data Handling

Objective: Ensure all data inputs are validated, sanitized, and handled securely to prevent
vulnerabilities

Status: Passed

Learn more about managing compliance generic rules or creating your own custom rules

Compliance status legend 🟢 - Fully Compliant
🟡 - Partial Compliant
🔴 - Not Compliant
⚪ - Requires Further Human Verification
🏷️ - Compliance label

@qodo-slickdeals
Copy link
Copy Markdown

PR Code Suggestions ✨

Explore these optional code suggestions:

CategorySuggestion                                                                                                                                    Impact
General
Reduce test timeout for robustness

In testThrowsExceptionWhenTryingToConnectToNotExistingServer, reduce the
connection timeout from 1.0 to 0.1 to make the test faster and more reliable in
CI environments.

tests/unit/Connection/TcpSocketTest.php [32-39]

 public function testThrowsExceptionWhenTryingToConnectToNotExistingServer()
 {
     $this->expectException(\Domnikl\Statsd\Connection\TcpSocketException::class);
     $this->expectExceptionMessage('Couldn\'t connect to host "localhost:66000":');
 
-    $connection = new TcpSocket('localhost', 66000, 1.0);
+    $connection = new TcpSocket('localhost', 66000, 0.1);
     $connection->send('foobar');
 }
  • Apply / Chat
Suggestion importance[1-10]: 6

__

Why: This is a valid suggestion that improves test suite robustness and speed by reducing a timeout, which is good practice for tests involving network operations.

Low
Use JSON for composer snippet

In the README.md file, change the code block language from javascript to json
for the composer.json example to ensure correct syntax highlighting.

README.md [13-19]

-```javascript
+```json
 {
     "require": {
         "slickdeals/statsd": "^3.2"
     }
 }


- [ ] **Apply / Chat** <!-- /improve --apply_suggestion=1 -->


<details><summary>Suggestion importance[1-10]: 4</summary>

__

Why: The suggestion correctly points out that `json` is a more appropriate language specifier for a `composer.json` snippet than `javascript`, improving documentation clarity and syntax highlighting.

</details></details></td><td align=center>Low

</td></tr>
<tr><td align="center" colspan="2">

- [ ] More <!-- /improve --more_suggestions=true -->

</td><td></td></tr></tbody></table>

@drwho725 drwho725 merged commit 463c6f7 into master Feb 9, 2026
8 of 10 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant