From bad8eb92060a3bec8a8c996e134d376ed8fcbbbc Mon Sep 17 00:00:00 2001 From: Christoph Galuschka Date: Nov 23 2011 12:26:38 +0000 Subject: Test for PHP-CLI Interaction with mysql --- diff --git a/tests/p_php/10-php-mylsq-test.sh b/tests/p_php/10-php-mylsq-test.sh new file mode 100755 index 0000000..cd2a92b --- /dev/null +++ b/tests/p_php/10-php-mylsq-test.sh @@ -0,0 +1,75 @@ +#!/bin/sh +# Author: Athmane Madjoudj +# Author: Christoph Galuschka +# reusing the script from LAMP-Tests + +t_Log "Running $0 - php-cli basic interaction with mysql test." + +# Install php-mysql-module +t_InstallPackage php-mysql + +# we need a working and running mysql server +t_InstallPackage mysql-server +t_ServiceControl mysqld start >/dev/null 2>&1 + +#create a little DB to use +CREATE='/var/tmp/mysql-php-QA.sql' + +cat >$CREATE <$INSERT < +EOF + +php $INSERT +if [ $? -ne 0 ] + then + t_Log FAIL + exit 1 +fi + +# create PHP script to read from DB +READ='/var/tmp/read.php' +cat >$READ < +EOF + +# If we execute the script and get '1' it works (1 entry should be in the DB) +php $READ | grep -q '1' + +t_CheckExitStatus $? + diff --git a/tests/p_php/php-test.sh b/tests/p_php/php-test.sh index cdcad18..af909e4 100755 --- a/tests/p_php/php-test.sh +++ b/tests/p_php/php-test.sh @@ -5,7 +5,6 @@ t_Log "Running $0 - php phpinfo() function test." # Comparing hostname with output of phpinfo() -#HOST=$(hostname) FILE='/var/tmp/php-test.php' cat > $FILE <