Bug: getViewUrl implementation differs from specification
In Func.pm, it is stated that for getViewUrl, the first parameter (web) is taken to be the current web if empty. However, the implementation in TWiki.pm does not insert the current web, if the first parameter is not given.
This could be easily fixed by adding back in code from Beijing which accomplished this. It is not clear why this has been removed.
Test case
Test case for Dakar is attached (see
GetViewUrlError).
Note that this testcase actually calls
TWiki::getScriptUrl as I could not figure out how to get the plugin object initialized from the test script. But as
TWiki::Func::getViewUrl just calls this function with the arguments passed, the same issue applies.
Environment
--
ThomasWeigert - 26 Dec 2004
Follow up
Can you try it on
DevelopBranch for us? Thanks. M.
--
MartinCleaver - 26 Dec 2004
I am not sure what you mean by "try it on
DevelopBranch"? Note that somebody took that code out from the Beijing version, which makes me think that this was intentional? Maybe this was done to use less global variables?
--
ThomasWeigert - 27 Dec 2004
This is a bug that needs to be fixed since it breaks existing functionality. --
PeterThoeny - 27 Dec 2004
A potential fix (bringing the old code back) is attached... --
ThomasWeigert - 27 Dec 2004
Fix record
Fixed on DEVELOP, rev 3410, without using
any global variables
--
CrawfordCurrie - 30 Dec 2004
This is not fixed in DEVELOP as of today (maybe somebody undid your fix)? See the test case attached.
--
ThomasWeigert - 01 May 2005
OK, getViewUrl was wrong; but your testcase was for getScriptUrl?
I added a module for Func testcases,
test/unit/FuncTests
--
CrawfordCurrie - 02 May 2005
Yes, as I explained, I could not figure out how to write this test case for Func code. Somehow one has to instantiate a Plugin object as getViewUrl is invoked via that one. I would be greatly obliged if you could teach me how to write the same test case as attached for invoking getViewUrl.
I figured this test case would be ok as this is just a pass through to getScriptUrl....
--
ThomasWeigert - 02 May 2005
See
test/unit/FuncTests.pm - I already wrote the testcase. When writing testcases it's important not to assume any implementation details beyond those that are absolutely necessary to set up the test fixture, so I called the Func interface methods as per their documentation, and not as per their old implementation.
--
CrawfordCurrie - 03 May 2005
Thanks. That test script was very illustrative for how to use the Func API....
--
ThomasWeigert - 03 May 2005