diff options
author | Roeland Jago Douma <roeland@famdouma.nl> | 2017-01-02 16:32:16 +0100 |
---|---|---|
committer | Roeland Jago Douma <roeland@famdouma.nl> | 2017-01-06 09:42:39 +0100 |
commit | 350b7ebc860c59665b60d0d45e5c7ab01b84e716 (patch) | |
tree | d561d274441bd7e35a4fad2eb6b9a59899635927 /core/Controller/CssController.php | |
parent | e3a57c1f07ece1c93feef31ae44a356f7d794096 (diff) | |
download | nextcloud-server-350b7ebc860c59665b60d0d45e5c7ab01b84e716.tar.gz nextcloud-server-350b7ebc860c59665b60d0d45e5c7ab01b84e716.zip |
Adds CssControllerTests
Signed-off-by: Roeland Jago Douma <roeland@famdouma.nl>
Diffstat (limited to 'core/Controller/CssController.php')
-rw-r--r-- | core/Controller/CssController.php | 29 |
1 files changed, 12 insertions, 17 deletions
diff --git a/core/Controller/CssController.php b/core/Controller/CssController.php index e547987902d..1206c95a5b8 100644 --- a/core/Controller/CssController.php +++ b/core/Controller/CssController.php @@ -21,32 +21,30 @@ namespace OC\Core\Controller; -use OC\AppFramework\Utility\TimeFactory; -use OC\CssManager; use OCP\AppFramework\Controller; use OCP\AppFramework\Http; use OCP\AppFramework\Http\NotFoundResponse; use OCP\AppFramework\Http\FileDisplayResponse; +use OCP\AppFramework\Utility\ITimeFactory; use OCP\Files\IAppData; use OCP\Files\NotFoundException; use OCP\IRequest; -use OCP\Notification\IApp; class CssController extends Controller { /** @var IAppData */ protected $appData; - /** @var TimeFactory */ + /** @var ITimeFactory */ protected $timeFactory; /** * @param string $appName * @param IRequest $request * @param IAppData $appData - * @param TimeFactory $timeFactory + * @param ITimeFactory $timeFactory */ - public function __construct($appName, IRequest $request, IAppData $appData, TimeFactory $timeFactory) { + public function __construct($appName, IRequest $request, IAppData $appData, ITimeFactory $timeFactory) { parent::__construct($appName, $request); $this->appData = $appData; @@ -69,16 +67,13 @@ class CssController extends Controller { return new NotFoundResponse(); } - if ($cssFile !== false) { - $response = new FileDisplayResponse($cssFile, Http::STATUS_OK, ['Content-Type' => 'text/css']); - $response->cacheFor(86400); - $expires = new \DateTime(); - $expires->setTimestamp($this->timeFactory->getTime()); - $expires->add(new \DateInterval('PT24H')); - $response->addHeader('Expires', $expires->format(\DateTime::RFC2822)); - $response->addHeader('Pragma', 'cache'); - return $response; - } - return new NotFoundResponse(); + $response = new FileDisplayResponse($cssFile, Http::STATUS_OK, ['Content-Type' => 'text/css']); + $response->cacheFor(86400); + $expires = new \DateTime(); + $expires->setTimestamp($this->timeFactory->getTime()); + $expires->add(new \DateInterval('PT24H')); + $response->addHeader('Expires', $expires->format(\DateTime::RFC1123)); + $response->addHeader('Pragma', 'cache'); + return $response; } } |