I have a model Model1 that has many Model2.

An instance of Model1 is passsed as a paramer to the fuction that I want to test. the function that I would like to test looks like this:

```
function funnctionTotest(Model1 $moel1)
{
   foreach($moel1->model2s as $model2) {
     ....
   }
}

```

The example below does not work. I am putting it here as a starting point for a real solution (array() should be replaced by something else maybe a collections of Model2 instances).

```
$mock = $this->getMockBuilder('Model1')
    ->disableOriginalConstructor()
    ->getMock();
$mock->setAttribute('Model2s', array());

```

Thanks