Home

themouette edited this page Nov 23, 2011 · 12 revisions

Overview

The main idea of the plugin is to integrate phpunit and symfony more closer.
Make the process of test writing more standard, flexible and easy for symfony developers.
Another idea is to allow developers use features that only they want and not to inflict any extra requirments.

There are some main features.

  • Flexible way to store and run tests.
  • Manage fixtures, separate them to different folders.
  • Manage symfony contexts.
  • Configure phpunit in a symfony configuration way.
  • Create testing infrastructure in one touch.
  • Provide custom TestCases, for example, SeleniumTestCase, AmfTestCase.

Example project

We made a sendbox project with some unit and functional tests.
Also there is a lot of snapshots in project doc directory.
You can checkout the project:

  svn checkout http://svn.symfony-project.com/plugins/sfPhpunitPlugin/branches/example-project

Requirements

  • Symfony 1.2.x – 1.4.x
  • PHPUnit 3.4.x (also works with 3.3.x but there might be some bugs)
  • SabreAMF for amf testing (optional).
  • Selenium for functionals testing (optional).
  • Mysql 5.x or Oracle 10g RDBMS

Installation

  1. download:
    1. pear package

      php symfony plugin:install sfPhpunitPlugin
    2. svn tag

      svn checkout http://svn.symfony-project.com/plugins/sfPhpunitPlugin/tags/sfPhpunitPlugin-1.0.13
    3. git version(development):

      git clone https://github.com/makasim/sfPhpunitPlugin.git
  2. enable it in ProjectConfiguration:
    
        class ProjectConfiguration extends sfProjectConfiguration
        {
            public function setup()
            {
                $env = sfConfig::get('sf_environment');
                // Enviornment is not loaded at this point when run from CLI
                if ( $env === 'test' || php_sapi_name() === 'cli' ) {
                    $this->enablePlugins('sfPhpunitPlugin');
                }
            }
        }
    

Features

The plugin infrastructure
Test Running
Eclipse PDT
NetBeans
Suite Handling
Context Managing
Config backup
Fixtures
Custom TestCases
Stubs data
Plugins testing
Good practices
Plans

Feedback

Any feedbacks with ideas, bugs, misunderstandings, troubles are very welcome.

Thanks

I want to say a big thank the whole FormaPro company.
The people from there use the plugin from very early versions and gives me very valuable feedbacks.