How giberti/phpunit-local-server works
Main Components
a. Test Environment Layer:
• PHPUnit Test Case (parent)
• LocalServerTestCase (extension)
• Test Classes (user implementation)
b. Server Management Layer:
• PHP Built-in Server Controller
• Server Configuration Manager
• Port Manager (for dynamic port assignment)
c. File System Integration:
• Document Root Handler
• Router Script Handler
d. Runtime Layer:
• PHP Binary Manager (for version switching)
• Process Manager
Component Relationships
• Bidirectional communication where applicable
Specific Implementation Details
• Test Environment |
• LocalServerTestCase |
• User Test Classes |
• ↓
• Server Management |
• Server Controller |
• Config Manager |
• Port Manager |
• ↓
• Implementation Layer |
• Docroot Handler |
• Router Handler |
• ↓
• Runtime Layer |
• PHP Binary Manager |
• Process Manager |
Important Elements to Highlight
a. Entry Points:
• createServerWithDocroot()
• createServerWithRouter()
• getServerUrl()
• destroyServer()
b. Configuration Points:
• PHP Binary selection
• Document root path
• Router script path
• Port assignment
Technical Details
• Localhost connection (typically on port 8000)
• Dynamic port allocation mechanism
• File system interaction points
• Process management aspects
Implementation Notes
• Use standardized UML notation where applicable
• Version compatibility information
• Error handling paths