remove controller serializers

This commit is contained in:
Bernhard Posselt
2014-05-29 19:14:47 +02:00
parent 1c59808517
commit 587a8df566
3 changed files with 4 additions and 68 deletions

View File

@@ -27,15 +27,8 @@ namespace OCP\AppFramework;
use OC\AppFramework\Http\Request;
use OCP\AppFramework\Http\TemplateResponse;
use OCP\AppFramework\Http\JSONResponse;
use OCP\AppFramework\Http\IResponseSerializer;
class ToUpperCaseSerializer implements IResponseSerializer {
public function serialize($response) {
return array(strtoupper($response));
}
}
class ChildController extends Controller {
public function custom($in) {
$this->registerResponder('json', function ($response) {
@@ -44,12 +37,6 @@ class ChildController extends Controller {
return $in;
}
public function serializer($in) {
$this->registerSerializer(new ToUpperCaseSerializer());
return $in;
}
};
class ControllerTest extends \PHPUnit_Framework_TestCase {
@@ -170,16 +157,9 @@ class ControllerTest extends \PHPUnit_Framework_TestCase {
$response = $this->controller->custom('hi');
$response = $this->controller->buildResponse($response, 'json');
$this->assertEquals(array(2), $response->getData());
$this->assertEquals(array(2), $response->getData());
}
public function testCustomSerializer() {
$response = $this->controller->serializer('hi');
$response = $this->controller->buildResponse($response, 'json');
$this->assertEquals(array('HI'), $response->getData());
}
}