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 /** * Copyright Magento, Inc. All rights reserved. * See COPYING.txt for license ..
Decoded Output download
<?php
/**
* Copyright Magento, Inc. All rights reserved.
* See COPYING.txt for license details.
*/
declare(strict_types=1);
namespace Magento\Captcha\Test\Unit\Observer;
use Magento\Captcha\Helper\Data as CaptchaDataHelper;
use Magento\Captcha\Observer\CaptchaStringResolver;
use Magento\Framework\App\Request\Http as HttpRequest;
use Magento\Framework\TestFramework\Unit\Helper\ObjectManager;
use PHPUnit\Framework\MockObject\MockObject;
use PHPUnit\Framework\TestCase;
class CaptchaStringResolverTest extends TestCase
{
/**
* @var ObjectManager
*/
private $objectManagerHelper;
/**
* @var CaptchaStringResolver
*/
private $captchaStringResolver;
/**
* @var HttpRequest|MockObject
*/
private $requestMock;
protected function setUp(): void
{
$this->objectManagerHelper = new ObjectManager($this);
$this->requestMock = $this->createMock(HttpRequest::class);
$this->captchaStringResolver = $this->objectManagerHelper->getObject(CaptchaStringResolver::class);
}
public function testResolveWithFormIdSet()
{
$formId = 'contact_us';
$captchaValue = 'some-value';
$this->requestMock->expects($this->once())
->method('getPost')
->with(CaptchaDataHelper::INPUT_NAME_FIELD_VALUE)
->willReturn([$formId => $captchaValue]);
self::assertEquals(
$this->captchaStringResolver->resolve($this->requestMock, $formId),
$captchaValue
);
}
public function testResolveWithNoFormIdInRequest()
{
$formId = 'contact_us';
$this->requestMock->expects($this->once())
->method('getPost')
->with(CaptchaDataHelper::INPUT_NAME_FIELD_VALUE)
->willReturn([]);
self::assertEquals(
$this->captchaStringResolver->resolve($this->requestMock, $formId),
''
);
}
}
?>
Did this file decode correctly?
Original Code
<?php
/**
* Copyright Magento, Inc. All rights reserved.
* See COPYING.txt for license details.
*/
declare(strict_types=1);
namespace Magento\Captcha\Test\Unit\Observer;
use Magento\Captcha\Helper\Data as CaptchaDataHelper;
use Magento\Captcha\Observer\CaptchaStringResolver;
use Magento\Framework\App\Request\Http as HttpRequest;
use Magento\Framework\TestFramework\Unit\Helper\ObjectManager;
use PHPUnit\Framework\MockObject\MockObject;
use PHPUnit\Framework\TestCase;
class CaptchaStringResolverTest extends TestCase
{
/**
* @var ObjectManager
*/
private $objectManagerHelper;
/**
* @var CaptchaStringResolver
*/
private $captchaStringResolver;
/**
* @var HttpRequest|MockObject
*/
private $requestMock;
protected function setUp(): void
{
$this->objectManagerHelper = new ObjectManager($this);
$this->requestMock = $this->createMock(HttpRequest::class);
$this->captchaStringResolver = $this->objectManagerHelper->getObject(CaptchaStringResolver::class);
}
public function testResolveWithFormIdSet()
{
$formId = 'contact_us';
$captchaValue = 'some-value';
$this->requestMock->expects($this->once())
->method('getPost')
->with(CaptchaDataHelper::INPUT_NAME_FIELD_VALUE)
->willReturn([$formId => $captchaValue]);
self::assertEquals(
$this->captchaStringResolver->resolve($this->requestMock, $formId),
$captchaValue
);
}
public function testResolveWithNoFormIdInRequest()
{
$formId = 'contact_us';
$this->requestMock->expects($this->once())
->method('getPost')
->with(CaptchaDataHelper::INPUT_NAME_FIELD_VALUE)
->willReturn([]);
self::assertEquals(
$this->captchaStringResolver->resolve($this->requestMock, $formId),
''
);
}
}
Function Calls
None |
Stats
MD5 | 7de3bd370deb2fb75766da84d691e908 |
Eval Count | 0 |
Decode Time | 82 ms |