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 namespace Roundcube\Tests\Actions\Mail; use Roundcube\Tests\ActionTestCase; use Ro..
Decoded Output download
<?php
namespace Roundcube\Tests\Actions\Mail;
use Roundcube\Tests\ActionTestCase;
use Roundcube\Tests\OutputJsonMock;
/**
* Test class to test rcmail_action_mail_attachment_rename
*/
class AttachmentRenameTest extends ActionTestCase
{
/**
* Test uploaded attachment rename
*/
public function test_run()
{
$rcmail =
cmail::get_instance();
$action = new
cmail_action_mail_attachment_rename();
$output = $this->initOutput(
cmail_action::MODE_AJAX, 'mail', 'rename-attachment');
$this->assertInstanceOf(
cmail_action::class, $action);
$this->assertTrue($action->checks());
// First we create the upload record
$file = $this->fileUpload('100');
$_SERVER['REQUEST_METHOD'] = 'POST';
$_SESSION = ['compose_data_100' => ['test' => 'test']];
// Invoke the rename action
$_POST = ['_id' => '100', '_file' => 'rcmfile' . $file['id'], '_name' => 'mod.gif'];
$this->runAndAssert($action, OutputJsonMock::E_EXIT);
$result = $output->getOutput();
$this->assertSame(['Content-Type: application/json; charset=UTF-8'], $output->headers);
$this->assertSame('rename-attachment', $result['action']);
$this->assertSame('this.rename_attachment_handler("rcmfile' . $file['id'] . '","mod.gif");', trim($result['exec']));
$upload = $rcmail->get_uploaded_file($file['id']);
$this->assertSame($_POST['_name'], $upload['name']);
$this->assertSame($_POST['_id'], $upload['group']);
}
}
?>
Did this file decode correctly?
Original Code
<?php
namespace Roundcube\Tests\Actions\Mail;
use Roundcube\Tests\ActionTestCase;
use Roundcube\Tests\OutputJsonMock;
/**
* Test class to test rcmail_action_mail_attachment_rename
*/
class AttachmentRenameTest extends ActionTestCase
{
/**
* Test uploaded attachment rename
*/
public function test_run()
{
$rcmail = \rcmail::get_instance();
$action = new \rcmail_action_mail_attachment_rename();
$output = $this->initOutput(\rcmail_action::MODE_AJAX, 'mail', 'rename-attachment');
$this->assertInstanceOf(\rcmail_action::class, $action);
$this->assertTrue($action->checks());
// First we create the upload record
$file = $this->fileUpload('100');
$_SERVER['REQUEST_METHOD'] = 'POST';
$_SESSION = ['compose_data_100' => ['test' => 'test']];
// Invoke the rename action
$_POST = ['_id' => '100', '_file' => 'rcmfile' . $file['id'], '_name' => 'mod.gif'];
$this->runAndAssert($action, OutputJsonMock::E_EXIT);
$result = $output->getOutput();
$this->assertSame(['Content-Type: application/json; charset=UTF-8'], $output->headers);
$this->assertSame('rename-attachment', $result['action']);
$this->assertSame('this.rename_attachment_handler("rcmfile' . $file['id'] . '","mod.gif");', trim($result['exec']));
$upload = $rcmail->get_uploaded_file($file['id']);
$this->assertSame($_POST['_name'], $upload['name']);
$this->assertSame($_POST['_id'], $upload['group']);
}
}
Function Calls
None |
Stats
MD5 | 4e446bb1714ae21d02c1612972c11689 |
Eval Count | 0 |
Decode Time | 93 ms |