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\Backend\Test\Unit\Console\Command;
use Magento\Framework\Event\ManagerInterface;
use PHPUnit\Framework\MockObject\MockObject;
use Symfony\Component\Console\Tester\CommandTester;
abstract class AbstractCacheManageCommandTestCase extends AbstractCacheCommandTestCase
{
/** @var string */
protected $cacheEventName;
/** @var ManagerInterface|MockObject */
protected $eventManagerMock;
protected function setUp(): void
{
$this->eventManagerMock = $this->getMockBuilder(ManagerInterface::class)
->disableOriginalConstructor()
->getMockForAbstractClass();
parent::setUp();
}
/**
* @return array
*/
public function executeDataProvider()
{
return [
'implicit all' => [
[],
['A', 'B', 'C', 'full_page'],
true,
$this->getExpectedExecutionOutput(['A', 'B', 'C', 'full_page']),
],
'specified types' => [
['types' => ['A', 'B']],
['A', 'B'],
false,
$this->getExpectedExecutionOutput(['A', 'B']),
],
'fpc_only' => [
['types' => ['full_page']],
['full_page'],
true,
$this->getExpectedExecutionOutput(['full_page']),
],
];
}
public function testExecuteInvalidCacheType()
{
$this->expectException('InvalidArgumentException');
$this->expectExceptionMessage('The following requested cache types are not supported:');
$this->cacheManagerMock->expects($this->once())->method('getAvailableTypes')->willReturn(['A', 'B', 'C']);
$param = ['types' => ['A', 'D']];
$commandTester = new CommandTester($this->command);
$commandTester->execute($param);
}
}
?>
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\Backend\Test\Unit\Console\Command;
use Magento\Framework\Event\ManagerInterface;
use PHPUnit\Framework\MockObject\MockObject;
use Symfony\Component\Console\Tester\CommandTester;
abstract class AbstractCacheManageCommandTestCase extends AbstractCacheCommandTestCase
{
/** @var string */
protected $cacheEventName;
/** @var ManagerInterface|MockObject */
protected $eventManagerMock;
protected function setUp(): void
{
$this->eventManagerMock = $this->getMockBuilder(ManagerInterface::class)
->disableOriginalConstructor()
->getMockForAbstractClass();
parent::setUp();
}
/**
* @return array
*/
public function executeDataProvider()
{
return [
'implicit all' => [
[],
['A', 'B', 'C', 'full_page'],
true,
$this->getExpectedExecutionOutput(['A', 'B', 'C', 'full_page']),
],
'specified types' => [
['types' => ['A', 'B']],
['A', 'B'],
false,
$this->getExpectedExecutionOutput(['A', 'B']),
],
'fpc_only' => [
['types' => ['full_page']],
['full_page'],
true,
$this->getExpectedExecutionOutput(['full_page']),
],
];
}
public function testExecuteInvalidCacheType()
{
$this->expectException('InvalidArgumentException');
$this->expectExceptionMessage('The following requested cache types are not supported:');
$this->cacheManagerMock->expects($this->once())->method('getAvailableTypes')->willReturn(['A', 'B', 'C']);
$param = ['types' => ['A', 'D']];
$commandTester = new CommandTester($this->command);
$commandTester->execute($param);
}
}
Function Calls
None |
Stats
MD5 | d443c44179aba042080c0b2b8b4b4fb0 |
Eval Count | 0 |
Decode Time | 98 ms |