diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 42a6558..4e3afb2 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -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' @@ -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 diff --git a/README.md b/README.md index 9859219..ccf7aad 100644 --- a/README.md +++ b/README.md @@ -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 @@ -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 diff --git a/composer.json b/composer.json index b947f28..0fa2d53 100644 --- a/composer.json +++ b/composer.json @@ -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", @@ -24,7 +24,7 @@ } ], "require": { - "php": "^8.0", + "php": "^8.2", "ext-json": "*", "ext-curl": "*", "ext-pcntl": "*" diff --git a/src/Exceptions/ErrorHandler.php b/src/Exceptions/ErrorHandler.php index 29b0beb..302acc4 100644 --- a/src/Exceptions/ErrorHandler.php +++ b/src/Exceptions/ErrorHandler.php @@ -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, diff --git a/src/Platform.php b/src/Platform.php index 6e00dd9..621e3a1 100644 --- a/src/Platform.php +++ b/src/Platform.php @@ -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', @@ -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"); } @@ -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) { diff --git a/tests/Units/PlatformTest.php b/tests/Units/PlatformTest.php index 07b5558..e7a7bcb 100644 --- a/tests/Units/PlatformTest.php +++ b/tests/Units/PlatformTest.php @@ -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); @@ -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); @@ -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); @@ -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); diff --git a/tests/Units/VoltTestCloudTest.php b/tests/Units/VoltTestCloudTest.php index a1b508a..62caab1 100644 --- a/tests/Units/VoltTestCloudTest.php +++ b/tests/Units/VoltTestCloudTest.php @@ -591,7 +591,6 @@ 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); } @@ -599,7 +598,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); } diff --git a/tests/Units/VoltTestStagesTest.php b/tests/Units/VoltTestStagesTest.php index 0d82adf..41e5433 100644 --- a/tests/Units/VoltTestStagesTest.php +++ b/tests/Units/VoltTestStagesTest.php @@ -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); } diff --git a/tests/Units/VoltTestTest.php b/tests/Units/VoltTestTest.php index 90c609e..cb9a1b9 100644 --- a/tests/Units/VoltTestTest.php +++ b/tests/Units/VoltTestTest.php @@ -181,7 +181,6 @@ 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); } @@ -189,7 +188,6 @@ private function getPrivateProperty($object, string $propertyName) { $reflection = new \ReflectionClass(get_class($object)); $property = $reflection->getProperty($propertyName); - $property->setAccessible(true); return $property->getValue($object); }