зеркало из https://github.com/nextcloud/news.git
remove more tests of classes that are now in core
This commit is contained in:
Родитель
f116d5a915
Коммит
39d1eeb119
|
@ -1,69 +0,0 @@
|
|||
<?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\Middleware;
|
||||
|
||||
use OCP\IRequest;
|
||||
use OCP\AppFramework\Http\Response;
|
||||
|
||||
use OCA\News\Utility\ControllerTestUtility;
|
||||
|
||||
require_once(__DIR__ . "/../../classloader.php");
|
||||
|
||||
|
||||
class CORSMiddlewareTest extends ControllerTestUtility {
|
||||
|
||||
|
||||
/**
|
||||
* @API
|
||||
*/
|
||||
public function testSetCORSAPIHeader() {
|
||||
$request = $this->getRequest(
|
||||
array('server' => array('HTTP_ORIGIN' => 'test'))
|
||||
);
|
||||
$middleware = new CORSMiddleware($request);
|
||||
$response = $middleware->afterController('\OCA\News\Middleware\CORSMiddlewareTest',
|
||||
'testSetCORSAPIHeader',
|
||||
new Response());
|
||||
$headers = $response->getHeaders();
|
||||
|
||||
$this->assertEquals('test', $headers['Access-Control-Allow-Origin']);
|
||||
}
|
||||
|
||||
|
||||
public function testNoAPINoCORSHEADER() {
|
||||
$request = $this->getRequest();
|
||||
$middleware = new CORSMiddleware($request);
|
||||
$response = $middleware->afterController('\OCA\News\Middleware\CORSMiddlewareTest',
|
||||
'testNoAPINoCORSHEADER',
|
||||
new Response());
|
||||
$headers = $response->getHeaders();
|
||||
$this->assertFalse(array_key_exists('Access-Control-Allow-Origin', $headers));
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @API
|
||||
*/
|
||||
public function testNoOriginHeaderNoCORSHEADER() {
|
||||
$request = $this->getRequest();
|
||||
$middleware = new CORSMiddleware($request);
|
||||
$response = $middleware->afterController('\OCA\News\Middleware\CORSMiddlewareTest',
|
||||
'testNoOriginHeaderNoCORSHEADER',
|
||||
new Response());
|
||||
$headers = $response->getHeaders();
|
||||
$this->assertFalse(array_key_exists('Access-Control-Allow-Origin', $headers));
|
||||
}
|
||||
|
||||
}
|
|
@ -1,48 +0,0 @@
|
|||
<?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\Utility;
|
||||
|
||||
|
||||
require_once(__DIR__ . "/../../classloader.php");
|
||||
|
||||
|
||||
class MethodAnnotationReaderTest extends \PHPUnit_Framework_TestCase {
|
||||
|
||||
|
||||
/**
|
||||
* @Annotation
|
||||
*/
|
||||
public function testReadAnnotation(){
|
||||
$reader = new MethodAnnotationReader('\OCA\News\Utility\MethodAnnotationReaderTest',
|
||||
'testReadAnnotation');
|
||||
|
||||
$this->assertTrue($reader->hasAnnotation('Annotation'));
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @Annotation
|
||||
* @param test
|
||||
*/
|
||||
public function testReadAnnotationNoLowercase(){
|
||||
$reader = new MethodAnnotationReader('\OCA\News\Utility\MethodAnnotationReaderTest',
|
||||
'testReadAnnotationNoLowercase');
|
||||
|
||||
$this->assertTrue($reader->hasAnnotation('Annotation'));
|
||||
$this->assertFalse($reader->hasAnnotation('param'));
|
||||
}
|
||||
|
||||
|
||||
}
|
Загрузка…
Ссылка в новой задаче