User tests: Successful: Unsuccessful:
We have to throw the error that the folder does not exist (and we do not ask to force the operation) but the test make the inverse.
Thinking about it, I guess that the test is right but the error message is wrong.
Labels |
Added:
?
?
|
I'm developer, let's say avarage one, and I don't understand from issue tracker and the message here what is desired behaviour for JFolder::copy when a folder exists? Can you give more info and step by step instruction how to test this?
JFolder::copy when used with force=false and the destination path already have source directory then it should throw a RuntimeException with message 'Destination folder already exists';
Best way to test it, is to write an assertion in phpunit at https://github.com/joomla/joomla-cms/blob/staging/tests/unit/suites/libraries/joomla/filesystem/JFolderTest.php#L28
as you can see test is marked as skip test. you just have to write an assertion to check for the exception.
Hi,
Sorry, I had to write this PR fast, they were closing the doors of the bug squad session.
Here a little test case:
mkdir(JPath::clean(JPATH_ROOT . '/tmp/test'), 0777, true);
file_put_contents(JPath::clean(JPATH_ROOT . '/tmp/test/index.html'), 'test');
JFolder::copy(JPATH_ROOT . '/tmp/test', JPATH_ROOT . '/tmp/test2');
// The folder is copied correctly
file_put_contents(JPath::clean(JPATH_ROOT . '/tmp/test/index2.html'), 'test');
JFolder::copy(JPATH_ROOT . '/tmp/test', JPATH_ROOT . '/tmp/test2');
// The folder "test2" already exist, it throw an exception with the correct error message.
Regards,
Sorry. My previous post was wrong. This is what I get for the test case:
-1 Destination folder already exists
So it is good for merge.
Status | New | ⇒ | Closed |
Closed_Date | 0000-00-00 00:00:00 | ⇒ | 2014-06-04 14:08:26 |
Issue tracker : http://joomlacode.org/gf/project/joomla/tracker/?action=TrackerItemEdit&tracker_item_id=33807&start=0