summaryrefslogtreecommitdiffstats
path: root/tests/Unit/Http/TextResponseTest.php
diff options
context:
space:
mode:
Diffstat (limited to 'tests/Unit/Http/TextResponseTest.php')
-rw-r--r--tests/Unit/Http/TextResponseTest.php44
1 files changed, 44 insertions, 0 deletions
diff --git a/tests/Unit/Http/TextResponseTest.php b/tests/Unit/Http/TextResponseTest.php
new file mode 100644
index 000000000..790cbe340
--- /dev/null
+++ b/tests/Unit/Http/TextResponseTest.php
@@ -0,0 +1,44 @@
+<?php
+/**
+ * ownCloud - News
+ *
+ * This file is licensed under the Affero General Public License version 3 or
+ * later. See the COPYING file.
+ *
+ * @author Alessandro Cosentino <cosenal@gmail.com>
+ * @author Bernhard Posselt <dev@bernhard-posselt.com>
+ * @copyright Alessandro Cosentino 2012
+ * @copyright Bernhard Posselt 2012, 2014
+ */
+
+
+namespace OCA\News\Http;
+
+
+class TextResponseTest extends \PHPUnit_Framework_TestCase {
+
+
+ protected function setUp() {
+ $this->response = new TextResponse('sometext');
+ }
+
+
+ public function testRender() {
+ $this->assertEquals('sometext', $this->response->render());
+ }
+
+ public function testContentTypeDefaultsToText(){
+ $headers = $this->response->getHeaders();
+
+ $this->assertEquals('text/plain', $headers['Content-type']);
+ }
+
+
+ public function testContentTypeIsSetableViaConstructor(){
+ $response = new TextResponse('sometext', 'html');
+ $headers = $response->getHeaders();
+
+ $this->assertEquals('text/html', $headers['Content-type']);
+ }
+
+} \ No newline at end of file