|
50 | 50 | import org.xwiki.rendering.internal.macro.toc.TocMacro; |
51 | 51 | import org.xwiki.rendering.macro.script.MacroPermissionPolicy; |
52 | 52 | import org.xwiki.rendering.transformation.MacroTransformationContext; |
| 53 | +import org.xwiki.repository.script.RepositoryScriptService; |
53 | 54 | import org.xwiki.script.service.ScriptService; |
54 | 55 | import org.xwiki.test.annotation.ComponentList; |
55 | 56 | import org.xwiki.test.junit5.mockito.MockComponent; |
|
58 | 59 | import org.xwiki.test.page.TestNoScriptMacro; |
59 | 60 | import org.xwiki.test.page.XWikiSyntax21ComponentList; |
60 | 61 |
|
| 62 | +import com.xpn.xwiki.api.Object; |
61 | 63 | import com.xpn.xwiki.doc.XWikiDocument; |
62 | 64 | import com.xpn.xwiki.objects.BaseObject; |
63 | 65 |
|
|
94 | 96 | LoggingScriptService.class, |
95 | 97 | PermissionCheckerListener.class, |
96 | 98 | TestNoScriptMacro.class, |
97 | | - TocMacro.class, |
| 99 | + TocMacro.class |
98 | 100 | }) |
99 | 101 | class ExtensionSheetPageTest extends PageTest |
100 | 102 | { |
@@ -189,6 +191,13 @@ void setUp() throws Exception |
189 | 191 | // Mock restricted contexts. |
190 | 192 | when(this.groovyMacroPermissionPolicy.hasPermission(any(), any())).thenAnswer(i -> |
191 | 193 | !((MacroTransformationContext) i.getArgument(1)).getTransformationContext().isRestricted()); |
| 194 | + |
| 195 | + // Mock repository script service |
| 196 | + RepositoryScriptService repositoryScriptService = |
| 197 | + this.componentManager.registerMockComponent(ScriptService.class, "repository", |
| 198 | + RepositoryScriptService.class, false); |
| 199 | + when(repositoryScriptService.getVersionObject(any(), any())).thenReturn(new Object(extensionVersionObject, |
| 200 | + null)); |
192 | 201 | } |
193 | 202 |
|
194 | 203 | @Test |
|
0 commit comments