Tests are now compliant with php-cs-fixer (CamelCase for method, phpdoc valid)
This commit is contained in:
@@ -1,67 +1,76 @@
|
||||
<?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\Http;
|
||||
|
||||
/** Test the Http.php file */
|
||||
/**
|
||||
* Test the Http.php file
|
||||
*/
|
||||
class HttpTest extends \PHPUnit_Framework_TestCase
|
||||
{
|
||||
/** bestChoice : exact existing entry
|
||||
*/
|
||||
/**
|
||||
* bestChoice : exact existing entry
|
||||
*/
|
||||
public function testBestChoice1()
|
||||
{
|
||||
$http = new Http();
|
||||
$res = $http->bestChoice(
|
||||
"text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8",
|
||||
array ("application/xml"),
|
||||
"text/html,application/xhtml+xml,application/xml;q=0.9,
|
||||
*/*;q=0.8",
|
||||
["application/xml"],
|
||||
"text/html"
|
||||
);
|
||||
$this->assertSame($res, "application/xml");
|
||||
}
|
||||
|
||||
/** bestChoice : Generic catch.
|
||||
* Use default value
|
||||
*/
|
||||
/**
|
||||
* bestChoice : Generic catch.
|
||||
* Use default value
|
||||
*/
|
||||
public function testBestChoice2()
|
||||
{
|
||||
$http = new Http();
|
||||
$res = $http->bestChoice(
|
||||
"text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8",
|
||||
array ("text/plain"),
|
||||
"text/html,application/xhtml+xml,application/xml;q=0.9,
|
||||
*/*;q=0.8",
|
||||
["text/plain"],
|
||||
"text/html"
|
||||
);
|
||||
$this->assertSame($res, "text/html");
|
||||
}
|
||||
|
||||
/** bestChoice : no solution : use the default value
|
||||
*/
|
||||
/**
|
||||
* bestChoice : no solution : use the default value
|
||||
*/
|
||||
public function testBestChoice3()
|
||||
{
|
||||
$http = new Http();
|
||||
$res = $http->bestChoice(
|
||||
"text/html,application/xhtml+xml,application/xml;q=0.9",
|
||||
array ("text/plain"),
|
||||
["text/plain"],
|
||||
"text/html"
|
||||
);
|
||||
$this->assertSame($res, "text/html");
|
||||
}
|
||||
|
||||
/** bestChoice : invalid entry (end with comma). Continue without error and
|
||||
* skip the bad choices
|
||||
*/
|
||||
/**
|
||||
* bestChoice : invalid entry (end with comma). Continue without error and
|
||||
* skip the bad choices
|
||||
*/
|
||||
public function testBestChoice4()
|
||||
{
|
||||
$http = new Http();
|
||||
$res = $http->bestChoice(
|
||||
"text/html,application/xhtml+xml,application/xml;q=0.9,",
|
||||
array ("text/plain"),
|
||||
["text/plain"],
|
||||
"text/html"
|
||||
);
|
||||
$this->assertSame($res, "text/html");
|
||||
|
||||
Reference in New Issue
Block a user