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\Block\Widget\Grid\Column;
use Magento\Backend\Block\Widget\Grid\Column\Multistore;
use Magento\Backend\Model\Url;
use Magento\Framework\TestFramework\Unit\Helper\ObjectManager;
use Magento\Store\Model\StoreManager;
use PHPUnit\Framework\MockObject\MockObject;
use PHPUnit\Framework\TestCase;
class MultistoreTest extends TestCase
{
/**
* @var Multistore
*/
protected $_model;
/**
* @var MockObject
*/
protected $_storeManagerMock;
protected function setUp(): void
{
$this->_storeManagerMock = $this->createMock(StoreManager::class);
$arguments = [
'storeManager' => $this->_storeManagerMock,
'urlBuilder' => $this->createMock(Url::class),
];
$objectManagerHelper = new ObjectManager($this);
$this->_model = $objectManagerHelper->getObject(
Multistore::class,
$arguments
);
}
protected function tearDown(): void
{
unset($this->_model);
unset($this->_storeManagerMock);
}
public function testIsDisplayedReturnsTrueInMultiStoreMode()
{
$this->_storeManagerMock->expects($this->once())->method('isSingleStoreMode')->willReturn(false);
$this->assertTrue($this->_model->isDisplayed());
}
public function testIsDisplayedReturnsFalseInSingleStoreMode()
{
$this->_storeManagerMock->expects($this->once())->method('isSingleStoreMode')->willReturn(true);
$this->assertFalse($this->_model->isDisplayed());
}
}
?>
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\Block\Widget\Grid\Column;
use Magento\Backend\Block\Widget\Grid\Column\Multistore;
use Magento\Backend\Model\Url;
use Magento\Framework\TestFramework\Unit\Helper\ObjectManager;
use Magento\Store\Model\StoreManager;
use PHPUnit\Framework\MockObject\MockObject;
use PHPUnit\Framework\TestCase;
class MultistoreTest extends TestCase
{
/**
* @var Multistore
*/
protected $_model;
/**
* @var MockObject
*/
protected $_storeManagerMock;
protected function setUp(): void
{
$this->_storeManagerMock = $this->createMock(StoreManager::class);
$arguments = [
'storeManager' => $this->_storeManagerMock,
'urlBuilder' => $this->createMock(Url::class),
];
$objectManagerHelper = new ObjectManager($this);
$this->_model = $objectManagerHelper->getObject(
Multistore::class,
$arguments
);
}
protected function tearDown(): void
{
unset($this->_model);
unset($this->_storeManagerMock);
}
public function testIsDisplayedReturnsTrueInMultiStoreMode()
{
$this->_storeManagerMock->expects($this->once())->method('isSingleStoreMode')->willReturn(false);
$this->assertTrue($this->_model->isDisplayed());
}
public function testIsDisplayedReturnsFalseInSingleStoreMode()
{
$this->_storeManagerMock->expects($this->once())->method('isSingleStoreMode')->willReturn(true);
$this->assertFalse($this->_model->isDisplayed());
}
}
Function Calls
| None |
Stats
| MD5 | 3ad568c4446a5042e5c1e95226c58e4e |
| Eval Count | 0 |
| Decode Time | 80 ms |