Being with Jenkins - how to serve a PHP application?

I recently started using Behat with Mink in a PHP project that uses a Thin microphotograph. My Behat tests work fine, but I would like to run them as part of my build that uses Sebastian Bergman's Jenkins-PHP template.

To do this, I expect that I will need to start a web server to serve the Slim application. The obvious answer would be PHP 5.4 built into the web server, but I'm limited to PHP 5.3.

The only idea that I have at the moment is to have a deployment phase, according to which, if the Ant build passes, Jenkins deploys the workspace to the server and then runs Behat tests against it. It looks like it will be a lot of work and can be peeling, plus it would have to deploy another virtual machine, which I would prefer to avoid. We strive to use Behat in a wide variety of projects, so a one-off would be preferable.

What is the best way to solve this problem?

+5
source share
4 answers

, , , , Jenkins Apache vhost conf.d , Behat, script - :

# Set up a host file entry if none exists
hostFileEntry="127.0.0.1 ${JOB_NAME}.loc"
if fgrep -i "$hostFileEntry" /etc/hosts
then
        echo "${hostFileEntry}" already in hosts file
else
        echo $hostFileEntry >> /etc/hosts
fi

# Set up a virtual host for this job
echo "<VirtualHost *:80>" > /etc/httpd/conf.d/${JOB_NAME}.conf
echo "    ServerName ${JOB_NAME}.loc" >> /etc/httpd/conf.d/${JOB_NAME}.conf
echo "    DocumentRoot ${WORKSPACE}/public" >> /etc/httpd/conf.d/${JOB_NAME}.conf
echo "        <Directory ${WORKSPACE}/public>" >> /etc/httpd/conf.d/${JOB_NAME}.conf
echo "            AllowOverride all" >> /etc/httpd/conf.d/${JOB_NAME}.conf
echo "            Order allow,deny" >> /etc/httpd/conf.d/${JOB_NAME}.conf
echo "            Allow from all" >> /etc/httpd/conf.d/${JOB_NAME}.conf
echo "        </Directory>" >> /etc/httpd/conf.d/${JOB_NAME}.conf
echo "</VirtualHost>" >> /etc/httpd/conf.d/${JOB_NAME}.conf

# Reload Apache
sudo /sbin/service httpd reload

Behat JUnit . , , : -)

+7
+1

Slim Mink ( Symfony). - , javascript.

javascript - php jenkins. jenkins.

+1

You can deploy a roaming server with php 5.3. This is a “different VM,” but it's incredibly one-time use.

0
source

All Articles