Find this useful? Enter your email to receive occasional updates for securing PHP code.
Signing you up...
Thank you for signing up!
PHP Decode
<?php declare(strict_types=1); namespace Sabre\DAV; use Sabre\HTTP; class ServerPlugin..
Decoded Output download
<?php
declare(strict_types=1);
namespace Sabre\DAV;
use Sabre\HTTP;
class ServerPluginTest extends AbstractServerTestCase
{
/**
* @var TestPlugin
*/
protected $testPlugin;
public function setup(): void
{
parent::setUp();
$testPlugin = new TestPlugin();
$this->server->addPlugin($testPlugin);
$this->testPlugin = $testPlugin;
}
public function testBaseClass()
{
$p = new ServerPluginMock();
self::assertEquals([], $p->getFeatures());
self::assertEquals([], $p->getHTTPMethods(''));
self::assertEquals(
[
'name' => 'Sabre\DAV\ServerPluginMock',
'description' => null,
'link' => null,
], $p->getPluginInfo()
);
}
public function testOptions()
{
$serverVars = [
'REQUEST_URI' => '/',
'REQUEST_METHOD' => 'OPTIONS',
];
$request = HTTP\Sapi::createFromServerArray($serverVars);
$this->server->httpRequest = ($request);
$this->server->exec();
self::assertEquals([
'DAV' => ['1, 3, extended-mkcol, drinking'],
'MS-Author-Via' => ['DAV'],
'Allow' => ['OPTIONS, GET, HEAD, DELETE, PROPFIND, PUT, PROPPATCH, COPY, MOVE, REPORT, BEER, WINE'],
'Accept-Ranges' => ['bytes'],
'Content-Length' => ['0'],
'X-Sabre-Version' => [Version::VERSION],
], $this->response->getHeaders());
self::assertEquals(200, $this->response->status);
self::assertEquals('', $this->response->getBodyAsString());
self::assertEquals('OPTIONS', $this->testPlugin->beforeMethod);
}
public function testGetPlugin()
{
self::assertEquals($this->testPlugin, $this->server->getPlugin(get_class($this->testPlugin)));
}
public function testUnknownPlugin()
{
self::assertNull($this->server->getPlugin('SomeRandomClassName'));
}
public function testGetSupportedReportSet()
{
self::assertEquals([], $this->testPlugin->getSupportedReportSet('/'));
}
public function testGetPlugins()
{
self::assertEquals(
[
get_class($this->testPlugin) => $this->testPlugin,
'core' => $this->server->getPlugin('core'),
],
$this->server->getPlugins()
);
}
}
class ServerPluginMock extends ServerPlugin
{
public function initialize(Server $s)
{
}
}
?>
Did this file decode correctly?
Original Code
<?php
declare(strict_types=1);
namespace Sabre\DAV;
use Sabre\HTTP;
class ServerPluginTest extends AbstractServerTestCase
{
/**
* @var TestPlugin
*/
protected $testPlugin;
public function setup(): void
{
parent::setUp();
$testPlugin = new TestPlugin();
$this->server->addPlugin($testPlugin);
$this->testPlugin = $testPlugin;
}
public function testBaseClass()
{
$p = new ServerPluginMock();
self::assertEquals([], $p->getFeatures());
self::assertEquals([], $p->getHTTPMethods(''));
self::assertEquals(
[
'name' => 'Sabre\DAV\ServerPluginMock',
'description' => null,
'link' => null,
], $p->getPluginInfo()
);
}
public function testOptions()
{
$serverVars = [
'REQUEST_URI' => '/',
'REQUEST_METHOD' => 'OPTIONS',
];
$request = HTTP\Sapi::createFromServerArray($serverVars);
$this->server->httpRequest = ($request);
$this->server->exec();
self::assertEquals([
'DAV' => ['1, 3, extended-mkcol, drinking'],
'MS-Author-Via' => ['DAV'],
'Allow' => ['OPTIONS, GET, HEAD, DELETE, PROPFIND, PUT, PROPPATCH, COPY, MOVE, REPORT, BEER, WINE'],
'Accept-Ranges' => ['bytes'],
'Content-Length' => ['0'],
'X-Sabre-Version' => [Version::VERSION],
], $this->response->getHeaders());
self::assertEquals(200, $this->response->status);
self::assertEquals('', $this->response->getBodyAsString());
self::assertEquals('OPTIONS', $this->testPlugin->beforeMethod);
}
public function testGetPlugin()
{
self::assertEquals($this->testPlugin, $this->server->getPlugin(get_class($this->testPlugin)));
}
public function testUnknownPlugin()
{
self::assertNull($this->server->getPlugin('SomeRandomClassName'));
}
public function testGetSupportedReportSet()
{
self::assertEquals([], $this->testPlugin->getSupportedReportSet('/'));
}
public function testGetPlugins()
{
self::assertEquals(
[
get_class($this->testPlugin) => $this->testPlugin,
'core' => $this->server->getPlugin('core'),
],
$this->server->getPlugins()
);
}
}
class ServerPluginMock extends ServerPlugin
{
public function initialize(Server $s)
{
}
}
Function Calls
None |
Stats
MD5 | dca7c90ced163f7afbe0d38bd32baeb2 |
Eval Count | 0 |
Decode Time | 103 ms |