Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
42 changes: 11 additions & 31 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,27 +17,20 @@ jobs:
fail-fast: false
matrix:
os: [ubuntu-latest, macos-latest]
php: [8.0 ,8.1 ,8.2, 8.3, 8.4]
php: ['8.2', '8.3', '8.4', '8.5']
steps:
- uses: actions/checkout@v4

# PHP installation and setup using built-in tools
- name: Setup PHP (Ubuntu)
if: matrix.os == 'ubuntu-latest'
run: |
sudo add-apt-repository ppa:ondrej/php
sudo apt-get update
sudo apt-get install -y php8.2 php8.2-cli php8.2-xml php8.2-curl php8.2-mbstring
php -v
shell: bash

- name: Setup PHP (macOS)
if: matrix.os == 'macos-latest'
run: |
brew install php@8.2
brew link php@8.2 --force
php -v
shell: bash
# PHP from the matrix (the previous hand-rolled apt/brew steps always installed 8.2,
# so the matrix versions were never actually exercised).
- name: Setup PHP ${{ matrix.php }}
if: matrix.os != 'windows-latest'
uses: shivammathur/setup-php@v2
with:
php-version: ${{ matrix.php }}
extensions: mbstring, curl, xml, openssl
tools: composer:v2
coverage: none

- name: Setup PHP (Windows)
if: matrix.os == 'windows-latest'
Expand All @@ -63,19 +56,6 @@ jobs:
echo "C:\tools\composer" | Out-File -FilePath $env:GITHUB_PATH -Encoding utf8 -Append
shell: pwsh

- name: Install Composer (Unix)
if: matrix.os != 'windows-latest'
run: |
php -r "copy('https://getcomposer.org/installer', 'composer-setup.php');"
sudo php composer-setup.php --install-dir=/usr/local/bin --filename=composer
php -r "unlink('composer-setup.php');"
sudo chmod +x /usr/local/bin/composer
mkdir -p ~/.composer
if [ "$RUNNER_OS" == "Linux" ]; then
sudo chown -R $USER:$USER ~/.composer
fi
shell: bash

- name: Get Composer Cache Directory
id: composer-cache
run: echo "dir=$(composer config cache-files-dir)" >> $GITHUB_OUTPUT
Expand Down
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ It combines PHP’s simplicity with Go’s speed and concurrency, allowing you t
- [x] **Think Time & Ramp-Up Configuration** – Simulate real-user behavior.
- [x] **Detailed Reports & Distributed Execution** – Scale tests and analyze results.
- [x] **Debug Requests** - Inspect and troubleshoot request/response payloads easily.
- [ ] **Cloud Execution** – Seamless cloud-based testing in progress.
- [x] **Cloud Execution** – Seamless cloud-based testing.


