Home > symfonyUnderControlPlugin

symfonyUnderControlPlugin

SymfonyUnderControlPlugin is a project mainly written in PHP, based on the View license.

A converter from Lime output to PHPUnit format, to integrate symfony test-suite with Hudson or CruiseControl

symfonyUnderControl plugin

The symfonyUnderControl plugin enables your symfony project to be run through the phpUnderControl (http://phpundercontrol.org) Continuous Integration environment. This can be used for automated unit testing, documentation generation, code coverage checks and even deployment to testing, staging or production environments.

Setting up a phpUnderControl environment is relatively easy, but it requires you have or install the following:

  • Java
  • CruiseControl
  • phpUnderControl

For additional functionality, you may also need

  • PHP_CodeSniffer
  • phpDocumentor
  • PHPUnit

Obviously, that last one is one we're trying to replace for projects where you use symfonyUnderControlPlugin ;)

There are various tutorials online on how to set up phpUnderControl, such as this one, I suggest you follow these to get the environment up and running. It is beyond the scope of this README to go into that. This README will focus on setting up symfonyUnderControl and configure phpUnderControl to use it for testing.

Installation

  • Install the plugin

    ./symfony plugin:install symfonyUnderControlPlugin --release=0.0.1
  • standard Configuration

    • Enable the plugin 'symfonyUnderControlPlugin' in your config/ProjectConfiguration.class.php file
    • ./symfony test:undercontrol PATH to run all the tests and save the output in PATH/undercontrol.xml
  • Hudson integration

    • Install "Hudson xUnit plugin"
    • In your Hudson project configuration :
      • Add an "Execute shell" build step : "./symfony test:undercontrol pwd"
      • Check "Publish testing tools result report"
      • Add a PHPUnit
      • Put "undercontrol.xml" as PHPUnit Pattern
  • phpUnderControl integration

    • Create a new project in your project directory by either using phpuc.php project or creating the structure yourself
    • Configure your project's build.xml to use symfonyUnderControl

      // build.xml
      // ...
      <!-- add clearcache and test to your build target -->
      <target name="build" depends="clearcache,test"/>
      <!-- clear the cache because new commits may have added new stuff -->
      <target name="clearcache">
        <exec executable="${basedir}/source/trunk/symfony">
          <arg line=" cc" />
        </exec>
      </target>
      <!-- execute the test:undercontrol task and have it point to the logs directory -->
      <target name="test">
        <exec executable="${basedir}/source/trunk/symfony">
          <arg line=" test:undercontrol ${basedir}/build/logs" />
        </exec>
      </target>
      // ...

      This is the most important step, because with this you configure the writing of the test output to an XML that can be read by phpUnderControl

  • Go to your phpUnderControl web interface and see your tests being executed and show up

TODO

  • Improve Functional Test handling
  • Improve documentation
  • Allow for plugin test execution
Previous:alhed