This forum is in READ-ONLY mode.
You can look around, but if you want to ask a new question, please use Stack Overflow.

[SOLVED][DAY 20] Functionnal Tests fail

Discussion around this tutorial for symfony 1.2-1.4

[SOLVED][DAY 20] Functionnal Tests fail

by Valockar » Thu Sep 15, 2011 9:28 am

Hi,

I'm quite new to Symfony, so I tried Jobeet Tutorial to learn it, and now I'm stuck with a problem I can't fix on day 20.

The purpose of the day is to convert Jobeet in a sfJobeetPlugin ...

I did it step by step, moved all the model files, and modified all form classes replacing configure() method by setup() method.

The next step is to run all the tests previously made :

Code: Select all
$ ./symfony test:all
functional/backend/affiliateActionsTest..............................ok
functional/backend/categoryActionsTest...............................ok
functional/backend/jobActionsTest....................................ok
functional/frontend/affiliateActionsTest.............................not ok
    Failed tests: 1, 2
    Errors:
    - LogicException: The request was not redirected.
    -   at () in D:\Public\Dev\wks\sfprojects\Jobeet\lib\vendor\symfony\lib\util                                                                       \sfBrowserBase.class.php line 540
    -   at sfBrowserBase->followRedirect() in n/a line n/a
    ... and 4 more
functional/frontend/apiActionsTest...................................ok
functional/frontend/categoryActionsTest..............................ok
functional/frontend/jobActionsTest...................................not ok
    Failed tests: 20, 23, 24
    Errors:
    - LogicException: The request was not redirected.
    -   at () in D:\Public\Dev\wks\sfprojects\Jobeet\lib\vendor\symfony\lib\util\sfBrowserBase.class.php line 540
    -   at sfBrowserBase->followRedirect() in n/a line n/a
    ... and 5 more
unit/JobeetTest......................................................ok
unit/model/JobeetJobTest.............................................ok
Failed Test                     Stat  Total   Fail  Errors  List of Failed
--------------------------------------------------------------------------
/frontend/affiliateActionsTest     0      2      2      7  1 2
tional/frontend/jobActionsTest     0     24      3      8  20 23 24
Failed 2/9 test scripts, 77.78% okay. 5/75 subtests failed, 93.33% okay.


Seeing that some tests failed, I went to check with my own eyes what was wrong, and there I saw that newly generated forms displayed field we had unsetted in the previous days (created_at, updated_at, and so on ...)

Thus my form were not fitted for my tests anymore, some of these fields being mandatory.

I thought the forms would have been generated the way we designed them the previous days, but apparently not ...

So did I miss something ? Did I do something wrong ?
Do we have to redesign the forms in /lib/form/doctrine to override the ones from the plugin ? (But then, what is the purpose of doing a plugin then ...)

If someone was kind enough to point me in the right direction here ...

EDIT :
For the time being, I just overrode form classes in /lib/form/doctrine/sfJobeetPlugin/ with the code done in the previous days, and the tests are ok ...
But I'd really like to know if this is standard behavior (and in this case the tutorial should be updated to notice it) or if I did something wrong ...
Valockar
Junior Member
 
Posts: 2
Joined: Thu Sep 15, 2011 9:06 am
Location: France / Luxembourg

Re: [DAY 20] Functionnal Tests fail

by Valockar » Wed Sep 21, 2011 3:04 pm

Answering to myself (first sign of madness, but hey ...) to tell those interested that I've finally found the solution ...

Thanks to the snapshot provided by "claudia_k" for Doctrine, I was able to compare my code and hers (his ?) and so I understood my mistake, even if the tutorial isn't so well writen about this part ...

So, obviously, the form should be generated the way we designed them but the snippet provided by the tutorial :
Code: Select all
abstract class PluginJobeetAffiliateForm extends BaseJobeetAffiliateForm
{
  public function setup()
  {
    parent::setup();
  }
 
  // ...
}


Should be rewritten

Code: Select all
abstract class PluginJobeetAffiliateForm extends BaseJobeetAffiliateForm
{
  public function setup()
  {
    parent::setup();
   
    //*
    Keep your configure method code here
    */
  }
 
  // ...
}


And so everything goes back to the way it was meant to be ...

Hope this will help someone else ;)
Valockar
Junior Member
 
Posts: 2
Joined: Thu Sep 15, 2011 9:06 am
Location: France / Luxembourg