I have an Orm model for users. Now I'm trying to write a test case using PHPUnit_Selenium package. I've written several test cases before successfully with Selenium but now I've encountered a problem with ORM's caching mechanisms.
Code for the test case: function test_edit_user_data() { // Load user data $user = Model_User::find(1); // Now $user->name is 'Old Name'
// Using the PHPUnit Selenium functions, make a request to // my app that should change $user name $this->url('http://example.dev/edit-user-data/');
// Reload the data $user = Model_User::find(1);
// Verify that the name has is indeed been edited $this->assertEquals($user->name, 'New Name'); // here the test fails as $user->name is still 'Old Name' }
If I check the my DB after the test, the user's name is 'New Name'. So I assume the caching in ORM is taking data from cache instead of the DB when I try to reload the data. I tried to reload user data with a different primary key field ( $user = Model_User::find_by_email('user@example.com') ) but this also gives me the old data.
So is there a way to bypass the cache? Or maybe clear it?