## Architecture
Expand All @@ -35,7 +35,7 @@ For detailed documentation, visit [https://php.volt-test.com](https://php.volt-t

## Requirements

- PHP 8.0 or higher
- PHP 8.2 or higher
- ext-json
- ext-pcntl
- ext-curl
Expand Down
4 changes: 2 additions & 2 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"name": "volt-test/php-sdk",
"description": "Volt Test PHP SDK - A performance testing tool for PHP Developers",
"type": "library",
"version": "1.2.1",
"version": "1.2.2",
"keywords": [
"volt-test",
"php-sdk",
Expand All @@ -24,7 +24,7 @@
}
],
"require": {
"php": "^8.0",
"php": "^8.2",
"ext-json": "*",
"ext-curl": "*",
"ext-pcntl": "*"
Expand Down
6 changes: 6 additions & 0 deletions src/Exceptions/ErrorHandler.php
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,12 @@ public static function register(): void

public static function handleError(int $errno, string $errstr, string $errfile, int $errline): bool
{
// Deprecations (e.g. curl_close() on PHP 8.5) and errors silenced with @
// or excluded by error_reporting() must not abort a test run.
if (($errno & (E_DEPRECATED | E_USER_DEPRECATED)) !== 0 || (error_reporting() & $errno) === 0) {
return false;
}

throw new \ErrorException(
$errstr,
$errno,
Expand Down
7 changes: 3 additions & 4 deletions src/Platform.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ class Platform
{
private const BINARY_NAME = 'volt-test';

private const ENGINE_CURRENT_VERSION = 'v1.2.1';
private const ENGINE_CURRENT_VERSION = 'v1.2.2';
private const BASE_DOWNLOAD_URL = 'https://github.com/volt-test/binaries/releases/download';
private const SUPPORTED_PLATFORMS = [
'linux-amd64' => 'volt-test-linux-amd64',
Expand Down Expand Up @@ -133,8 +133,6 @@ public static function installBinary($testing = false): void

$fp = fopen($tempFile, 'w');
if ($fp === false) {
curl_close($ch);

throw new \RuntimeException("Failed to open temporary file for writing");
}

Expand All @@ -157,7 +155,8 @@ public static function installBinary($testing = false): void
throw new \RuntimeException("HTTP request failed with status $httpCode");
}

curl_close($ch);
// curl_close() is a no-op since PHP 8.0 and deprecated in 8.5; the
// handle is released when $ch goes out of scope.
fclose($fp);

if (! file_exists($tempFile) || filesize($tempFile) === 0) {
Expand Down
4 changes: 0 additions & 4 deletions tests/Units/PlatformTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@ private function cleanupTestEnvironment()
// Use the actual Platform logic to get vendor directories
$reflection = new \ReflectionClass(Platform::class);
$getVendorDirMethod = $reflection->getMethod('getVendorDir');
$getVendorDirMethod->setAccessible(true);

$platform = new Platform();
$vendorDir = $getVendorDirMethod->invoke($platform);
Expand Down Expand Up @@ -41,7 +40,6 @@ public function testDetectPlatform()
{
$reflection = new \ReflectionClass(Platform::class);
$method = $reflection->getMethod('detectPlatform');
$method->setAccessible(true);

$platform = new Platform();
$result = $method->invoke($platform);
Expand Down Expand Up @@ -88,7 +86,6 @@ public function testInstallBinary()
// Get vendor directory
$reflection = new \ReflectionClass(Platform::class);
$getVendorDirMethod = $reflection->getMethod('getVendorDir');
$getVendorDirMethod->setAccessible(true);

$platform = new Platform();
$vendorDir = $getVendorDirMethod->invoke($platform);
Expand Down Expand Up @@ -130,7 +127,6 @@ public function testVendorDirectoryLocation()
{
$reflection = new \ReflectionClass(Platform::class);
$vendorMethod = $reflection->getMethod('getVendorDir');
$vendorMethod->setAccessible(true);

$platform = new Platform();
$vendorDir = $vendorMethod->invoke($platform);
Expand Down
2 changes: 0 additions & 2 deletions tests/Units/VoltTestCloudTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -591,15 +591,13 @@ private function setPrivateProperty(object $object, string $propertyName, mixed
{
$reflection = new \ReflectionClass(get_class($object));
$property = $reflection->getProperty($propertyName);
$property->setAccessible(true);
$property->setValue($object, $value);
}

private function getPrivateProperty(object $object, string $propertyName): mixed
{
$reflection = new \ReflectionClass(get_class($object));
$property = $reflection->getProperty($propertyName);
$property->setAccessible(true);

return $property->getValue($object);
}
Expand Down
1 change: 0 additions & 1 deletion tests/Units/VoltTestStagesTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -286,7 +286,6 @@ private function getPrivateProperty(object $object, string $propertyName): mixed
{
$reflection = new \ReflectionClass(get_class($object));
$property = $reflection->getProperty($propertyName);
$property->setAccessible(true);

return $property->getValue($object);
}
Expand Down
2 changes: 0 additions & 2 deletions tests/Units/VoltTestTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -181,15 +181,13 @@ private function setPrivateProperty($object, string $propertyName, $value): void
{
$reflection = new \ReflectionClass(get_class($object));
$property = $reflection->getProperty($propertyName);
$property->setAccessible(true);
$property->setValue($object, $value);
}

private function getPrivateProperty($object, string $propertyName)
{
$reflection = new \ReflectionClass(get_class($object));
$property = $reflection->getProperty($propertyName);
$property->setAccessible(true);

return $property->getValue($object);
}
Expand Down
Loading