From ffee3709e8a7abb05cd02fa4116e62f9f2ebdf1a Mon Sep 17 00:00:00 2001 From: Sergey Avseyev Date: Fri, 22 Nov 2024 09:07:51 -0800 Subject: [PATCH] Update PHP versions on CI --- .github/workflows/tests.yml | 101 +++++++++++++++++++---- .github/workflows/versions.yml | 2 +- Couchbase/Collection.php | 3 +- Couchbase/ExtensionNamespaceResolver.php | 10 ++- bin/build.rb | 46 +++++------ src/CMakeLists.txt | 29 ++++--- tests/ABITest.php | 9 +- 7 files changed, 139 insertions(+), 61 deletions(-) diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index b10ef5e3..0410bef4 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -6,11 +6,16 @@ on: pull_request: branches: [main] +concurrency: + group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }} + cancel-in-progress: true + jobs: source: runs-on: ubuntu-22.04 outputs: extension_version: ${{ steps.build_extension.outputs.extension_version }} + abi_version: ${{ steps.build_extension.outputs.abi_version }} steps: - uses: actions/checkout@v4 with: @@ -28,6 +33,8 @@ jobs: export COMMITS_SINCE_LAST_TAG=$(git describe --tags --always --long | awk -F '-' '{print $2}') EXTENSION_VERSION=$(ruby -e 'print [ARGF.read[/PHP_COUCHBASE_VERSION "(\d+\.\d+\.\d+)"/, 1], ENV["COMMITS_SINCE_LAST_TAG"].to_i > 0 ? ENV["COMMITS_SINCE_LAST_TAG"] : nil].compact.join(".")' src/php_couchbase.hxx) echo "extension_version=${EXTENSION_VERSION}" >> "$GITHUB_OUTPUT" + ABI_VERSION=$(ruby -e 'print ARGF.read[/PHP_COUCHBASE_VERSION "(\d+\.\d+\.\d+)"/, 1].gsub(".", "_")' src/php_couchbase.hxx) + echo "abi_version=${ABI_VERSION}" >> "$GITHUB_OUTPUT" export BUILD_NUMBER="${COMMITS_SINCE_LAST_TAG}" ruby ./bin/package.rb - name: PHPDoc @@ -71,6 +78,9 @@ jobs: - '81' - '82' - '83' + abi: + - default + - locked steps: - name: Install build environment run: | @@ -110,6 +120,10 @@ jobs: - name: Build run: | pecl${{ matrix.php }} bundle couchbase-${{ needs.source.outputs.extension_version }}.tgz + if [ "${{ matrix.abi }}" = "locked" ] + then + export CB_ABI_VERSION=${{ needs.source.outputs.abi_version }} + fi ( cd couchbase phpize${{ matrix.php }} @@ -120,15 +134,19 @@ jobs: PHP_VERSION_SHORT=${{ matrix.php }} PHP_VERSION="${PHP_VERSION_SHORT:0:1}.${PHP_VERSION_SHORT:1}" echo "PHP_VERSION=$PHP_VERSION" >> $GITHUB_ENV - DIST_NAME=couchbase-${{ needs.source.outputs.extension_version }}-php${PHP_VERSION}-nts-linux-musl-x86_64 + DIST_NAME=couchbase-${{ needs.source.outputs.extension_version }}-php${PHP_VERSION}-nts-linux-musl-x86_64${{ matrix.abi == 'locked' && '-abi' || '' }} mkdir ${DIST_NAME} cp -av couchbase/LICENSE 90-couchbase.ini couchbase/Couchbase couchbase/GPBMetadata ${DIST_NAME}/ find couchbase/target -name couchbase.so -exec cp -v {} ${DIST_NAME}/ \; strip --strip-all ${DIST_NAME}/couchbase.so + if [ "${{ matrix.abi }}" = "locked" ] + then + mv ${DIST_NAME}/couchbase.so ${DIST_NAME}/couchbase_${CB_ABI_VERSION}.so + fi tar cv ${DIST_NAME}/ | gzip -9 > ${DIST_NAME}.tgz - uses: actions/upload-artifact@v4 with: - name: couchbase-${{ needs.source.outputs.extension_version }}-php${{ matrix.php }}-nts-linux-musl-x86_64 + name: couchbase-${{ needs.source.outputs.extension_version }}-php${{ matrix.php }}-nts-linux-musl-x86_64${{ matrix.abi == 'locked' && '-abi' || '' }} path: | couchbase-*-linux-musl-x86_64.tgz @@ -210,9 +228,13 @@ jobs: - '8.1' - '8.2' - '8.3' + - '8.4' ts: - nts - zts + abi: + - default + - locked steps: - name: Setup PHP uses: shivammathur/setup-php@v2 @@ -234,6 +256,10 @@ jobs: - name: Build run: | pecl bundle couchbase-${{ needs.source.outputs.extension_version }}.tgz + if [ "${{ matrix.abi }}" = "locked" ] + then + export CB_ABI_VERSION=${{ needs.source.outputs.abi_version }} + fi ( cd couchbase phpize @@ -241,17 +267,21 @@ jobs: mkdir target make INSTALL_ROOT="$(realpath target)" install ) - DIST_NAME=couchbase-${{ needs.source.outputs.extension_version }}-php${{ matrix.php }}-${{ matrix.ts }}-linux-x86_64 + DIST_NAME=couchbase-${{ needs.source.outputs.extension_version }}-php${{ matrix.php }}-${{ matrix.ts }}-linux-x86_64${{ matrix.abi == 'locked' && '-abi' || '' }} mkdir ${DIST_NAME} cp -av couchbase/LICENSE 90-couchbase.ini couchbase/Couchbase couchbase/GPBMetadata ${DIST_NAME}/ find couchbase/target -name couchbase.so -exec cp -v {} ${DIST_NAME}/ \; strip --strip-all ${DIST_NAME}/couchbase.so + if [ "${{ matrix.abi }}" = "locked" ] + then + mv ${DIST_NAME}/couchbase.so ${DIST_NAME}/couchbase_${CB_ABI_VERSION}.so + fi tar cv ${DIST_NAME}/ | gzip -9 > ${DIST_NAME}.tgz - uses: actions/upload-artifact@v4 with: - name: couchbase-${{ needs.source.outputs.extension_version }}-php${{ matrix.php }}-${{ matrix.ts }}-linux-x86_64 + name: couchbase-${{ needs.source.outputs.extension_version }}-php${{ matrix.php }}-${{ matrix.ts }}-linux-x86_64${{ matrix.abi == 'locked' && '-abi' || '' }} path: | - couchbase-*-linux-x86_64.tgz + couchbase-*-linux-x86_64*.tgz mock_linux_x86_64: needs: @@ -265,6 +295,7 @@ jobs: - '8.1' - '8.2' - '8.3' + - '8.4' ts: - nts - zts @@ -421,9 +452,13 @@ jobs: - '8.1' - '8.2' - '8.3' + - '8.4' ts: - nts - zts + abi: + - default + - locked steps: - name: Setup PHP uses: shivammathur/setup-php@v2 @@ -446,6 +481,10 @@ jobs: - name: Build run: | pecl bundle couchbase-${{ needs.source.outputs.extension_version }}.tgz + if [ "${{ matrix.abi }}" = "locked" ] + then + export CB_ABI_VERSION=${{ needs.source.outputs.abi_version }} + fi ( cd couchbase phpize @@ -453,17 +492,21 @@ jobs: mkdir target make INSTALL_ROOT="$(realpath target)" install ) - DIST_NAME=couchbase-${{ needs.source.outputs.extension_version }}-php${{ matrix.php }}-${{ matrix.ts }}-macos-x86_64 + DIST_NAME=couchbase-${{ needs.source.outputs.extension_version }}-php${{ matrix.php }}-${{ matrix.ts }}-macos-x86_64${{ matrix.abi == 'locked' && '-abi' || '' }} mkdir ${DIST_NAME} cp -av couchbase/LICENSE 90-couchbase.ini couchbase/Couchbase couchbase/GPBMetadata ${DIST_NAME}/ find couchbase/target -name couchbase.so -exec cp -v {} ${DIST_NAME}/ \; strip ${DIST_NAME}/couchbase.so 2>/dev/null || true + if [ "${{ matrix.abi }}" = "locked" ] + then + mv ${DIST_NAME}/couchbase.so ${DIST_NAME}/couchbase_${CB_ABI_VERSION}.so + fi tar cv ${DIST_NAME}/ | gzip -9 > ${DIST_NAME}.tgz - uses: actions/upload-artifact@v4 with: - name: couchbase-${{ needs.source.outputs.extension_version }}-php${{ matrix.php }}-${{ matrix.ts }}-macos-x86_64 + name: couchbase-${{ needs.source.outputs.extension_version }}-php${{ matrix.php }}-${{ matrix.ts }}-macos-x86_64${{ matrix.abi == 'locked' && '-abi' || '' }} path: | - couchbase-*-macos-x86_64.tgz + couchbase-*-macos-x86_64*.tgz mock_macos_x86_64: needs: @@ -477,6 +520,7 @@ jobs: - '8.1' - '8.2' - '8.3' + - '8.4' ts: - nts - zts @@ -525,6 +569,7 @@ jobs: - '8.1' - '8.2' - '8.3' + - '8.4' ts: - nts - zts @@ -549,6 +594,10 @@ jobs: key: ${{ github.job }}-${{ matrix.php }}-${{ matrix.ts }} - name: Build run: | + if [ "${{ matrix.abi }}" = "locked" ] + then + export CB_ABI_VERSION=${{ needs.source.outputs.abi_version }} + fi pecl bundle couchbase-${{ needs.source.outputs.extension_version }}.tgz ( cd couchbase @@ -557,15 +606,19 @@ jobs: mkdir target make INSTALL_ROOT="$(realpath target)" install ) - DIST_NAME=couchbase-${{ needs.source.outputs.extension_version }}-php${{ matrix.php }}-${{ matrix.ts }}-macos-arm64 + DIST_NAME=couchbase-${{ needs.source.outputs.extension_version }}-php${{ matrix.php }}-${{ matrix.ts }}-macos-arm64${{ matrix.abi == 'locked' && '-abi' || '' }} mkdir ${DIST_NAME} cp -av couchbase/LICENSE 90-couchbase.ini couchbase/Couchbase couchbase/GPBMetadata ${DIST_NAME}/ find couchbase/target -name couchbase.so -exec cp -v {} ${DIST_NAME}/ \; strip ${DIST_NAME}/couchbase.so 2>/dev/null || true + if [ "${{ matrix.abi }}" = "locked" ] + then + mv ${DIST_NAME}/couchbase.so ${DIST_NAME}/couchbase_${CB_ABI_VERSION}.so + fi tar cv ${DIST_NAME}/ | gzip -9 > ${DIST_NAME}.tgz - uses: actions/upload-artifact@v4 with: - name: couchbase-${{ needs.source.outputs.extension_version }}-php${{ matrix.php }}-${{ matrix.ts }}-macos-arm64 + name: couchbase-${{ needs.source.outputs.extension_version }}-php${{ matrix.php }}-${{ matrix.ts }}-macos-arm64${{ matrix.abi == 'locked' && '-abi' || '' }} path: | couchbase-*-macos-arm64.tgz @@ -581,6 +634,7 @@ jobs: - '8.1' - '8.2' - '8.3' + - '8.4' ts: - nts - zts @@ -626,15 +680,19 @@ jobs: fail-fast: false matrix: php: - - '8.3.4' - - '8.2.17' - - '8.1.27' + - '8.4.1' + - '8.3.14' + - '8.2.26' + - '8.1.31' ts: - nts - zts arch: - x64 - x86 + abi: + - default + - locked steps: - name: Install dependencies shell: cmd @@ -659,10 +717,21 @@ jobs: run: | 7z x couchbase-${{ needs.source.outputs.extension_version }}.tgz -so | 7z x -aoa -si -ttar cd c:\php\php-src - echo call buildconf.bat --add-modules-dir=c:\php > task.bat + if "${{ matrix.abi }}"=="locked" ( + echo set CB_ABI_VERSION=${{ needs.source.outputs.abi_version }} >> task.bat + ) + echo call buildconf.bat --add-modules-dir=c:\php >> task.bat echo call configure.bat --disable-all --enable-cli ${{ matrix.ts == 'nts' && '--disable-zts' || '' }} --enable-couchbase >> task.bat echo nmake >> task.bat call c:\php\php-sdk\phpsdk-vs16-${{ matrix.arch }}.bat -t task.bat + if "${{ matrix.abi }}"=="locked" ( + cd "C:\php\php-src\${{ matrix.arch == 'x64' && 'x64\\' || '' }}Release${{ matrix.ts == 'zts' && '_TS' || '' }}" + for %%f in (php_couchbase*) do ( + set filename=%%~nxf + set newname=%%~dpnf_${{ needs.source.outputs.abi_version }}%%~xf + move "%%f" "!newname!" + ) + ) exit /b %ERRORLEVEL% - name: Package id: package @@ -671,14 +740,14 @@ jobs: $PhpVersion = ("${{ matrix.php }}" -split '\.')[0..1] -join '.' Add-Content -Path $env:GITHUB_OUTPUT -Value "php_version=$PhpVersion" $SourceDirectory = (Get-ChildItem -Path "c:\php" -Directory "couchbase-*" | Select-Object -First 1).FullName - $DistName = "couchbase-${{ needs.source.outputs.extension_version }}-php${PhpVersion}-${{ matrix.ts }}-windows-${{ matrix.arch }}" + $DistName = "couchbase-${{ needs.source.outputs.extension_version }}-php${PhpVersion}-${{ matrix.ts }}-windows-${{ matrix.arch }}${{ matrix.abi == 'locked' && '-abi' || '' }}" New-Item -ItemType Directory -Path $DistName | Out-Null $FilesToCopy = Get-ChildItem -Path . -Filter "couchbase-*" -Include LICENSE,"Couchbase","GPBMetadata" Copy-Item -Path 90-couchbase.ini -Destination $DistName -Force Copy-Item -Path "${SourceDirectory}\LICENSE" -Destination $DistName -Force Copy-Item -Path "${SourceDirectory}\Couchbase" -Destination $DistName -Force -Recurse Copy-Item -Path "${SourceDirectory}\GPBMetadata" -Destination $DistName -Force -Recurse - $FilesToCopy = Get-ChildItem -Path "C:\php\php-src\${{ matrix.arch == 'x64' && 'x64\\' || '' }}Release${{ matrix.ts == 'zts' && '_TS' || '' }}" -Filter "php_couchbase.*" + $FilesToCopy = Get-ChildItem -Path "C:\php\php-src\${{ matrix.arch == 'x64' && 'x64\\' || '' }}Release${{ matrix.ts == 'zts' && '_TS' || '' }}" -Filter "php_couchbase*" foreach ($File in $FilesToCopy) { Write-Host "Copying file: $($File.FullName)" Copy-Item -Path $File.FullName -Destination $DistName -Force diff --git a/.github/workflows/versions.yml b/.github/workflows/versions.yml index 5ac0c03e..b5b7773a 100644 --- a/.github/workflows/versions.yml +++ b/.github/workflows/versions.yml @@ -419,7 +419,7 @@ jobs: Expand-Archive -Path couchbase-${{ needs.source_abi.outputs.alternate_abi_version }}-windows-x64.zip $env:TEST_ABI='both'; ruby ./bin/test.rb -v ${{ needs.source_abi.outputs.abi_version }} -v ${{ needs.source_abi.outputs.alternate_abi_version }} -v unversioned $env:TEST_ABI='versioned'; ruby ./bin/test.rb -v ${{ needs.source_abi.outputs.abi_version }} - + ruby -e ' file_paths = [ "couchbase-unversioned-windows-x64/couchbase-unversioned-windows-x64/Couchbase/ExtensionNamespaceResolver.php", diff --git a/Couchbase/Collection.php b/Couchbase/Collection.php index 9a7989d2..a5560ecf 100644 --- a/Couchbase/Collection.php +++ b/Couchbase/Collection.php @@ -116,7 +116,8 @@ public function name(): string public function get(string $id, ?GetOptions $options = null): GetResult { $function = COUCHBASE_EXTENSION_NAMESPACE . "\\documentGet"; - $response = $function($this->core, + $response = $function( + $this->core, $this->bucketName, $this->scopeName, $this->name, diff --git a/Couchbase/ExtensionNamespaceResolver.php b/Couchbase/ExtensionNamespaceResolver.php index 5f09a07a..4490250c 100644 --- a/Couchbase/ExtensionNamespaceResolver.php +++ b/Couchbase/ExtensionNamespaceResolver.php @@ -26,7 +26,8 @@ class ExtensionNamespaceResolver { const COUCHBASE_EXTENSION_VERSION = "4_2_4"; - public static function defineExtensionNamespace() { + public static function defineExtensionNamespace() + { if (defined('COUCHBASE_EXTENSION_NAMESPACE')) { return; } @@ -34,7 +35,8 @@ public static function defineExtensionNamespace() { define('COUCHBASE_EXTENSION_NAMESPACE', $namespace); } - private static function aliasExtensionNamespace() { + private static function aliasExtensionNamespace() + { if (extension_loaded('couchbase')) { return "Couchbase\\Extension"; } elseif (extension_loaded('couchbase_' . self::COUCHBASE_EXTENSION_VERSION)) { @@ -42,7 +44,9 @@ private static function aliasExtensionNamespace() { $func(); return "Couchbase\\Extension_" . self::COUCHBASE_EXTENSION_VERSION; } else { - throw new CouchbaseException("Neither Couchbase extension nor valid versioned Couchbase extension is loaded."); + throw new CouchbaseException( + sprintf("Could not load Couchbase extension (tried \"couchbase\" and \"couchbase_%d\")", self::COUCHBASE_EXTENSION_VERSION) + ); } } } diff --git a/bin/build.rb b/bin/build.rb index eed20019..6de6770b 100755 --- a/bin/build.rb +++ b/bin/build.rb @@ -1,4 +1,5 @@ #!/usr/bin/env ruby +# frozen_string_literal: true # Copyright 2020-Present Couchbase, Inc. # @@ -19,7 +20,7 @@ def echo_env(*var_names) var_names.each do |name| - value = ENV[name] + value = ENV.fetch(name, nil) puts "#{name}=#{value}" if value && !value.empty? end end @@ -36,10 +37,10 @@ def which(name) def run(*args) args = args.compact.map(&:to_s) puts args.join(" ") - system(*args) || abort("command returned non-zero status: #{args.join(" ")}") + system(*args) || abort("command returned non-zero status: #{args.join(' ')}") end -PROJECT_ROOT = File.realpath(File.join(__dir__, '..')) +PROJECT_ROOT = File.realpath(File.join(__dir__, "..")) DEFAULT_PHP_PREFIX = case RbConfig::CONFIG["target_os"] @@ -49,8 +50,8 @@ def run(*args) "/usr" end -default_cc="cc" -default_cxx="c++" +default_cc = "cc" +default_cxx = "c++" case RbConfig::CONFIG["target_os"] when /darwin/ default_cc = "/usr/bin/gcc" @@ -72,11 +73,9 @@ def run(*args) run("#{CB_PHP_PREFIX}/bin/php --ini || true") run("#{CB_PHP_PREFIX}/bin/php-config || true") -LOCAL_OPENSSL="/usr/local/openssl" +LOCAL_OPENSSL = "/usr/local/openssl" CB_OPENSSL_ROOT = ENV.fetch("CB_OPENSSL_ROOT", File.directory?(LOCAL_OPENSSL) ? LOCAL_OPENSSL : nil) -if CB_OPENSSL_ROOT - ENV["COUCHBASE_CMAKE_EXTRA"] = "-DOPENSSL_ROOT_DIR=#{CB_OPENSSL_ROOT}" -end +ENV["COUCHBASE_CMAKE_EXTRA"] = "-DOPENSSL_ROOT_DIR=#{CB_OPENSSL_ROOT}" if CB_OPENSSL_ROOT Dir.chdir(PROJECT_ROOT) do run("#{CB_PHP_PREFIX}/bin/phpize") @@ -88,32 +87,29 @@ def run(*args) run("make V=1") end -COUCHBASE_EXT = "#{PROJECT_ROOT}/modules/couchbase.#{RbConfig::CONFIG["SOEXT"]}" +COUCHBASE_EXT = "#{PROJECT_ROOT}/modules/couchbase.#{RbConfig::CONFIG['SOEXT']}".freeze unless File.exist?(COUCHBASE_EXT) alt_filename = "#{PROJECT_ROOT}/modules/couchbase.so" - if File.exist?(alt_filename) - COUCHBASE_EXT = alt_filename - end + COUCHBASE_EXT = alt_filename if File.exist?(alt_filename) end run("#{CB_PHP_PREFIX}/bin/php -d extension=#{COUCHBASE_EXT} -m | grep couchbase") run("#{CB_PHP_PREFIX}/bin/php -d extension=#{COUCHBASE_EXT} -i | grep couchbase") -File.write("#{PROJECT_ROOT}/build/try_to_load.php", <getFileName()); + require_once 'Couchbase/autoload.php'; + var_dump((new ReflectionClass('\\\\Couchbase\\\\Cluster'))->getFileName()); EOF run("#{CB_PHP_PREFIX}/bin/php -d extension=#{COUCHBASE_EXT} #{PROJECT_ROOT}/build/try_to_load.php") diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index 8d7431b7..9c50e764 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -12,7 +12,11 @@ set(CMAKE_C_STANDARD 99) include(${PROJECT_SOURCE_DIR}/cmake/pecl_package.cmake OPTIONAL) file(READ "${PROJECT_SOURCE_DIR}/php_couchbase.hxx" FILE_CONTENT) -string(REGEX MATCH "PHP_COUCHBASE_VERSION +\"([0-9]+\\.[0-9]+\\.[0-9]+)\"" EXT_VERSION ${FILE_CONTENT}) +string( + REGEX MATCH + "PHP_COUCHBASE_VERSION +\"([0-9]+\\.[0-9]+\\.[0-9]+)\"" + EXT_VERSION + ${FILE_CONTENT}) set(COUCHBASE_CXX_CLIENT_WRAPPER_UNIFIED_ID "php/${CMAKE_MATCH_1}" @@ -38,7 +42,9 @@ set(COUCHBASE_CXX_CLIENT_BUILD_SHARED set(COUCHBASE_CXX_CLIENT_STATIC_BORINGSSL ON CACHE BOOL "" FORCE) -set(COUCHBASE_CXX_CLIENT_INSTALL OFF CACHE BOOL "" FORCE) +set(COUCHBASE_CXX_CLIENT_INSTALL + OFF + CACHE BOOL "" FORCE) set(CMAKE_POSITION_INDEPENDENT_CODE ON) add_subdirectory(deps/couchbase-cxx-client) @@ -93,13 +99,14 @@ endif() if(MSVC) set_target_properties(couchbase PROPERTIES PREFIX "php_" IMPORT_PREFIX "php_") endif() -target_include_directories(couchbase SYSTEM PRIVATE - ${PHP_INCLUDE_DIRS} - ${PROJECT_BINARY_DIR}/generated - ${PROJECT_BINARY_DIR}/deps/couchbase-cxx-client/generated - ${PROJECT_SOURCE_DIR}/deps/couchbase-cxx-client - ${PROJECT_SOURCE_DIR}/deps/couchbase-cxx-client/third_party/cxx_function - ${PROJECT_SOURCE_DIR}/deps/couchbase-cxx-client/third_party/expected/include) +target_include_directories( + couchbase SYSTEM + PRIVATE ${PHP_INCLUDE_DIRS} + ${PROJECT_BINARY_DIR}/generated + ${PROJECT_BINARY_DIR}/deps/couchbase-cxx-client/generated + ${PROJECT_SOURCE_DIR}/deps/couchbase-cxx-client + ${PROJECT_SOURCE_DIR}/deps/couchbase-cxx-client/third_party/cxx_function + ${PROJECT_SOURCE_DIR}/deps/couchbase-cxx-client/third_party/expected/include) target_compile_definitions(couchbase PRIVATE ZEND_COMPILE_DL_EXT=1) set_target_properties(couchbase_cxx_client_static PROPERTIES C_VISIBILITY_PRESET hidden CXX_VISIBILITY_PRESET hidden) target_link_libraries( @@ -113,8 +120,8 @@ target_link_libraries( asio Microsoft.GSL::GSL) -message ("COUCHBASE_ABI_VERSION=${COUCHBASE_ABI_VERSION}") -if( COUCHBASE_ABI_VERSION ) +message("COUCHBASE_ABI_VERSION=${COUCHBASE_ABI_VERSION}") +if(COUCHBASE_ABI_VERSION) target_compile_definitions(couchbase PRIVATE COUCHBASE_ABI_VERSION=${COUCHBASE_ABI_VERSION}) endif() diff --git a/tests/ABITest.php b/tests/ABITest.php index 4d4effcf..e491097f 100644 --- a/tests/ABITest.php +++ b/tests/ABITest.php @@ -30,7 +30,8 @@ public function setUp(): void parent::setUp(); } - public function testExtensionsLoadedPermutation() { + public function testExtensionsLoadedPermutation() + { $abi = getenv('TEST_ABI'); $unversionedFunc = 'Couchbase\\Extension\\version'; $versionedFunc = 'Couchbase\\Extension_' . ExtensionNamespaceResolver::COUCHBASE_EXTENSION_VERSION . '\\version'; @@ -38,10 +39,10 @@ public function testExtensionsLoadedPermutation() { print_r($unversionedFunc()); print_r($versionedFunc()); $this->assertTrue(true); - } else if ($abi == "versioned") { + } elseif ($abi == "versioned") { print_r($versionedFunc()); $this->assertTrue(true); - } else if ($abi == "unversioned") { + } elseif ($abi == "unversioned") { print_r($unversionedFunc()); $this->assertTrue(true); } @@ -54,7 +55,7 @@ public function testNamespaceResolver() if ($abi == "both" || $abi == "unversioned") { $this->assertEquals("Couchbase\\Extension", COUCHBASE_EXTENSION_NAMESPACE); - } else if ($abi == "versioned") { + } elseif ($abi == "versioned") { $this->assertEquals("Couchbase\\Extension_" . ExtensionNamespaceResolver::COUCHBASE_EXTENSION_VERSION, COUCHBASE_EXTENSION_NAMESPACE); } }