apply StyleCI recommendations

This commit is contained in:
El RIDO 2019-01-20 12:28:03 +01:00
parent 79a858f176
commit e3d7ac4442
No known key found for this signature in database
GPG Key ID: 0F5C940A6BD81F92

View File

@ -41,9 +41,9 @@ class RequestTest extends PHPUnit_Framework_TestCase
*/ */
public function getRandomQueryChars() public function getRandomQueryChars()
{ {
$queryChars = '0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ='; $queryChars = '0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ=';
$queryCharCount = strlen($queryChars) - 1; $queryCharCount = strlen($queryChars) - 1;
$resultLength = random_int(1, 10); $resultLength = random_int(1, 10);
$result = ''; $result = '';
for ($i = 0; $i < $resultLength; ++$i) { for ($i = 0; $i < $resultLength; ++$i) {
$result .= $queryChars[random_int(0, $queryCharCount)]; $result .= $queryChars[random_int(0, $queryCharCount)];
@ -63,7 +63,7 @@ class RequestTest extends PHPUnit_Framework_TestCase
public function testRead() public function testRead()
{ {
$this->reset(); $this->reset();
$id = $this->getRandomId(); $id = $this->getRandomId();
$_SERVER['REQUEST_METHOD'] = 'GET'; $_SERVER['REQUEST_METHOD'] = 'GET';
$_SERVER['QUERY_STRING'] = $id; $_SERVER['QUERY_STRING'] = $id;
$request = new Request; $request = new Request;
@ -75,7 +75,7 @@ class RequestTest extends PHPUnit_Framework_TestCase
public function testDelete() public function testDelete()
{ {
$this->reset(); $this->reset();
$id = $this->getRandomId(); $id = $this->getRandomId();
$_SERVER['REQUEST_METHOD'] = 'GET'; $_SERVER['REQUEST_METHOD'] = 'GET';
$_GET['pasteid'] = $id; $_GET['pasteid'] = $id;
$_GET['deletetoken'] = 'bar'; $_GET['deletetoken'] = 'bar';
@ -116,7 +116,7 @@ class RequestTest extends PHPUnit_Framework_TestCase
public function testApiRead() public function testApiRead()
{ {
$this->reset(); $this->reset();
$id = $this->getRandomId(); $id = $this->getRandomId();
$_SERVER['REQUEST_METHOD'] = 'GET'; $_SERVER['REQUEST_METHOD'] = 'GET';
$_SERVER['HTTP_ACCEPT'] = 'application/json, text/javascript, */*; q=0.01'; $_SERVER['HTTP_ACCEPT'] = 'application/json, text/javascript, */*; q=0.01';
$_SERVER['QUERY_STRING'] = $id; $_SERVER['QUERY_STRING'] = $id;
@ -129,7 +129,7 @@ class RequestTest extends PHPUnit_Framework_TestCase
public function testApiDelete() public function testApiDelete()
{ {
$this->reset(); $this->reset();
$id = $this->getRandomId(); $id = $this->getRandomId();
$_SERVER['REQUEST_METHOD'] = 'POST'; $_SERVER['REQUEST_METHOD'] = 'POST';
$_SERVER['HTTP_X_REQUESTED_WITH'] = 'JSONHttpRequest'; $_SERVER['HTTP_X_REQUESTED_WITH'] = 'JSONHttpRequest';
$_SERVER['QUERY_STRING'] = $id; $_SERVER['QUERY_STRING'] = $id;
@ -144,7 +144,7 @@ class RequestTest extends PHPUnit_Framework_TestCase
public function testReadWithNegotiation() public function testReadWithNegotiation()
{ {
$this->reset(); $this->reset();
$id = $this->getRandomId(); $id = $this->getRandomId();
$_SERVER['REQUEST_METHOD'] = 'GET'; $_SERVER['REQUEST_METHOD'] = 'GET';
$_SERVER['HTTP_ACCEPT'] = 'text/html,text/html; charset=UTF-8,application/xhtml+xml, application/xml;q=0.9,*/*;q=0.8, text/csv,application/json'; $_SERVER['HTTP_ACCEPT'] = 'text/html,text/html; charset=UTF-8,application/xhtml+xml, application/xml;q=0.9,*/*;q=0.8, text/csv,application/json';
$_SERVER['QUERY_STRING'] = $id; $_SERVER['QUERY_STRING'] = $id;
@ -157,7 +157,7 @@ class RequestTest extends PHPUnit_Framework_TestCase
public function testReadWithXhtmlNegotiation() public function testReadWithXhtmlNegotiation()
{ {
$this->reset(); $this->reset();
$id = $this->getRandomId(); $id = $this->getRandomId();
$_SERVER['REQUEST_METHOD'] = 'GET'; $_SERVER['REQUEST_METHOD'] = 'GET';
$_SERVER['HTTP_ACCEPT'] = 'application/xhtml+xml,text/html,text/html; charset=UTF-8, application/xml;q=0.9,*/*;q=0.8, text/csv,application/json'; $_SERVER['HTTP_ACCEPT'] = 'application/xhtml+xml,text/html,text/html; charset=UTF-8, application/xml;q=0.9,*/*;q=0.8, text/csv,application/json';
$_SERVER['QUERY_STRING'] = $id; $_SERVER['QUERY_STRING'] = $id;
@ -170,7 +170,7 @@ class RequestTest extends PHPUnit_Framework_TestCase
public function testApiReadWithNegotiation() public function testApiReadWithNegotiation()
{ {
$this->reset(); $this->reset();
$id = $this->getRandomId(); $id = $this->getRandomId();
$_SERVER['REQUEST_METHOD'] = 'GET'; $_SERVER['REQUEST_METHOD'] = 'GET';
$_SERVER['HTTP_ACCEPT'] = 'text/plain,text/csv, application/xml;q=0.9, application/json, text/html,text/html; charset=UTF-8,application/xhtml+xml, */*;q=0.8'; $_SERVER['HTTP_ACCEPT'] = 'text/plain,text/csv, application/xml;q=0.9, application/json, text/html,text/html; charset=UTF-8,application/xhtml+xml, */*;q=0.8';
$_SERVER['QUERY_STRING'] = $id; $_SERVER['QUERY_STRING'] = $id;
@ -183,7 +183,7 @@ class RequestTest extends PHPUnit_Framework_TestCase
public function testReadWithFailedNegotiation() public function testReadWithFailedNegotiation()
{ {
$this->reset(); $this->reset();
$id = $this->getRandomId(); $id = $this->getRandomId();
$_SERVER['REQUEST_METHOD'] = 'GET'; $_SERVER['REQUEST_METHOD'] = 'GET';
$_SERVER['HTTP_ACCEPT'] = 'text/plain,text/csv, application/xml;q=0.9, */*;q=0.8'; $_SERVER['HTTP_ACCEPT'] = 'text/plain,text/csv, application/xml;q=0.9, */*;q=0.8';
$_SERVER['QUERY_STRING'] = $id; $_SERVER['QUERY_STRING'] = $id;
@ -196,8 +196,8 @@ class RequestTest extends PHPUnit_Framework_TestCase
public function testPasteIdExtraction() public function testPasteIdExtraction()
{ {
$this->reset(); $this->reset();
$id = $this->getRandomId(); $id = $this->getRandomId();
$queryParams = array($id); $queryParams = array($id);
$queryParamCount = random_int(1, 5); $queryParamCount = random_int(1, 5);
for ($i = 0; $i < $queryParamCount; ++$i) { for ($i = 0; $i < $queryParamCount; ++$i) {
array_push($queryParams, $this->getRandomQueryChars()); array_push($queryParams, $this->getRandomQueryChars());