This issue has been created
There is 1 update.
 
 
XWiki Platform / cid:jira-generated-image-avatar-2ee8ac38-d5cc-4b32-84d3-bb2ae475b43e XWIKI-24756 Open

TestUtils#deleteSpace(EntityReference) does nothing and TestUtils#getURLToDeleteSpace returns a wrong URL

 
View issue   ·   Add comment
 

Issue created

 
cid:jira-generated-image-avatar-d8e4ec1b-63f9-40ba-9e61-4812d797b386 Raphaël Jakse created this issue on 31/Aug/26 09:12
 
Summary: TestUtils#deleteSpace(EntityReference) does nothing and TestUtils#getURLToDeleteSpace returns a wrong URL
Issue Type: cid:jira-generated-image-avatar-2ee8ac38-d5cc-4b32-84d3-bb2ae475b43e Bug
Affects Versions: 18.4.4
Assignee: Unassigned
Components: Test Framework
Created: 31/Aug/26 09:12
Priority: cid:jira-generated-image-static-trivial-ff020c3c-e2a7-42f2-9145-b52b273c2a67 Trivial
Reporter: Raphaël Jakse
Description:

That's because of a parameter mismatch when calling getURL() that unfortunately happens to type check.

At line 1017 in getUrlToDeleteSpace:

When getURL is called, "WebHome" is passed to the action parameter and the query string is passed to the fragment parameter:

    /**
     * @param space the reference of the space to delete
     * @return the URL that can be used to delete the specified pace
     * @since 14.1RC1
     */
    public String getURLToDeleteSpace(EntityReference space)
    {
        return getURL(space, "WebHome", "deletespace", "confirm=1&async=false&affectChidlren=on");
    }

Because this calls getURL(EntityReference reference, String action, String queryString, String fragment) instead of what was intended, getURL(EntityReference reference, String action, String queryString).

The fix probably consists in removing "WebHome", like this:

    /**
     * @param space the reference of the space to delete
     * @return the URL that can be used to delete the specified pace
     * @since 14.1RC1
     */
    public String getURLToDeleteSpace(EntityReference space)
    {
        return getURL(space, "deletespace", "confirm=1&async=false&affectChidlren=on");
    }
 
 

1 update

 
cid:jira-generated-image-avatar-d8e4ec1b-63f9-40ba-9e61-4812d797b386 Changes by Raphaël Jakse on 31/Aug/26 09:13
 
Description: That's because of a parameter mismatch when calling {{getURL()}} that unfortunately happens to type check.

At [line 1017 in {{getUrlToDeleteSpace}}|https://github.com/xwiki/xwiki-platform/blob/6974685e5ac4c75ecd8b5fed49dca549316a1e17/xwiki-platform-core/xwiki-platform-test/xwiki-platform-test-ui/src/main/java/org/xwiki/test/ui/TestUtils.java#L1017]:

When {{getURL}} is called, {{"WebHome"}} is passed to the {{action}} parameter and the query string is passed to the {{fragment}} parameter:

{code :java }
    /**
     * @param space the reference of the space to delete
     * @return the URL that can be used to delete the specified pace
     * @since 14.1RC1
     */
    public String getURLToDeleteSpace(EntityReference space)
    {
        return getURL(space, "WebHome", "deletespace", "confirm=1&async=false&affectChidlren=on");
    }
{code}

Because this calls [{{getURL(EntityReference reference, String action, String queryString, String fragment)}}|https://github.com/xwiki/xwiki-platform/blob/6974685e5ac4c75ecd8b5fed49dca549316a1e17/xwiki-platform-core/xwiki-platform-test/xwiki-platform-test-ui/src/main/java/org/xwiki/test/ui/TestUtils.java#L1441] instead of what was intended, [{{getURL(EntityReference reference, String action, String queryString)}}|https://github.com/xwiki/xwiki-platform/blob/6974685e5ac4c75ecd8b5fed49dca549316a1e17/xwiki-platform-core/xwiki-platform-test/xwiki-platform-test-ui/src/main/java/org/xwiki/test/ui/TestUtils.java#L1433].

Additionally, {{affectChidlren}} looks wrong, it should probably read {{{}affectChildren{}}}:

The fix probably consists in removing {{"WebHome"}} and fixing {{{}affectChildren{}}} , like this:

{code :java }
    /**
     * @param space the reference of the space to delete
     * @return the URL that can be used to delete the specified pace
     * @since 14.1RC1
     */
    public String getURLToDeleteSpace(EntityReference space)
    {
        return getURL(space, "deletespace", "confirm=1&async=false&
affectChidlren affectChildren =on");
    }
{code}