It worked, but in addition I have to set the model alias:
$this-User-alias = 'User';
because a simple `$this-User-read(null, 1)` raised an error saying
that 'User.a_column' couldn't be found.
On Nov 24, 3:22 pm, José Lorenzo jose@gmail.com wrote:
When mocking a model it is recommended
When mocking a model it is recommended that you pass the correct parameters
to the contstructor:
$this-User = $this-getMock('User', array('_saveUploadedFile',
'_removeUploadedFile'),
array(false, 'users', 'test'));
The third parameter indicates that you want to use the 'users' table and
the
Hi,
I am testing a model in CakePHP 2 and have mocked a model like this:
$this-User = $this-getMock('User', array('_saveUploadedFile',
'_removeUploadedFile'));
$this-User-expects($this-any())
-method('_saveUploadedFile')
-with($data, Configure::read('App.myDirectory'), true);