Update ServerRequest:: addUploadedFilesToBranch to allow associate array at last level of $_FILES
This commit is contained in:
parent
a93b37a548
commit
81055c3bd9
|
|
@ -186,7 +186,7 @@ class ServerRequest extends Request implements ServerRequestInterface
|
||||||
/**
|
/**
|
||||||
* Create a new instance with the specified uploaded files.
|
* Create a new instance with the specified uploaded files.
|
||||||
*
|
*
|
||||||
* @param array An array tree of UploadedFileInterface instances.
|
* @param array $uploadedFiles An array tree of UploadedFileInterface instances.
|
||||||
* @return self
|
* @return self
|
||||||
* @throws \InvalidArgumentException if an invalid structure is provided.
|
* @throws \InvalidArgumentException if an invalid structure is provided.
|
||||||
*/
|
*/
|
||||||
|
|
@ -377,25 +377,32 @@ class ServerRequest extends Request implements ServerRequestInterface
|
||||||
|
|
||||||
protected function addUploadedFilesToBranch(&$branch, $name, $value)
|
protected function addUploadedFilesToBranch(&$branch, $name, $value)
|
||||||
{
|
{
|
||||||
|
// Check for each of the expected keys.
|
||||||
if (isset($value["name"], $value["type"], $value["tmp_name"], $value["error"], $value["size"])) {
|
if (isset($value["name"], $value["type"], $value["tmp_name"], $value["error"], $value["size"])) {
|
||||||
// This is a file. It may be a single file, or a list of files.
|
// This is a file. It may be a single file, or a list of files.
|
||||||
|
|
||||||
// Check if the "name" element is a list array.
|
// Check if these items are arrays.
|
||||||
if (is_array($value["name"]) && (array_keys($value["name"]) === range(0, count($value["name"]) - 1))) {
|
if (is_array($value["name"])
|
||||||
$list = [];
|
&& is_array($value["type"])
|
||||||
for ($index = 0, $u = count($value["name"]); $index < $u; ++$index) {
|
&& is_array($value["tmp_name"])
|
||||||
$uploadedFile = new UploadedFile(
|
&& is_array($value["error"])
|
||||||
$value["name"][$index],
|
&& is_array($value["size"])
|
||||||
$value["type"][$index],
|
) {
|
||||||
$value["size"][$index],
|
// Each item is an array. This is a list of uploaded files.
|
||||||
$value["tmp_name"][$index],
|
$files = [];
|
||||||
$value["error"][$index]
|
$keys = array_keys($value["name"]);
|
||||||
|
foreach ($keys as $key) {
|
||||||
|
$files[$key] = new UploadedFile(
|
||||||
|
$value["name"][$key],
|
||||||
|
$value["type"][$key],
|
||||||
|
$value["size"][$key],
|
||||||
|
$value["tmp_name"][$key],
|
||||||
|
$value["error"][$key]
|
||||||
);
|
);
|
||||||
$list[] = $uploadedFile;
|
|
||||||
}
|
}
|
||||||
$branch[$name] = $list;
|
$branch[$name] = $files;
|
||||||
} else {
|
} else {
|
||||||
// All expected keys are present. This is an uploaded file.
|
// All expected keys are present and are not arrays. This is an uploaded file.
|
||||||
$uploadedFile = new UploadedFile(
|
$uploadedFile = new UploadedFile(
|
||||||
$value["name"], $value["type"], $value["size"], $value["tmp_name"], $value["error"]
|
$value["name"], $value["type"], $value["size"], $value["tmp_name"], $value["error"]
|
||||||
);
|
);
|
||||||
|
|
@ -437,6 +444,7 @@ class ServerRequest extends Request implements ServerRequestInterface
|
||||||
* Return a reference to the singleton instance of the Request derived
|
* Return a reference to the singleton instance of the Request derived
|
||||||
* from the server's information about the request sent to the server.
|
* from the server's information about the request sent to the server.
|
||||||
*
|
*
|
||||||
|
* @param array $attributes Key-value pairs to add to the request.
|
||||||
* @return self
|
* @return self
|
||||||
* @static
|
* @static
|
||||||
*/
|
*/
|
||||||
|
|
|
||||||
|
|
@ -6,7 +6,11 @@ use WellRESTed\Message\ServerRequest;
|
||||||
use WellRESTed\Message\UploadedFile;
|
use WellRESTed\Message\UploadedFile;
|
||||||
use WellRESTed\Message\Uri;
|
use WellRESTed\Message\Uri;
|
||||||
|
|
||||||
|
// TODO Test nested $_FILES with associative array for last level
|
||||||
|
// TODO Remove concrete class used for testing
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
* @coversDefaultClass WellRESTed\Message\ServerRequest
|
||||||
* @uses WellRESTed\Message\ServerRequest
|
* @uses WellRESTed\Message\ServerRequest
|
||||||
* @uses WellRESTed\Message\Request
|
* @uses WellRESTed\Message\Request
|
||||||
* @uses WellRESTed\Message\Message
|
* @uses WellRESTed\Message\Message
|
||||||
|
|
@ -21,7 +25,7 @@ class ServerRequestTest extends \PHPUnit_Framework_TestCase
|
||||||
// Construction and Marshalling
|
// Construction and Marshalling
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @covers WellRESTed\Message\ServerRequest::__construct
|
* @covers ::__construct
|
||||||
*/
|
*/
|
||||||
public function testCreatesInstance()
|
public function testCreatesInstance()
|
||||||
{
|
{
|
||||||
|
|
@ -30,10 +34,10 @@ class ServerRequestTest extends \PHPUnit_Framework_TestCase
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @covers WellRESTed\Message\ServerRequest::getServerRequest
|
* @covers ::getServerRequest
|
||||||
* @covers WellRESTed\Message\ServerRequest::getServerRequestHeaders
|
* @covers ::getServerRequestHeaders
|
||||||
* @covers WellRESTed\Message\ServerRequest::readFromServerRequest
|
* @covers ::readFromServerRequest
|
||||||
* @covers WellRESTed\Message\ServerRequest::getStreamForBody
|
* @covers ::getStreamForBody
|
||||||
* @preserveGlobalState disabled
|
* @preserveGlobalState disabled
|
||||||
*/
|
*/
|
||||||
public function testGetServerRequestReadsFromRequest()
|
public function testGetServerRequestReadsFromRequest()
|
||||||
|
|
@ -61,7 +65,7 @@ class ServerRequestTest extends \PHPUnit_Framework_TestCase
|
||||||
// Request
|
// Request
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @covers WellRESTed\Message\ServerRequest::readFromServerRequest
|
* @covers ::readFromServerRequest
|
||||||
* @preserveGlobalState disabled
|
* @preserveGlobalState disabled
|
||||||
* @dataProvider protocolVersionProvider
|
* @dataProvider protocolVersionProvider
|
||||||
*/
|
*/
|
||||||
|
|
@ -87,7 +91,7 @@ class ServerRequestTest extends \PHPUnit_Framework_TestCase
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @covers WellRESTed\Message\ServerRequest::readFromServerRequest
|
* @covers ::readFromServerRequest
|
||||||
* @preserveGlobalState disabled
|
* @preserveGlobalState disabled
|
||||||
* @dataProvider methodProvider
|
* @dataProvider methodProvider
|
||||||
*/
|
*/
|
||||||
|
|
@ -114,7 +118,7 @@ class ServerRequestTest extends \PHPUnit_Framework_TestCase
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @covers WellRESTed\Message\ServerRequest::readFromServerRequest
|
* @covers ::readFromServerRequest
|
||||||
* @preserveGlobalState disabled
|
* @preserveGlobalState disabled
|
||||||
* @dataProvider requestTargetProvider
|
* @dataProvider requestTargetProvider
|
||||||
*/
|
*/
|
||||||
|
|
@ -139,7 +143,7 @@ class ServerRequestTest extends \PHPUnit_Framework_TestCase
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @covers WellRESTed\Message\ServerRequest::getHeader
|
* @covers ::getHeader
|
||||||
* @depends testGetServerRequestReadsFromRequest
|
* @depends testGetServerRequestReadsFromRequest
|
||||||
*/
|
*/
|
||||||
public function testServerRequestProvidesHeaders($request)
|
public function testServerRequestProvidesHeaders($request)
|
||||||
|
|
@ -149,7 +153,7 @@ class ServerRequestTest extends \PHPUnit_Framework_TestCase
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @covers WellRESTed\Message\ServerRequest::getBody
|
* @covers ::getBody
|
||||||
*/
|
*/
|
||||||
public function testServerRequestProvidesBody()
|
public function testServerRequestProvidesBody()
|
||||||
{
|
{
|
||||||
|
|
@ -163,7 +167,7 @@ class ServerRequestTest extends \PHPUnit_Framework_TestCase
|
||||||
// Server Params
|
// Server Params
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @covers WellRESTed\Message\ServerRequest::getServerParams
|
* @covers ::getServerParams
|
||||||
*/
|
*/
|
||||||
public function testServerParamsIsEmptyByDefault()
|
public function testServerParamsIsEmptyByDefault()
|
||||||
{
|
{
|
||||||
|
|
@ -172,7 +176,7 @@ class ServerRequestTest extends \PHPUnit_Framework_TestCase
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @covers WellRESTed\Message\ServerRequest::getServerParams
|
* @covers ::getServerParams
|
||||||
* @depends testGetServerRequestReadsFromRequest
|
* @depends testGetServerRequestReadsFromRequest
|
||||||
*/
|
*/
|
||||||
public function testServerRequestProvidesServerParams($request)
|
public function testServerRequestProvidesServerParams($request)
|
||||||
|
|
@ -185,7 +189,7 @@ class ServerRequestTest extends \PHPUnit_Framework_TestCase
|
||||||
// Cookies
|
// Cookies
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @covers WellRESTed\Message\ServerRequest::getCookieParams
|
* @covers ::getCookieParams
|
||||||
*/
|
*/
|
||||||
public function testCookieParamsIsEmptyByDefault()
|
public function testCookieParamsIsEmptyByDefault()
|
||||||
{
|
{
|
||||||
|
|
@ -194,7 +198,7 @@ class ServerRequestTest extends \PHPUnit_Framework_TestCase
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @covers WellRESTed\Message\ServerRequest::getCookieParams
|
* @covers ::getCookieParams
|
||||||
* @depends testGetServerRequestReadsFromRequest
|
* @depends testGetServerRequestReadsFromRequest
|
||||||
*/
|
*/
|
||||||
public function testServerRequestProvidesCookieParams($request)
|
public function testServerRequestProvidesCookieParams($request)
|
||||||
|
|
@ -204,7 +208,7 @@ class ServerRequestTest extends \PHPUnit_Framework_TestCase
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @covers WellRESTed\Message\ServerRequest::withCookieParams
|
* @covers ::withCookieParams
|
||||||
* @depends testGetServerRequestReadsFromRequest
|
* @depends testGetServerRequestReadsFromRequest
|
||||||
*/
|
*/
|
||||||
public function testWithCookieParamsCreatesNewInstance($request1)
|
public function testWithCookieParamsCreatesNewInstance($request1)
|
||||||
|
|
@ -221,7 +225,7 @@ class ServerRequestTest extends \PHPUnit_Framework_TestCase
|
||||||
// Query
|
// Query
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @covers WellRESTed\Message\ServerRequest::getQueryParams
|
* @covers ::getQueryParams
|
||||||
*/
|
*/
|
||||||
public function testQueryParamsIsEmptyByDefault()
|
public function testQueryParamsIsEmptyByDefault()
|
||||||
{
|
{
|
||||||
|
|
@ -230,7 +234,7 @@ class ServerRequestTest extends \PHPUnit_Framework_TestCase
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @covers WellRESTed\Message\ServerRequest::getQueryParams
|
* @covers ::getQueryParams
|
||||||
* @depends testGetServerRequestReadsFromRequest
|
* @depends testGetServerRequestReadsFromRequest
|
||||||
*/
|
*/
|
||||||
public function testServerRequestProvidesQueryParams($request)
|
public function testServerRequestProvidesQueryParams($request)
|
||||||
|
|
@ -240,7 +244,7 @@ class ServerRequestTest extends \PHPUnit_Framework_TestCase
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @covers WellRESTed\Message\ServerRequest::withQueryParams
|
* @covers ::withQueryParams
|
||||||
* @depends testGetServerRequestReadsFromRequest
|
* @depends testGetServerRequestReadsFromRequest
|
||||||
*/
|
*/
|
||||||
public function testWithQueryParamsCreatesNewInstance($request1)
|
public function testWithQueryParamsCreatesNewInstance($request1)
|
||||||
|
|
@ -257,7 +261,7 @@ class ServerRequestTest extends \PHPUnit_Framework_TestCase
|
||||||
// Uploaded Files
|
// Uploaded Files
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @covers WellRESTed\Message\ServerRequest::getUploadedFiles
|
* @covers ::getUploadedFiles
|
||||||
*/
|
*/
|
||||||
public function testUploadedFilesIsEmptyByDefault()
|
public function testUploadedFilesIsEmptyByDefault()
|
||||||
{
|
{
|
||||||
|
|
@ -266,7 +270,7 @@ class ServerRequestTest extends \PHPUnit_Framework_TestCase
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @covers WellRESTed\Message\ServerRequest::getUploadedFiles
|
* @covers ::getUploadedFiles
|
||||||
* @preserveGlobalState disabled
|
* @preserveGlobalState disabled
|
||||||
*/
|
*/
|
||||||
public function testGetUploadedFilesReturnsEmptyArrayWhenNoFilesAreUploaded()
|
public function testGetUploadedFilesReturnsEmptyArrayWhenNoFilesAreUploaded()
|
||||||
|
|
@ -282,10 +286,10 @@ class ServerRequestTest extends \PHPUnit_Framework_TestCase
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @covers WellRESTed\Message\ServerRequest::getServerRequest
|
* @covers ::getServerRequest
|
||||||
* @covers WellRESTed\Message\ServerRequest::readUploadedFiles
|
* @covers ::readUploadedFiles
|
||||||
* @covers WellRESTed\Message\ServerRequest::getUploadedFiles
|
* @covers ::getUploadedFiles
|
||||||
* @covers WellRESTed\Message\ServerRequest::addUploadedFilesToBranch
|
* @covers ::addUploadedFilesToBranch
|
||||||
* @preserveGlobalState disabled
|
* @preserveGlobalState disabled
|
||||||
* @dataProvider uploadedFileProvider
|
* @dataProvider uploadedFileProvider
|
||||||
*/
|
*/
|
||||||
|
|
@ -341,6 +345,30 @@ class ServerRequestTest extends \PHPUnit_Framework_TestCase
|
||||||
2 => 0
|
2 => 0
|
||||||
]
|
]
|
||||||
]
|
]
|
||||||
|
],
|
||||||
|
"nestedDictionary" => [
|
||||||
|
"level2" => [
|
||||||
|
"name" => [
|
||||||
|
"file0" => "nestedDictionary0.jpg",
|
||||||
|
"file1" => "nestedDictionary1.jpg"
|
||||||
|
],
|
||||||
|
"type" => [
|
||||||
|
"file0" => "image/png",
|
||||||
|
"file1" => "image/png"
|
||||||
|
],
|
||||||
|
"tmp_name" => [
|
||||||
|
"file0" => "/tmp/phppng0",
|
||||||
|
"file1" => "/tmp/phppng1"
|
||||||
|
],
|
||||||
|
"error" => [
|
||||||
|
"file0" => UPLOAD_ERR_OK,
|
||||||
|
"file1" => UPLOAD_ERR_OK
|
||||||
|
],
|
||||||
|
"size" => [
|
||||||
|
"file0" => 256,
|
||||||
|
"file1" => 4096
|
||||||
|
]
|
||||||
|
]
|
||||||
]
|
]
|
||||||
];
|
];
|
||||||
$request = ServerRequest::getServerRequest();
|
$request = ServerRequest::getServerRequest();
|
||||||
|
|
@ -358,13 +386,16 @@ class ServerRequestTest extends \PHPUnit_Framework_TestCase
|
||||||
[new UploadedFile("nested.json", "application/json", 1024, "/tmp/phpadhjk", UPLOAD_ERR_OK), ["nested", "level2"]],
|
[new UploadedFile("nested.json", "application/json", 1024, "/tmp/phpadhjk", UPLOAD_ERR_OK), ["nested", "level2"]],
|
||||||
[new UploadedFile("nestedList0.jpg", "image/jpeg", 256, "/tmp/phpjpg0", UPLOAD_ERR_OK), ["nestedList", "level2", 0]],
|
[new UploadedFile("nestedList0.jpg", "image/jpeg", 256, "/tmp/phpjpg0", UPLOAD_ERR_OK), ["nestedList", "level2", 0]],
|
||||||
[new UploadedFile("nestedList1.jpg", "image/jpeg", 4096, "/tmp/phpjpg1", UPLOAD_ERR_OK), ["nestedList", "level2", 1]],
|
[new UploadedFile("nestedList1.jpg", "image/jpeg", 4096, "/tmp/phpjpg1", UPLOAD_ERR_OK), ["nestedList", "level2", 1]],
|
||||||
[new UploadedFile("", "", 0, "", UPLOAD_ERR_NO_FILE), ["nestedList", "level2", 2]]
|
[new UploadedFile("", "", 0, "", UPLOAD_ERR_NO_FILE), ["nestedList", "level2", 2]],
|
||||||
|
[new UploadedFile("nestedDictionary0.jpg", "image/png", 256, "/tmp/phppng0", UPLOAD_ERR_OK), ["nestedDictionary", "level2", "file0"]],
|
||||||
|
[new UploadedFile("nestedDictionary1.jpg", "image/png", 4096, "/tmp/phppngg1", UPLOAD_ERR_OK), ["nestedDictionary", "level2", "file1"]]
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @covers WellRESTed\Message\ServerRequest::withUploadedFiles
|
* @covers ::withUploadedFiles
|
||||||
* @covers WellRESTed\Message\ServerRequest::isValidUploadedFilesTree
|
* @covers ::isValidUploadedFilesBranch
|
||||||
|
* @covers ::isValidUploadedFilesTree
|
||||||
*/
|
*/
|
||||||
public function testWithUploadedFilesCreatesNewInstance()
|
public function testWithUploadedFilesCreatesNewInstance()
|
||||||
{
|
{
|
||||||
|
|
@ -378,8 +409,9 @@ class ServerRequestTest extends \PHPUnit_Framework_TestCase
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @covers WellRESTed\Message\ServerRequest::withUploadedFiles
|
* @covers ::withUploadedFiles
|
||||||
* @covers WellRESTed\Message\ServerRequest::isValidUploadedFilesTree
|
* @covers ::isValidUploadedFilesTree
|
||||||
|
* @covers ::isValidUploadedFilesBranch
|
||||||
* @dataProvider validUploadedFilesProvider
|
* @dataProvider validUploadedFilesProvider
|
||||||
*/
|
*/
|
||||||
public function testWithUploadedFilesReturnsPassedUploadedFiles($uploadedFiles)
|
public function testWithUploadedFilesReturnsPassedUploadedFiles($uploadedFiles)
|
||||||
|
|
@ -402,13 +434,19 @@ class ServerRequestTest extends \PHPUnit_Framework_TestCase
|
||||||
new UploadedFile("file1.html", "text/html", 524, "/tmp/php9hNlHe", 0),
|
new UploadedFile("file1.html", "text/html", 524, "/tmp/php9hNlHe", 0),
|
||||||
new UploadedFile("file2.html", "text/html", 524, "/tmp/php9hNshj", 0)
|
new UploadedFile("file2.html", "text/html", 524, "/tmp/php9hNshj", 0)
|
||||||
]
|
]
|
||||||
|
]]],
|
||||||
|
[["nestedDictionary" => [
|
||||||
|
"level2" => [
|
||||||
|
"file1" => new UploadedFile("file1.html", "text/html", 524, "/tmp/php9hNlHe", 0),
|
||||||
|
"file2" => new UploadedFile("file2.html", "text/html", 524, "/tmp/php9hNshj", 0)
|
||||||
|
]
|
||||||
]]]
|
]]]
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @covers WellRESTed\Message\ServerRequest::withUploadedFiles
|
* @covers ::withUploadedFiles
|
||||||
* @covers WellRESTed\Message\ServerRequest::isValidUploadedFilesTree
|
* @covers ::isValidUploadedFilesTree
|
||||||
* @expectedException \InvalidArgumentException
|
* @expectedException \InvalidArgumentException
|
||||||
* @dataProvider invalidUploadedFilesProvider
|
* @dataProvider invalidUploadedFilesProvider
|
||||||
*/
|
*/
|
||||||
|
|
@ -481,7 +519,7 @@ class ServerRequestTest extends \PHPUnit_Framework_TestCase
|
||||||
// Parsed Body
|
// Parsed Body
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @covers WellRESTed\Message\ServerRequest::getParsedBody
|
* @covers ::getParsedBody
|
||||||
*/
|
*/
|
||||||
public function testParsedBodyIsNullByDefault()
|
public function testParsedBodyIsNullByDefault()
|
||||||
{
|
{
|
||||||
|
|
@ -490,8 +528,8 @@ class ServerRequestTest extends \PHPUnit_Framework_TestCase
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @covers WellRESTed\Message\ServerRequest::getServerRequest
|
* @covers ::getServerRequest
|
||||||
* @covers WellRESTed\Message\ServerRequest::getParsedBody
|
* @covers ::getParsedBody
|
||||||
* @preserveGlobalState disabled
|
* @preserveGlobalState disabled
|
||||||
* @dataProvider formContentTypeProvider
|
* @dataProvider formContentTypeProvider
|
||||||
*/
|
*/
|
||||||
|
|
@ -519,7 +557,7 @@ class ServerRequestTest extends \PHPUnit_Framework_TestCase
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @covers WellRESTed\Message\ServerRequest::withParsedBody
|
* @covers ::withParsedBody
|
||||||
* @depends testGetServerRequestReadsFromRequest
|
* @depends testGetServerRequestReadsFromRequest
|
||||||
*/
|
*/
|
||||||
public function testWithParsedBodyCreatesNewInstance($request1)
|
public function testWithParsedBodyCreatesNewInstance($request1)
|
||||||
|
|
@ -537,7 +575,7 @@ class ServerRequestTest extends \PHPUnit_Framework_TestCase
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @covers WellRESTed\Message\ServerRequest::withParsedBody
|
* @covers ::withParsedBody
|
||||||
* @expectedException \InvalidArgumentException
|
* @expectedException \InvalidArgumentException
|
||||||
* @dataProvider invalidParsedBodyProvider
|
* @dataProvider invalidParsedBodyProvider
|
||||||
*/
|
*/
|
||||||
|
|
@ -556,7 +594,7 @@ class ServerRequestTest extends \PHPUnit_Framework_TestCase
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @covers WellRESTed\Message\ServerRequest::__clone
|
* @covers ::__clone
|
||||||
*/
|
*/
|
||||||
public function testCloneMakesDeepCopiesOfParsedBody()
|
public function testCloneMakesDeepCopiesOfParsedBody()
|
||||||
{
|
{
|
||||||
|
|
@ -575,7 +613,7 @@ class ServerRequestTest extends \PHPUnit_Framework_TestCase
|
||||||
// Attributes
|
// Attributes
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @covers WellRESTed\Message\ServerRequest::getAttributes
|
* @covers ::getAttributes
|
||||||
*/
|
*/
|
||||||
public function testAttributesIsEmptyByDefault()
|
public function testAttributesIsEmptyByDefault()
|
||||||
{
|
{
|
||||||
|
|
@ -584,7 +622,7 @@ class ServerRequestTest extends \PHPUnit_Framework_TestCase
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @covers WellRESTed\Message\ServerRequest::getAttribute
|
* @covers ::getAttribute
|
||||||
* @depends testGetServerRequestReadsFromRequest
|
* @depends testGetServerRequestReadsFromRequest
|
||||||
*/
|
*/
|
||||||
public function testServerRequestProvidesAttributesIfPassed($request)
|
public function testServerRequestProvidesAttributesIfPassed($request)
|
||||||
|
|
@ -594,7 +632,7 @@ class ServerRequestTest extends \PHPUnit_Framework_TestCase
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @covers WellRESTed\Message\ServerRequest::getAttribute
|
* @covers ::getAttribute
|
||||||
*/
|
*/
|
||||||
public function testGetAttributeReturnsDefaultIfNotSet()
|
public function testGetAttributeReturnsDefaultIfNotSet()
|
||||||
{
|
{
|
||||||
|
|
@ -603,8 +641,8 @@ class ServerRequestTest extends \PHPUnit_Framework_TestCase
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @covers WellRESTed\Message\ServerRequest::withAttribute
|
* @covers ::withAttribute
|
||||||
* @covers WellRESTed\Message\ServerRequest::getAttribute
|
* @covers ::getAttribute
|
||||||
*/
|
*/
|
||||||
public function testWithAttributeCreatesNewInstance()
|
public function testWithAttributeCreatesNewInstance()
|
||||||
{
|
{
|
||||||
|
|
@ -614,7 +652,7 @@ class ServerRequestTest extends \PHPUnit_Framework_TestCase
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @covers WellRESTed\Message\ServerRequest::withAttribute
|
* @covers ::withAttribute
|
||||||
*/
|
*/
|
||||||
public function testWithAttributePreserversOtherAttributes()
|
public function testWithAttributePreserversOtherAttributes()
|
||||||
{
|
{
|
||||||
|
|
@ -626,7 +664,7 @@ class ServerRequestTest extends \PHPUnit_Framework_TestCase
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @covers WellRESTed\Message\ServerRequest::withoutAttribute
|
* @covers ::withoutAttribute
|
||||||
*/
|
*/
|
||||||
public function testWithoutAttributeCreatesNewInstance()
|
public function testWithoutAttributeCreatesNewInstance()
|
||||||
{
|
{
|
||||||
|
|
@ -637,7 +675,7 @@ class ServerRequestTest extends \PHPUnit_Framework_TestCase
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @covers WellRESTed\Message\ServerRequest::withoutAttribute
|
* @covers ::withoutAttribute
|
||||||
*/
|
*/
|
||||||
public function testWithoutAttributePreservesOtherAttributes()
|
public function testWithoutAttributePreservesOtherAttributes()
|
||||||
{
|
{
|
||||||
|
|
@ -650,7 +688,7 @@ class ServerRequestTest extends \PHPUnit_Framework_TestCase
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @covers WellRESTed\Message\ServerRequest::getAttributes
|
* @covers ::getAttributes
|
||||||
*/
|
*/
|
||||||
public function testGetAttributesReturnsAllAttributes()
|
public function testGetAttributesReturnsAllAttributes()
|
||||||
{
|
{
|
||||||
|
|
@ -666,10 +704,10 @@ class ServerRequestTest extends \PHPUnit_Framework_TestCase
|
||||||
// URI
|
// URI
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @covers WellRESTed\Message\ServerRequest::getServerRequest
|
* @covers ::getServerRequest
|
||||||
* @covers WellRESTed\Message\ServerRequest::getServerRequestHeaders
|
* @covers ::getServerRequestHeaders
|
||||||
* @covers WellRESTed\Message\ServerRequest::readFromServerRequest
|
* @covers ::readFromServerRequest
|
||||||
* @covers WellRESTed\Message\ServerRequest::readUri
|
* @covers ::readUri
|
||||||
* @preserveGlobalState disabled
|
* @preserveGlobalState disabled
|
||||||
* @dataProvider uriProvider
|
* @dataProvider uriProvider
|
||||||
*/
|
*/
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue