I was also getting that same error.
It seems the model is already loaded, so you dont run the loadModel()
function.All I did was the following:
$object = new Blog;
pr($object-findAll());
Simple ;) Hope it helps you.
--~--~-~--~~~---~--~~
You received this
I know the issue of testing controllers with SimpleTest has come up
before but unfortunately has gone unanswered. I'm hoping that in the
time that has passed it has been figured out. Testing models works fine
but controllers on the other hand is a hazy area.
The first problem is actually
loadmodels?
http://api.cakephp.org/basics_8php-source.html
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups Cake
PHP group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this
Hi Dieter,
Thanks for the reply.
Unfortunately adding loadModel('Blog') to the after the laodController gives a redeclaration error:
Fatal error: Cannot redeclare class blog in /path/to/cake/app/models/blog.php on line 142
Any more ideas?
Cheers,
Sonic
if it says that you are redeclaring it, you are probably loading it
twice
eg trying to load it manually while it's already loaded automatically.
are you sure you need to load it manually?
--~--~-~--~~~---~--~~
You received this message because you are subscribed
Hi Sonic,
Testing Controllers is a very important topic to me right now as well.
I've been talking about it on my
blog lately and I've also put some
of the code I use to make testing controllers easier in the
cakebin. However, that's not really what you are looking for, since I'm
not using
hey sonic,
there is a test helper which creates mock objects for all the models of
a controller.
http://cakephp.org/pastes/show/8803bd09150cb65cc7da63f92cdbc828
felix' post:
http://www.thinkingphp.org/2006/08/17/agility-divide-and-conquer-what/
cheers,
timo
Hi guys,
Thanks for your responses, much appreciated. Thanks v much for the links, very interesting.
@Felix, I'm definitely one of those people in your divide and conquer
blog. I'm also trying my best to become agile. I can't believe I didn't
think to mock the Models when in the controller,
Hi Felix,
Thanks for your reply.
I haven't really played around with Mocks that much myself but
everything I've read about them is positive in the sense that when
using Mocks with TDD, you are forced to think more in terms of
interactions between objects, which leads to a better design with less