private $appData;
/** @var SCSSCacher */
private $scssCacher;
+ /** @var IURLGenerator */
+ private $urlGenerator;
/**
* ThemingController constructor.
* @param ITempManager $tempManager
* @param IAppData $appData
* @param SCSSCacher $scssCacher
+ * @param IURLGenerator $urlGenerator
*/
public function __construct(
$appName,
IL10N $l,
ITempManager $tempManager,
IAppData $appData,
- SCSSCacher $scssCacher
+ SCSSCacher $scssCacher,
+ IURLGenerator $urlGenerator
) {
parent::__construct($appName, $request);
$this->tempManager = $tempManager;
$this->appData = $appData;
$this->scssCacher = $scssCacher;
+ $this->urlGenerator = $urlGenerator;
}
/**
[
'data' =>
[
- 'message' => $this->l10n->t('Saved')
+ 'message' => $this->l10n->t('Saved'),
+ 'serverCssUrl' => $this->urlGenerator->linkTo('', $this->scssCacher->getCachedSCSS('core', '/core/css/server.scss'))
],
'status' => 'success'
]
'data' =>
[
'value' => $value,
- 'message' => $this->l10n->t('Saved')
+ 'message' => $this->l10n->t('Saved'),
+ 'serverCssUrl' => $this->urlGenerator->linkTo('', $this->scssCacher->getCachedSCSS('core', '/core/css/server.scss'))
],
'status' => 'success'
]
private $appData;
/** @var SCSSCacher */
private $scssCacher;
+ /** @var IURLGenerator */
+ private $urlGenerator;
public function setUp() {
$this->request = $this->createMock(IRequest::class);
->willReturn(123);
$this->tempManager = \OC::$server->getTempManager();
$this->scssCacher = $this->createMock(SCSSCacher::class);
+ $this->urlGenerator = $this->createMock(IURLGenerator::class);
$this->themingController = new ThemingController(
'theming',
$this->l10n,
$this->tempManager,
$this->appData,
- $this->scssCacher
+ $this->scssCacher,
+ $this->urlGenerator
);
return parent::setUp();
->method('t')
->with($message)
->willReturn($message);
+ $this->scssCacher
+ ->expects($this->once())
+ ->method('getCachedSCSS')
+ ->with('core', '/core/css/server.scss')
+ ->willReturn('/core/css/someHash-server.scss');
+ $this->urlGenerator
+ ->expects($this->once())
+ ->method('linkTo')
+ ->with('', '/core/css/someHash-server.scss')
+ ->willReturn('/nextcloudWebroot/core/css/someHash-server.scss');
$expected = new DataResponse(
[
'data' =>
[
'message' => $message,
+ 'serverCssUrl' => '/nextcloudWebroot/core/css/someHash-server.scss',
],
'status' => 'success',
]
->method('undo')
->with('MySetting')
->willReturn('MyValue');
+ $this->scssCacher
+ ->expects($this->once())
+ ->method('getCachedSCSS')
+ ->with('core', '/core/css/server.scss')
+ ->willReturn('/core/css/someHash-server.scss');
+ $this->urlGenerator
+ ->expects($this->once())
+ ->method('linkTo')
+ ->with('', '/core/css/someHash-server.scss')
+ ->willReturn('/nextcloudWebroot/core/css/someHash-server.scss');
$expected = new DataResponse(
[
[
'value' => 'MyValue',
'message' => 'Saved',
+ 'serverCssUrl' => '/nextcloudWebroot/core/css/someHash-server.scss',
],
'status' => 'success'
]
->method('undo')
->with($value)
->willReturn($value);
+ $this->scssCacher
+ ->expects($this->once())
+ ->method('getCachedSCSS')
+ ->with('core', '/core/css/server.scss')
+ ->willReturn('/core/css/someHash-server.scss');
+ $this->urlGenerator
+ ->expects($this->once())
+ ->method('linkTo')
+ ->with('', '/core/css/someHash-server.scss')
+ ->willReturn('/nextcloudWebroot/core/css/someHash-server.scss');
$folder = $this->createMock(ISimpleFolder::class);
$file = $this->createMock(ISimpleFile::class);
$this->appData
[
'value' => $value,
'message' => 'Saved',
+ 'serverCssUrl' => '/nextcloudWebroot/core/css/someHash-server.scss',
],
'status' => 'success'
]