1
0
mirror of https://github.com/chylex/Nextcloud-News.git synced 2025-08-21 03:54:06 +02:00
Files
.github
.tx
appinfo
bin
css
docs
img
js
l10n
lib
screenshots
templates
tests
Integration
Unit
Command
Controller
Db
Fetcher
Http
TextDownloadResponseTest.php
TextResponseTest.php
Migration
Service
Utility
bootstrap.php
.editorconfig
.gitignore
.mailmap
.travis.yml
AUTHORS.md
CHANGELOG.md
CONTRIBUTING.md
COPYING
Makefile
README.md
composer.json
composer.lock
phpstan.neon.dist
phpunit.integration.xml
phpunit.xml
Nextcloud-News/tests/Unit/Http/TextResponseTest.php
Sean Molenaar 60ab4941cc Move to nextcloud config and update phpunit
Signed-off-by: Sean Molenaar <sean@seanmolenaar.eu>
2020-09-25 19:18:04 +02:00

51 lines
1.1 KiB
PHP

<?php
/**
* Nextcloud - 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 2012 Alessandro Cosentino
* @copyright 2012-2014 Bernhard Posselt
*/
namespace OCA\News\Tests\Unit\Http;
use PHPUnit\Framework\TestCase;
use OCA\News\Http\TextResponse;
class TextResponseTest extends TestCase
{
protected function setUp(): void
{
$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']);
}
}