From: Bharat M. <bh...@us...> - 2004-08-31 19:36:38
|
Update of /cvsroot/gallery/gallery2/modules/core/test/phpunit In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv29943/modules/core/test/phpunit Modified Files: ItemEditLayoutPluginTest.class ItemEditMoviePluginTest.class Log Message: * Don't get rid of event listeners in GalleryTestCase::setUp(), as this causes problems with the imageblock module * Fix a couple of cases where we were not calling parent::tearDown() at the bottom of the test's tearDown() so the entity counter was getting fooled into thinking that we were leaking entities. Index: ItemEditMoviePluginTest.class =================================================================== RCS file: /cvsroot/gallery/gallery2/modules/core/test/phpunit/ItemEditMoviePluginTest.class,v retrieving revision 1.6 retrieving revision 1.7 diff -u -d -r1.6 -r1.7 --- ItemEditMoviePluginTest.class 21 Aug 2004 07:50:04 -0000 1.6 +++ ItemEditMoviePluginTest.class 31 Aug 2004 19:36:29 -0000 1.7 @@ -63,12 +63,12 @@ function tearDown() { global $gallery; - parent::tearDown(); - $ret = GalleryCoreApi::deleteEntityById($this->_album->getId()); if ($ret->isError()) { $this->failWithStatus($ret->wrap(__FILE__, __LINE__)); } + + parent::tearDown(); } function testChangeSize() { @@ -233,6 +233,57 @@ return null; } + function opendir($path) { + return opendir($path); + } + + function readdir($handle) { + return readdir($handle); + } + + function closedir($handle) { + return closedir($handle); + } + + function rmdir($path) { + return rmdir($path); + } + + function recursiveRmdir($dirname) { + global $gallery; + if ($gallery->getDebug()) { + $gallery->debug("recursiveRmdir($dirname)"); + } + + if (!($fd = $this->opendir($dirname))) { + return false; + } + + while (($filename = $this->readdir($fd)) !== false) { + if (!strcmp($filename, '.') || !strcmp($filename, '..')) { + continue; + } + $path = "$dirname/$filename"; + + if ($this->is_dir($path)) { + $ret = $this->recursiveRmdir($path); + } else { + $ret = $this->unlink($path); + } + + if ($ret == false) { + return false; + } + } + closedir($fd); + + return $this->rmdir($dirname); + } + + function unlink($path) { + return unlink($path); // needed to release locks + } + function realpath($file) { return realpath($file); } Index: ItemEditLayoutPluginTest.class =================================================================== RCS file: /cvsroot/gallery/gallery2/modules/core/test/phpunit/ItemEditLayoutPluginTest.class,v retrieving revision 1.6 retrieving revision 1.7 diff -u -d -r1.6 -r1.7 --- ItemEditLayoutPluginTest.class 21 Aug 2004 07:50:04 -0000 1.6 +++ ItemEditLayoutPluginTest.class 31 Aug 2004 19:36:29 -0000 1.7 @@ -76,12 +76,12 @@ function tearDown() { global $gallery; - parent::tearDown(); - $ret = GalleryCoreApi::deleteEntityById($this->_album->getId()); if ($ret->isError()) { $this->failWithStatus($ret->wrap(__FILE__, __LINE__)); } + + parent::tearDown(); } function testUndo() { @@ -281,6 +281,18 @@ return null; } + function fclose($handle) { + return fclose($handle); // needed to release locks + } + + function getDirectorySeparator() { + return DIRECTORY_SEPARATOR; + } + + function unlink($path) { + return unlink($path); // needed to release locks + } + function closedir($path) { } |