Thanks for reply.
Actually I have some checks like
if (!class_exists('RatePlanMock')) {...}
they were removed to simplify code (and it actually works when there is only
1 test)
User and RatePlan classes were imported also
Trick was in 2nd argument of $this->getMock(). It appeared that for model
Mocks should be done inside each test method, but if you are doing them
inside setUp() then, you should not specify the class name for the mock,
because you will get duplicate defined class errors. So lets say you want to
mock the save method for a model
App::uses('User', 'Model') //It is impor
Hi, I have a problem with creating mocks for models which have related
models.
Models looks like:
class User extends AppModel {
public $hasAndBelongsToMany = array(
'RatePlan',
);
}
class RatePlan extends AppModel {
public $hasAndBelongsToMany = array(
'User',
)