Hi,

I am using Cake Tests, on cake 2.1.1 (upgraded from cake 1.3) and I
have a problem : when running tests, tables are not truncated after
each test.

I use the params $dropTables = false; because I don't want create
tables before each test, only fill them and truncate after tests.

I don't find how to force truncate in my app, but I do it by modifying
CakePhp code, in file Cate/TestSuite/Fixture/CakeFixtureManager.php :
I modify function unload() like this : (added lines are the ones
begining by # )
        public function unload(CakeTestCase $test) {
                $fixtures = !empty($test->fixtures) ? $test->fixtures : array();
                foreach (array_reverse($fixtures) as $f) {
                        if (isset($this->_loaded[$f])) {
                                $fixture = $this->_loaded[$f];

                                if (!empty($fixture->created)) {
                                        foreach ($fixture->created as $ds) {
                                                $db = 
ConnectionManager::getDataSource($ds);
                                                debug($fixture->truncate($db));
                                        }
                                }
# else {
# $db = ConnectionManager::getDataSource($fixture->useDbConfig);
# $fixture->truncate($db);
# }
                        }
                }
        }

Is it a bug in Cake lib or did I miss something ?

-- 
Our newest site for the community: CakePHP Video Tutorials 
http://tv.cakephp.org 
Check out the new CakePHP Questions site http://ask.cakephp.org and help others 
with their CakePHP related questions.


To unsubscribe from this group, send email to
cake-php+unsubscr...@googlegroups.com For more options, visit this group at 
http://groups.google.com/group/cake-php

Reply via email to