updated plugin W3 Total Cache
version 2.3.3
This commit is contained in:
@ -0,0 +1,45 @@
|
||||
<?php
|
||||
|
||||
namespace GuzzleHttp\Tests\Psr7\Integration;
|
||||
|
||||
use GuzzleHttp\Tests\Psr7\BaseTest;
|
||||
|
||||
class ServerRequestFromGlobalsTest extends BaseTest
|
||||
{
|
||||
/**
|
||||
* @before
|
||||
*/
|
||||
protected function setUpTest()
|
||||
{
|
||||
if (false === $this->getServerUri()) {
|
||||
self::markTestSkipped();
|
||||
}
|
||||
parent::setUp();
|
||||
}
|
||||
|
||||
public function testBodyExists()
|
||||
{
|
||||
$curl = curl_init();
|
||||
|
||||
curl_setopt($curl, CURLOPT_URL, $this->getServerUri());
|
||||
curl_setopt($curl, CURLOPT_POST, 1);
|
||||
curl_setopt($curl, CURLOPT_POSTFIELDS, 'foobar');
|
||||
curl_setopt($curl, CURLOPT_RETURNTRANSFER, true);
|
||||
$response = curl_exec($curl);
|
||||
curl_close($curl);
|
||||
|
||||
self::assertNotFalse($response);
|
||||
$data = json_decode($response, true);
|
||||
self::assertIsArray($data);
|
||||
self::assertArrayHasKey('method', $data);
|
||||
self::assertArrayHasKey('uri', $data);
|
||||
self::assertArrayHasKey('body', $data);
|
||||
|
||||
self::assertEquals('foobar', $data['body']);
|
||||
}
|
||||
|
||||
private function getServerUri()
|
||||
{
|
||||
return isset($_SERVER['TEST_SERVER']) ? $_SERVER['TEST_SERVER'] : false;
|
||||
}
|
||||
}
|
13
wp-content/plugins/w3-total-cache/vendor/guzzlehttp/psr7/tests/Integration/server.php
vendored
Normal file
13
wp-content/plugins/w3-total-cache/vendor/guzzlehttp/psr7/tests/Integration/server.php
vendored
Normal file
@ -0,0 +1,13 @@
|
||||
<?php
|
||||
|
||||
require dirname(__DIR__, 2) . '/vendor/autoload.php';
|
||||
|
||||
$request = \GuzzleHttp\Psr7\ServerRequest::fromGlobals();
|
||||
|
||||
$output = [
|
||||
'method' => $request->getMethod(),
|
||||
'uri' => $request->getUri()->__toString(),
|
||||
'body' => $request->getBody()->__toString(),
|
||||
];
|
||||
|
||||
echo json_encode($output);
|
Reference in New Issue
Block a user