Tests are now compliant with php-cs-fixer (CamelCase for method, phpdoc valid)
This commit is contained in:
@@ -1,20 +1,24 @@
|
||||
<?php
|
||||
|
||||
/** DomFramework - Tests
|
||||
* @package domframework
|
||||
* @author Dominique Fournier <dominique@fournier38.fr>
|
||||
* @license BSD
|
||||
*/
|
||||
/**
|
||||
* DomFramework - Tests
|
||||
* @package domframework
|
||||
* @author Dominique Fournier <dominique@fournier38.fr>
|
||||
* @license BSD
|
||||
*/
|
||||
|
||||
namespace Domframework\Tests;
|
||||
|
||||
use Domframework\Rest;
|
||||
|
||||
/** Test the domframework REST part */
|
||||
/**
|
||||
* Test the domframework REST part
|
||||
*/
|
||||
class RestTest extends \PHPUnit_Framework_TestCase
|
||||
{
|
||||
/** No param, JSON by default
|
||||
*/
|
||||
/**
|
||||
* No param, JSON by default
|
||||
*/
|
||||
public function testChooseType1()
|
||||
{
|
||||
$rest = new Rest();
|
||||
@@ -22,44 +26,51 @@ class RestTest extends \PHPUnit_Framework_TestCase
|
||||
$this->assertSame($res, "json");
|
||||
}
|
||||
|
||||
/** If limited allowedTypes, return the first one as default
|
||||
*/
|
||||
/**
|
||||
* If limited allowedTypes, return the first one as default
|
||||
*/
|
||||
public function testChooseType2()
|
||||
{
|
||||
$rest = new Rest();
|
||||
$rest->allowedtypes = array ("xml", "csv");
|
||||
$rest->allowedtypes = ["xml", "csv"];
|
||||
$res = $rest->chooseType();
|
||||
$this->assertSame($res, "xml");
|
||||
}
|
||||
|
||||
/** Choose by the user specification : exact match
|
||||
*/
|
||||
/**
|
||||
* Choose by the user specification : exact match
|
||||
*/
|
||||
public function testChooseType3()
|
||||
{
|
||||
$rest = new Rest();
|
||||
$_SERVER["HTTP_ACCEPT"] = "text/html,application/xml;q=0.9,*/*;q=0.8";
|
||||
$_SERVER["HTTP_ACCEPT"] = "text/html,application/xml;q=0.9,
|
||||
*/*;q=0.8";
|
||||
$res = $rest->chooseType();
|
||||
$this->assertSame($res, "xml");
|
||||
}
|
||||
|
||||
/** Choose by the user specification : generic match
|
||||
*/
|
||||
/**
|
||||
* Choose by the user specification : generic match
|
||||
*/
|
||||
public function testChooseType4()
|
||||
{
|
||||
$rest = new Rest();
|
||||
$_SERVER["HTTP_ACCEPT"] = "text/html;q=0.9,*/*;q=0.8";
|
||||
$_SERVER["HTTP_ACCEPT"] = "text/html;q=0.9,
|
||||
*/*;q=0.8";
|
||||
$res = $rest->chooseType();
|
||||
$this->assertSame($res, "json");
|
||||
}
|
||||
|
||||
/** Choose by the user specification : generic match with limited allowed
|
||||
* types
|
||||
*/
|
||||
/**
|
||||
* Choose by the user specification : generic match with limited allowed
|
||||
* types
|
||||
*/
|
||||
public function testChooseType5()
|
||||
{
|
||||
$rest = new Rest();
|
||||
$rest->allowedtypes = array ("xml", "csv");
|
||||
$_SERVER["HTTP_ACCEPT"] = "text/html;q=0.9,*/*;q=0.8";
|
||||
$rest->allowedtypes = ["xml", "csv"];
|
||||
$_SERVER["HTTP_ACCEPT"] = "text/html;q=0.9,
|
||||
*/*;q=0.8";
|
||||
$res = $rest->chooseType();
|
||||
$this->assertSame($res, "xml");
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user