<commit_before>rsFormTesterPlugin
========

*test your symfony forms painless*


Installation
------------------

**svn:**
svn co [http://svn.github.com/digitalkaoz/rsFormTesterPlugin.git](http://svn.github.com/digitalkaoz/rsFormTesterPlugin.git)

**git:**
git clone [<EMAIL>:digitalkaoz/rsFormTesterPlugin.git](<EMAIL>:digitalkaoz/rsFormTesterPlugin.git)

**pear:**
symfony plugin install rsFormTesterPlugin

**enable the plugin in your *config/ProjectConfiguration.class.php* !**

Configuration
-------------

    configuration:
      formClass: fooForm
      withSave: true
      verbose: true

    pass:
      -
        foo: bar
        bar: bazz
        bazz:
          bar: foo
          foo: bar
      # ...
    fail:
      -
        _expectedErrors: [foo, bazz, bazz/bar]
        foo: 
        bar: bazz
        bazz:
          bar: 
          foo: bar
      # ...

  - The **formClass** option defines which form the tester should instanciate.

  - The **withSave** option invokes a sfForm::save call.

  - The **verbose** option enables more detailed information on each test (**recommended**)

  - The **pass** options holds all different datasets which should pass the form validation.

  - The **fail** options holds all different datasets which should fail the form validation. the *_expectedErrors* options defines the errors you expect from the form. the *verbose* will show other errors as well.

**Notice the *foo/bar/bazz/* notation, thats how you define errors in embedded forms.**

If you will you can pass an already instanciated form to the tester (before runnning your tests)

    $form = new FooBarForm($object,array('special_option'=>'foo'),array('special_arg'=>'bar'));
    $tester->setForm($form);
 
    //go on with your tests


Usage
-----

in your tests you are able to use the tester this way:

    /* @var $t lime_test */

    $tester = rsFormTester::create('path/to/config.yml');
    $tester->testData($t);         #for both set
    $tester->testData($t,'valid'); # for valid sets only
    $tester->testData($t,'invalid'); # for invalid sets only
    
    //or the short way
    $tester = rsFormTester::create('path/to/config.yml')->testData($t);

**Dont forget to increase the test count if you defined one**

*Thats it! All the different sets of data will be iterated and compared to what you expect*

TODO
----
  - fix the form field unset option (e.g. for unsetting captchas from fieldschema)
  - remove dependency to lime
<commit_msg>documentation<commit_after>rsFormTesterPlugin
========

*test your symfony forms painless*


Installation
------------------

**svn:**
svn co [http://svn.github.com/digitalkaoz/rsFormTesterPlugin.git](http://svn.github.com/digitalkaoz/rsFormTesterPlugin.git)

**git:**
git clone [<EMAIL>:digitalkaoz/rsFormTesterPlugin.git](<EMAIL>:digitalkaoz/rsFormTesterPlugin.git)

**pear:**
symfony plugin install rsFormTesterPlugin

**enable the plugin in your *config/ProjectConfiguration.class.php* !**

Configuration
-------------

    configuration:
      formClass: fooForm
      withSave: true
      verbose: true

    pass:
      -
        foo: bar
        bar: bazz
        bazz:
          bar: foo
          foo: bar
      # ...
    fail:
      -
        _expectedErrors: [foo, bazz, bazz/bar]
        foo: 
        bar: bazz
        bazz:
          bar: 
          foo: bar
      # ...

  - The **formClass** option defines which form the tester should instanciate.

  - The **withSave** option invokes a sfForm::save call.

  - The **verbose** option enables more detailed information on each test (**recommended**)

  - The **pass** options holds all different datasets which should pass the form validation.

  - The **fail** options holds all different datasets which should fail the form validation. the *_expectedErrors* options defines the errors you expect from the form. the *verbose* will show other errors as well.

**Notice the *foo/bar/bazz/* notation, thats how you define errors in embedded forms.**


Usage
-----

in your tests you are able to use the tester this way:

    /* @var $t lime_test */

    $tester = rsFormTester::create('path/to/config.yml');
    $tester->testData($t);         #for both set
    $tester->testData($t,'valid'); # for valid sets only
    $tester->testData($t,'invalid'); # for invalid sets only
    
    //or the short way
    $tester = rsFormTester::create('path/to/config.yml')->testData($t);

**Dont forget to increase the test count if you defined one!**

If you will you can pass an already instanciated form to the tester (before runnning your tests)

    $form = new FooBarForm($object,array('special_option'=>'foo'),array('special_arg'=>'bar'));
    $tester->setForm($form);
 
    //go on with your tests


*That's it! All the different sets of data will be iterated and compared to what you expect*

TODO
----
  - fix the form field unset option (e.g. for unsetting captchas from fieldschema)
  - remove dependency to lime

{'fraction_non_alphanumeric': 0.1272984441301273, 'fraction_numerical': 0.0, 'mean_word_length': 2.9285714285714284, 'pattern_counts': {'":': 0, '<': 7, '<?xml version=': 0, '>': 21, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '5346161', 'n_tokens_mistral': 1499, 'n_tokens_neox': 1435, 'n_words': 500}