The project uses PHPUnit for unit and integration testing. Fixtures enable testing without live servers.
- All Tests:
composer tests-fast - Specific Test:
vendor/bin/phpunit tests/CSQuery/CSQueryTest.php - With Coverage:
vendor/bin/phpunit --coverage-html coverage/
tests/CSQuery/: Unit tests for core components.tests/unit/Capture/: Tests for capture system.tests/fixtures/: Saved server responses for replay.
use PHPUnit\Framework\TestCase;
class MyTest extends TestCase
{
public function testSomething(): void
{
$this->assertTrue(true);
}
}Use FixtureReplayHelper trait for testing with captured data.
- Capture a real server:
php bin/capture <ip> <port> <protocol> - Fixtures saved in
tests/fixtures/ - Tests replay fixtures for consistent results.