Hello again

I solved my problem.

Now i'm trying to unit Test a (child) model M_child having a belongsTo
relation to M_parent.

I encounter problem when i test a find method written in the child
model.
I thought , with a recursive value set to 1 (by default), i would get
in my resultset one line of my parent model...but no  , i just get the
lines of the child model.
How could i test my belongsTo relation?

Regards

Laurent

On Sep 8, 4:46 pm, Laurent Bois <[EMAIL PROTECTED]> wrote:
> Hello
>
> I'm newbie for CakePHP, and have been working for 2,5y with Rails.
> We currently have an application developed from scratch by another
> team... the code is not very maintainable, and i'd like to refactore
> it in order to use Cake.
> Before really playing with controllers, views , i wanted to unittest
> all my models, having relations between them.
>
> I just have a question about how to use assertTrue in one pass totest
> the resultset coming from a query on my Model1, having a hasMany
> relation to Model2
>
> When my Model1 did not have any relation i could do :
> $conditions = array(
>             'id' => 1
>         );
> $result = $this->Model1Test->find($conditions, array('id', 'title'));
>         $expected = array(
>             array('Model1Test' => array( 'id' => 1, 'title' => 'First
> Article' ))
>         );
>
>         $this->assertEqual($result, $expected);
>
> Now Model1 as a relation hasMany to Model2, i'd like to be able to add
> Model2's rows in my $expected variable...
>
> Thanks
>
> L

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"CakePHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to