atoum's documentation

4. Cookbook

4.1. Usage with symfony 1.4

If you want to use atoum inside a symfony 1.4 project, the sfAtoumPlugin is available at the following adress : https://github.com/atoum/sfAtoumPlugin.

4.2. Installation

There is many ways to install the plugin in your project :

  • via composer
  • via git submodules

4.2.1. Using composer

Add this in your composer.json :

  1. "require"  : {
  2. "atoum/sfAtoumPlugin": "*"
  3. },

After a php composer.phar update the plugin should be in the plugin folder and atoum in the vendor folder.

Then in your ProjectConfiguration file you have to activate the plugin and define the atoum path.

  1. sfConfig::set('sf_atoum_path', dirname(__FILE__) . '/../vendor/atoum/atoum');
  2.  
  3. if (sfConfig::get('sf_environment') != 'prod')
  4. {
  5. $this->enablePlugins('sfAtoumPlugin');
  6. }

4.2.2. Using a git submodule

Install atoum as a submodule

  1. git submodule add git://github.com/atoum/atoum.git lib/vendor/atoum

Install sfAtoumPlugin as a git submodule

  1. git submodule add git://github.com/atoum/sfAtoumPlugin.git plugins/sfAtoumPlugin

Add the plugin in your ProjectConfiguration file

  1. if (sfConfig::get('sf_environment') != 'prod')
  2. {
  3. $this->enablePlugins('sfAtoumPlugin');
  4. }

4.3. Write tests

Tests must include the bootstrap :

  1. require_once __DIR__ . '/../../../../plugins/sfAtoumPlugin/bootstrap/unit.php';

4.4. Launch tests

You can launch tests with this symfony command :

  1. ./symfony atoum:test

You can pass a configuration any atoum configuration, so for example, you can pass a configuration file like this :

  1. php symfony atoum:test -c config/atoum/hudson.php