I'm still trying to teach myself Travis / CI so apologies if the answer is obvious.
I'm trying to determine why my Travis build for a project I've inherited is failing for PHP 7.1 but not 7.2.
Here is the .travis.yml config:
sudo: false
language: php
# Cache some data across builds for performance.
cache:
apt: true
directories:
- node_modules
- vendor
- $HOME/.composer/cache
notifications:
email:
on_success: never
on_failure: change
branches:
only:
- master
matrix:
include:
- php: 7.2
env: WP_Version=nightly
- php: 7.1
env: WP_VERSION=latest WP_TRAVISCI=phpcs
before_script:
- export PATH="$HOME/.composer/vendor/bin:$PATH"
- phpenv config-rm xdebug.ini
- |
if [[ ! -z "$WP_VERSION" ]] ; then
bash bin/install-wp-tests.sh wordpress_test root '' localhost $WP_VERSION
composer global require "phpunit/phpunit=5.7.*"
fi
- |
if [[ "$WP_TRAVISCI" == "phpcs" ]] ; then
composer global require wp-coding-standards/wpcs
phpcs --config-set installed_paths $HOME/.composer/vendor/wp-coding-standards/wpcs
fi
- mysql --version
- phpenv versions
- php --version
script:
- |
if [[ ! -z "$WP_VERSION" ]] ; then
phpunit --version
phpunit
WP_MULTISITE=1 phpunit
fi
- |
if [[ "$WP_TRAVISCI" == "phpcs" ]] ; then
phpcs --standard=phpcs.ruleset.xml $(find . -name '*.php')
fi
# If the plugin has any JavaScript or CSS that should be processed,
# add the below to their respective sections so that Grunt is installed
# and all default tasks are run.
#
# To the matrix:
#
# - php: 7.0
# env: WP_TRAVISCI=grunt
#
# To before_script:
#
# - npm --version
# - node --version
# - nvm install stable
# - npm install -g grunt-cli
# - npm install
# - npm prune
# - npm --version
# - node --version
#
# To script:
#
# - |
# if [[ "$WP_TRAVISCI" == "grunt" ]] ; then
# grunt --version
# grunt default
# fi
Here is the Travis log:
Setting environment variables from .travis.yml
$ export WP_VERSION=latest
$ export WP_TRAVISCI=phpcs
0.02s$ phpenv global 7.1 2>/dev/null
pearrc
Writing /home/travis/.pearrc
0.01s$ phpenv global 7.1
0.87s$ composer self-update
Updating to version 1.9.1 (stable channel).
Downloading (100%)
Use composer self-update --rollback to return to version 1.8.4
cache.1
Setting up build cache
$ php --version
PHP 7.1.27 (cli) (built: Mar 13 2019 07:54:47) ( ZTS )
Copyright (c) 1997-2018 The PHP Group
Zend Engine v3.1.0, Copyright (c) 1998-2018 Zend Technologies
with Zend OPcache v7.1.27, Copyright (c) 1999-2018, by Zend Technologies
with Xdebug v2.7.0, Copyright (c) 2002-2019, by Derick Rethans
$ composer --version
Composer version 1.9.1 2019-11-01 17:20:17
before_script.1
0.00s$ export PATH="$HOME/.composer/vendor/bin:$PATH"
before_script.2
0.02s$ phpenv config-rm xdebug.ini
before_script.3
14.36s$ if [[ ! -z "$WP_VERSION" ]] ; then
before_script.4
2.96s$ if [[ "$WP_TRAVISCI" == "phpcs" ]] ; then
before_script.5
0.02s$ mysql --version
before_script.6
0.05s$ phpenv versions
before_script.7
0.06s$ php --version
0.28s$ if [[ ! -z "$WP_VERSION" ]] ; then
phpunit --version
phpunit
WP_MULTISITE=1 phpunit
fi
PHPUnit 5.7.27 by Sebastian Bergmann and contributors.
PHP Warning: mysqli_real_connect(): (HY000/2002): No such file or directory in /tmp/wordpress/wp-includes/wp-db.php on line 1633
wp_die called
Message : <p><code>No such file or directory</code></p>
<h1>Error establishing a database connection</h1>
<p>This either means that the username and password information in your <code>wp-config.php</code> file is incorrect or we can’t contact the database server at <code>localhost</code>. This could mean your host’s database server is down.</p>
<ul>
<li>Are you sure you have the correct username and password?</li>
<li>Are you sure you have typed the correct hostname?</li>
<li>Are you sure the database server is running?</li>
</ul>
<p>If you’re unsure what these terms mean you should probably contact your host. If you still need help you can always visit the WordPress Support Forums.</p>
Title :
PHP Warning: mysqli_real_connect(): (HY000/2002): No such file or directory in /tmp/wordpress/wp-includes/wp-db.php on line 1633
wp_die called
Message : <p><code>No such file or directory</code></p>
<h1>Error establishing a database connection</h1>
<p>This either means that the username and password information in your <code>wp-config.php</code> file is incorrect or we can’t contact the database server at <code>localhost</code>. This could mean your host’s database server is down.</p>
<ul>
<li>Are you sure you have the correct username and password?</li>
<li>Are you sure you have typed the correct hostname?</li>
<li>Are you sure the database server is running?</li>
</ul>
<p>If you’re unsure what these terms mean you should probably contact your host. If you still need help you can always visit the WordPress Support Forums.</p>
Title :
The command "if [[ ! -z "$WP_VERSION" ]] ; then
phpunit --version
phpunit
WP_MULTISITE=1 phpunit
fi
" exited with 1.
0.70s$ if [[ "$WP_TRAVISCI" == "phpcs" ]] ; then
phpcs --standard=phpcs.ruleset.xml $(find . -name '*.php')
fi
The command "if [[ "$WP_TRAVISCI" == "phpcs" ]] ; then
phpcs --standard=phpcs.ruleset.xml $(find . -name '*.php')
fi
" exited with 0.
cache.2
store build cache
Done. Your build exited with 1.
I can see the error message is related to the database, but I'm not sure where to look to debug it.
The PHP7.2 job passes.
Related
I have a wordpress docker-compose, which contains 3 services.
1 - php,apache
2 - mysql
3 - phpmyadmin
what I want to do is install wordpress core and plugins at build time,
and the reason is obvious I don't want everytime I restart my containers I goes to all steps all over again and install plugins and ... . so I need connection to database but It seems that build time I can't access my mysql container.
I read somewhere that I need to specify network on build stage but I couldn't make it work.
and here is my docker-compose file :
version: '3.8'
volumes:
mhndev_systems_mysql_data:
mhndev_systems_wp_uploads:
networks:
mhndev_network:
services:
## --------------------------------------------
## | 1: Wordpress
## --------------------------------------------
mhndev_systems_wp:
build:
context: .
dockerfile: docker/Dockerfile
args:
WP_VERSION: ${WP_VERSION}
MYSQL_HOST: ${MYSQL_HOST}
MYSQL_PORT: ${MYSQL_PORT}
MYSQL_DATABASE_NAME: ${MYSQL_DATABASE_NAME}
MYSQL_USERNAME: ${MYSQL_USERNAME}
MYSQL_PASSWORD: ${MYSQL_PASSWORD}
SITE_URL: ${SITE_URL}
DB_TABLE_PREFIX: ${DB_TABLE_PREFIX}
ENV: ${ENV}
UID: ${UID}
GID: ${GID}
SITE_TITLE: ${SITE_TITLE}
SITE_ADMIN_USERNAME: ${SITE_ADMIN_USERNAME}
SITE_ADMIN_PASSWORD: ${SITE_ADMIN_PASSWORD}
SITE_ADMIN_EMAIL: ${SITE_ADMIN_EMAIL}
network: "mhndev_network"
ports:
- 8191:80
env_file:
- .env
volumes:
- ./themes/dt-the7-child:/var/www/html/wp-content/themes/dt-the7-child
- ./plugins/teamcity:/var/www/html/wp-content/plugins/teamcity
- mhndev_systems_wp_uploads:/var/www/html/wp-content/uploads
depends_on:
- mhndev_systems_mysql
networks:
- mhndev_network
## --------------------------------------------
## | 2: Mysql
## --------------------------------------------
mhndev_systems_mysql:
image: mysql:5.7.21
environment:
MYSQL_ROOT_PASSWORD: ${MYSQL_ROOT_PASSWORD}
MYSQL_DATABASE: ${MYSQL_DATABASE_NAME}
MYSQL_USER: ${MYSQL_USERNAME}
MYSQL_PASSWORD: ${MYSQL_PASSWORD}
volumes:
- mhndev_systems_mysql_data:/var/lib/mysql
networks:
- mhndev_network
## --------------------------------------------
## | 3: PhpMyAdmin
## --------------------------------------------
mhndev_systems_phpmyadmin:
image: phpmyadmin/phpmyadmin:5.0.2
depends_on:
- mhndev_systems_mysql
ports:
- "7191:80"
environment:
PMA_HOST: mhndev_systems_mysql
networks:
- mhndev_network
here is my Dockerfile :
FROM php:7.4-apache
ARG WP_VERSION=5.5.1
RUN apt-get update && apt-get install -y \
sendmail \
libpng-dev \
libjpeg-dev \
libfreetype6-dev \
netcat \
gnupg \
libzip-dev \
zip \
&& docker-php-ext-configure gd --with-freetype --with-jpeg \
&& docker-php-ext-install gd pdo_mysql zip \
&& docker-php-ext-install mysqli && docker-php-ext-enable mysqli
ADD ./docker/apache.conf /etc/apache2/sites-enabled/000-default.conf
RUN \
printf "\nServerName localhost" >> /etc/apache2/apache2.conf &&\
a2enmod rewrite expires
### install wp cli
RUN curl -O https://raw.githubusercontent.com/wp-cli/builds/gh-pages/phar/wp-cli.phar &&\
chmod +x wp-cli.phar &&\
mv wp-cli.phar /usr/local/bin/wp
WORKDIR /var/www/html
RUN wp core download --allow-root
### copy plugins and themes and php config files to container
COPY ["./plugins/*.zip", "/docker/plugins/"]
COPY ["./themes/*.zip", "/docker/themes/"]
COPY ./themes/dt-the7-child /var/www/html/wp-content/themes/dt-the7-child
COPY ./plugins/teamcity /var/www/html/wp-content/plugins/teamcity
COPY ./docker/php.ini /usr/local/etc/php/php.ini
COPY ./docker/wp-config.php /var/www/html/wp-config.php
COPY ["./plugins/plugins_*.txt", "/docker/plugins/"]
COPY ["./uploads/", "/docker/uploads/"]
COPY ["./docker/commands/*.sh", "/docker/bin/"]
RUN chmod a+x /docker/bin/*.sh
RUN /bin/bash -c "source /docker/bin/setup-theme-plugins.sh"
RUN chown -R www-data:www-data /var/www/html/
CMD apachectl -D FOREGROUND
and here is a bash file (setup-theme-plugins.sh), which is responsible for installing wordpress core and plugins.
#!/bin/bash
echo '-------------------whoami--------------------'
echo $(whoami)
echo '---------------------------------------------'
printf "\033[0;32m > Waiting for mysql ...\x1b[0m \n"
until nc -z -v -w30 "$MYSQL_HOST" "$MYSQL_PORT"
do
echo "Waiting for database connection..."
# wait for 5 seconds before check again
sleep 1
done
printf "\033[0;32m >Mysql is ready ...\x1b[0m \n"
echo '---------------------------------------------'
printf "\033[0;32m > Copy wordpress uploads if not exists (usually first time ) \x1b[0m \n"
FILE=/var/www/html/wp-content/uploads/2020/01/dell.jpg
if [ -f "$FILE" ]; then
echo "$FILE exists, so no need to copy uploads"
else
echo "$FILE does not exist, copying ..."
cp -r /docker/uploads/* /var/www/html/wp-content/uploads
fi
echo '---------------------------------------------'
sed -i s/__DB_NAME__/"${MYSQL_DATABASE_NAME}"/g /var/www/html/wp-config.php
sed -i s/__DB_USER__/"${MYSQL_USERNAME}"/g /var/www/html/wp-config.php
sed -i s/__DB_PASSWORD__/"${MYSQL_PASSWORD}"/g /var/www/html/wp-config.php
sed -i s/__DB_HOST__/"${MYSQL_HOST}"/g /var/www/html/wp-config.php
sed -i s/__SITE_URL__/"${SITE_URL}"/g /var/www/html/wp-config.php
if [[ -n "${DB_TABLE_PREFIX}" ]]; then
sed -i s/__DB_TABLE_PREFIX__/"${DB_TABLE_PREFIX}"/g /var/www/html/wp-config.php
else
sed -i s/__DB_TABLE_PREFIX__/"${DB_TABLE_PREFIX}"/g /var/www/html/wp-config.php
fi
### set WP_DEBUG, SCRIPT_DEBUG based on DEV environment variable
if [ "${ENV}" = "dev" ]; then
sed -i s/__WP_DEBUG__/true/g /var/www/html/wp-config.php
sed -i s/__SCRIPT_DEBUG__/true/g /var/www/html/wp-config.php
else
sed -i s/__WP_DEBUG__/false/g /var/www/html/wp-config.php
sed -i s/__SCRIPT_DEBUG__/false/g /var/www/html/wp-config.php
fi
wp option update home "${SITE_URL}" --allow-root
wp option update siteurl "${SITE_URL}" --allow-root
### set WP_DEBUG_LOG to php://stdout to always output logs to stdout so be available for docker logs
old_string='__WP_DEBUG_LOG__'
new_string='php://stdout'
sed -i "s%$old_string%$new_string%g" /var/www/html/wp-config.php
if [[ -n "${SITE_ADMIN_USERNAME}" ]]; then
DASHBOARD_USER_NAME="${SITE_ADMIN_USERNAME}"
else
DASHBOARD_USER_NAME="admin"
fi
if [[ -n "${UID}" ]]; then
usermod -u "${UID}" www-data
groupmod -g "${GID}" www-data
fi
chown -R www-data:www-data /var/www/html/
### install wordpress
printf "\033[0;32m > Checking if wordpress core installed, if not Installing it ...\x1b[0m \n"
wp core is-installed --allow-root
retVal=$?
if [ "$retVal" == "1" ];then
printf "\033[0;32m > Trying to Install wordpress ...\x1b[0m \n"
printf "\033[0;32m > Command to execute is : wp core install --url="${SITE_URL}" --title="${SITE_TITLE}" --admin_user="${DASHBOARD_USER_NAME}" --admin_password="${SITE_ADMIN_PASSWORD}" --admin_email="${SITE_ADMIN_EMAIL}" --allow-root ...\x1b[0m \n"
wp core install --url="${SITE_URL}" --title="${SITE_TITLE}" --admin_user="${DASHBOARD_USER_NAME}" --admin_password="${SITE_ADMIN_PASSWORD}" --admin_email="${SITE_ADMIN_EMAIL}" --allow-root
fi
echo '---------------------------------------------'
### install The7 theme from zip file
# shellcheck disable=SC2059
printf "\033[0;32m > Checking if theme: $FILE installed, if not Installing it ...\x1b[0m \n"
wp theme is-installed The7 --allow-root
is_theme_installed=$?
if [[ is_theme_installed -eq 1 || ! -d /var/www/html/wp-content/themes/dt-the7 ]]; then
rm -rf /var/www/html/wp-content/themes/dt-the7
wp theme install /docker/themes/dt-the7.zip --force --allow-root;
fi
echo '---------------------------------------------'
### install plugins from plugins_dev.txt or plugins_prod.txt based on environment
# shellcheck disable=SC2162
while read line; do
IFS='=' read -r -a array <<< "$line"
printf "\033[0;32m > Checking if plugin:%s is installed else Installing %s:%s ...\x1b[0m \n" "${array[0]}" "${array[0]}" "${array[1]}"
# if wp plugin is-installed "${array[0]}" --allow-root; then
wp plugin install "${array[0]}" --version="${array[1]}" --activate --force --allow-root
# fi
echo '---------------------------------------------'
done < /docker/plugins/plugins_"${ENV}".txt
### install plugins from zip file
for FILE in /docker/plugins/*.zip;
do
# shellcheck disable=SC2059
printf "\033[0;32m > Installing plugin $FILE ...\x1b[0m \n"
wp plugin install "$FILE" --force --allow-root;
echo '---------------------------------------------'
done
printf "\033[0;32m > Checking if hello plugin exist and if so uninstall it ...\x1b[0m \n"
#if ! wp plugin is-installed hello --allow-root; then
wp plugin uninstall hello --allow-root
#fi
echo '---------------------------------------------'
printf "\033[0;32m > Checking if akismet plugin exist and if so uninstall it ...\x1b[0m \n"
#if ! wp plugin is-installed akismet --allow-root; then
wp plugin uninstall akismet --allow-root
#fi
echo '---------------------------------------------'
printf "\033[0;32m > activating the7 child theme ...\x1b[0m \n"
wp theme activate dt-the7-child --allow-root
echo '---------------------------------------------'
printf "\033[0;32m > Uninstalling initial themes ...\x1b[0m \n"
#if ! wp theme is-installed twentynineteen --allow-root; then
wp theme delete twentynineteen --allow-root
#fi
echo '---------------------------------------------'
#if ! wp theme is-installed twentyseventeen --allow-root; then
wp theme delete twentyseventeen --allow-root
#fi
echo '---------------------------------------------'
#if ! wp theme is-installed twentytwenty --allow-root; then
wp theme delete twentytwenty --allow-root
#fi
echo '---------------------------------------------'
As you can see in my bash file I'm connecting to mysql container.
How can I achieve this ?
There is a simple misunderstanding between build time and runtime; all the containers will be available in runtime, not build time. So there is no way to access your MySQL container, in build time.
My suggestion is that to remove all the steps which needs MySQL from your Dockerfile and move them to your entrypoint, then set a boolean ENV in your Dockerfile and check that value at the beginning of your entrypoint which will run your commands, if you set that ENV to true; now if you need to run your entrypoint (aka setting up your WP & MySQL), simply pass that ENV in build time.
docker build --build-arg var_name=${VARIABLE_NAME}
You cannot connect to the database from the Dockerfile at all.
Part of this is the basic Docker model of how images work. A Docker image contains only a filesystem and some metadata describing how to start a container from it; it is something you could copy to a different system and run there. If you built an image and tried to update a database as part of it, and then ran the same image on a different system, it wouldn't have the database setup; similarly, you can delete and recreate the local database without rebuilding the image, and you won't have any database content.
Mechanically, the docker build step (or its Compose equivalent) runs in a restricted environment. Most notably here, it is not attached to any Compose network, so there's no network setup for it to resolve hostnames like mhndev_systems_mysql. (Technically it is on the default bridge network, as distinct from the Compose default network or any networks: you specify for the built container.)
In a typical application you'd want to separate "the application code" from "the database setup". You have to run the database-setup part (often, "migrations") when the application starts up, or separately from starting the application; but you can't do it at build time.
My guess is that you are unable to connect because the database service started but is not ready. In the docker documentation on depends_on it states this (and I too have had this problem):
depends_on does not wait for db and redis to be “ready” before starting web - only until they have been started. If you need to wait for a service to be ready, see Controlling startup order for more on this problem and strategies for solving it.
(emphasis mine)
In my case I solved it in a very ugly way (have a sleep() for 10 seconds in my python script), but if this is no solution for you, maybe the official strategy documentation found here might help.
[edit]
What do you use as the host variable name? When using a network in docker compose, machines should be able to communicate to each other using their container names (i.e. mhndev_systems_mysql in your case). Can you try that?
Getting below error during platform installation:
"Required libaio package is not found. ..."
However, above package is already installed:
rpm -q libaio
libaio-0.3.107-10.el6.x86_64
Here is output from the installation script:
./platform-setup-x64-linux-4.4.3.10393.sh
Unpacking JRE ...
Preparing JRE ...
Starting Installer ...
May 30, 2018 6:51:23 PM java.util.prefs.FileSystemPreferences$2 run
INFO: Created system preferences directory in java.home.
Verifying if the libaio package is installed. /opt/appdynamics/platform/installer/checkLibaio.sh
I got this too... I was running from command-line as a non-root user:
./platform-setup-x64-linux-4.4.3.10393.sh -q -varfile /appd/home/Install/response.varfile
I added the shell expand(-x) switch and log to the command(s) like so:
bash -x ./platform-setup-x64-linux-4.4.3.10393.sh -q -varfile /appd/home/Install/response.varfile > install.log 2>&1
If we tail the last bit of that log you get, this response in debug mode:
Verifying if the libaio package is installed. /opt/appdynamics/platform/installer/checkLibaio.sh
Required libaio package is not found. For instructions on installing
the missing package, refer to https://docs.appdynamics.com/display/PRO44/Enterprise+Console+Requirements
and the script checkLibaio.sh isn't left there... so you cannot figure it out easily. I also have a RedHat variant with the packages installed:
rpm -qa | grep libaio
libaio-0.3.109-13.el7.x86_64
Strangely enough I have one VM from the same image that will install the distribution just fine, and one that will not, so on the broken install (where I really want to install this). I ran another command from the expanded view of the install.log, which was a really long JVM command line. Anyways I got it to work and then made a looping script to retrieve the file (Because AppD for some reason removes the check script before you can look at it). The script is as follows:
#!/bin/sh
# Script used to check if the machine has libaio on it or not.
cat /dev/null > /opt/appdynamics/platform/installer/.libaio_status
chmod 777 /opt/appdynamics/platform/installer/.libaio_status
# Check if the dpkg or rpm command exists before running it.
command -v dpkg >/dev/null 2>&1
OUT=$?
if [ $OUT -eq 0 ];
then
if [ `dpkg -l | grep -i libaio* | wc -l` -gt 0 ];
then
echo SUCCESS >> /opt/appdynamics/platform/installer/.libaio_status
exit 0
fi
else
command -v rpm >/dev/null 2>&1
OUT=$?
if [ $OUT -eq 0 ];
then
if [ `rpm -qa | grep -i libaio* | wc -l` -gt 0 ];
then
echo SUCCESS >> /opt/appdynamics/platform/installer/.libaio_status
exit 0
fi
fi
fi
echo FAILURE >> /opt/appdynamics/platform/installer/.libaio_status
exit 1
I you run this script like me on the faulty platform what you will discover is that your version of Linux has both:
dpkg
and
rpm
installed. To work around this you should temporarily make a name change to one of these two package manager executables so it cannot be found (by your shell environment).
Most common here will be that you are running a RedHat variant where someone chose to install dpkg (For who knows what reason). If so desired remove that package and the install should be successful.
I am writing a wordpressplugin and want to create a phpunit testenvironment for it. For that I've created a docker container using a php:7.2-apache base container and installed phpunit on it via phar archive on the image. After that I have set some environment variables and used the following bashscript, which is similear to the one created by "wp scaffold plugin-tests", as entrypoint.
# INSTALL WP-CORE
wp core download --path="${WPPATH}" --allow-root
waitforit -t 60 database:3306 -- wp config create --dbuser="${WPDBUSER}" --dbpass="${WPDBPASS}" --dbname="${WPDBNAME}" --dbhost="${WPDBHOST}" --path="${WPPATH}" --allow-root
wp db create --path="${WPPATH}" --allow-root
wp core install --url="${WPURL}" --title="SpitzeDev" --admin_user="${ADMINUSER}" --admin_password="${ADMINPASS}" --admin_email="${ADMINMAIL}" --path="${WPPATH}" --allow-root
chown www-data:www-data "/var/www/html" -R
# Install WP-Testsuite for PHPUnit
if [ ! -d $WP_TESTS_DIR ]; then
mkdir -p $WP_TESTS_DIR
svn co --quiet https://develop.svn.wordpress.org/tags/$(wp core version --allow-root --path=${WPPATH})/tests/phpunit/includes/ $WP_TESTS_DIR/includes
svn co --quiet https://develop.svn.wordpress.org/tags/$(wp core version --allow-root --path=${WPPATH})/tests/phpunit/data/ $WP_TESTS_DIR/data
fi
# Configure WP-Testuite for PHPUnit
if [ ! -f wp-tests-config.php ]; then
download https://develop.svn.wordpress.org/${WP_TESTS_TAG}/wp-tests-config-sample.php "$WP_TESTS_DIR"/wp-tests-config.php
# remove all forward slashes in the end
WP_CORE_DIR=$(echo ${WPPATH} | sed "s:/\+$::")
sed -i "s:dirname( __FILE__ ) . '/src/':'${WP_CORE_DIR}/':" "$WP_TESTS_DIR"/wp-tests-config.php
sed -i "s/youremptytestdbnamehere/$WPDBNAME/" "$WP_TESTS_DIR"/wp-tests-config.php
sed -i "s/yourusernamehere/$WPDBUSER/" "$WP_TESTS_DIR"/wp-tests-config.php
sed -i "s/yourpasswordhere/$WPDBPASS/" "$WP_TESTS_DIR"/wp-tests-config.php
sed -i "s|localhost|${WPDBHOST}|" "$WP_TESTS_DIR"/wp-tests-config.php
fi
phpunit
The script works fine until phpunit is called. But then the follwing exception is thrown:
"Fatal error: Class PHPUnit_Util_Test may not inherit from final class (PHPUnit\Util\Test) in /tmp/wordpress-tests-lib/includes/phpunit6-compat.php on line 18"
I don't really understand how this error could occure. If I use this the phpunit tests of my plugin the error is not thrown. If use these Tests on my local maschine they work just fine.
I had this problem when trying to test using the wordpress core test framework with phpunit 7.0.3 and PHP 7.1.6
Solved by switching to phpunit 6.1.0 and PHP 7.0.20.
I've just started Api-Platform framework and while executing:
php bin/schema generate-types src/ app/config/schema.yml
I get this:
C:\wamp\www\sf2-api>php bin/schema generate-types src/ app/config/schema.yml
dir=$(d=${0%[/\\]*}; cd "$d"; cd "../vendor/api-platform/schema-generator/bin" &
& pwd)
# See if we are running in Cygwin by checking for cygpath program
if command -v 'cygpath' >/dev/null 2>&1; then
# Cygwin paths start with /cygdrive/ which will break windows PHP,
# so we need to translate the dir path to windows format. However
# we could be using cygwin PHP which does not require this, so we
# test if the path to PHP starts with /cygdrive/ rather than /usr/bin
if [[ $(which php) == /cygdrive/* ]]; then
dir=$(cygpath -m $dir);
fi
fi
dir=$(echo $dir | sed 's/ /\ /g')
"${dir}/schema" "$#"
I am using Symfony 2.7.8 on window7.
I have the same issue on ubunbu 14.04.
Finally, I replace the bin directory with the one in blog-api.
Updated:
The bin-api-platform is the one generated by api-platform.
The bin-blog-api is the one I copy from blog-api. This works fine.
Use :
php vendor/api-platform/schema-generator/bin/schema generate-types src/app/config/schema.yml
instead of :
php bin/schema generate-types src/ app/config/schema.yml
The correct syntax is:
php vendor/api-platform/schema-generator/bin/schema generate-types src/ app/config/schema.yml
I've created a rpm where in spec file in %prep I create user and group, so the new installed files do run under that specific user. However, looks like rpmbuild ignores my %prep and during rpm installation im gettin:
Running Transaction
Installing : appdynamics-machineagent-4.0.1.0-1.x86_64 1/1
warning: user appdynamics does not exist - using root
warning: group appdynamics does not exist - using root
warning: user appdynamics does not exist - using root
warning: group appdynamics does not exist - using root
RPM gets installed but with root user. My spec file (%prep section) looks like this:
%define _unpackaged_files_terminate_build 0
%prep
getent group appdynamics >/dev/null || groupadd -r appdynamics || exit 1
getent passwd appdynamics >/dev/null || useradd -r -g appdynamics -d /opt/appdynamics -s /bin/sh -c "appdynamics system user" appdynamics || exit 1
if [ -x /etc/init.d/appdynamics ]
then
/etc/init.d/appdynamics stop || true
fi
if [ -d /opt/appdynamics ]
then
rm -rf /opt/appdynamics || true
fi
exit 0
%setup -q
%build
%install
......
%files
%defattr(-,appdynamics,appdynamics)
%dir /opt/appdynamics
......
Any suggestions?
Thanks a zillion
%prep preps the build. It's not run on the client machine. You want it in %pre or %post to run at install.