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\Bundle\Test\Unit\Block\Adminhtml\Catalog\Product\Edit\Tab\Bundle;

use Magento\Bundle\Block\Adminhtml\Catalog\Product\Edit\Tab\Bundle\Option;
use Magento\Framework\DataObject;
use PHPUnit\Framework\TestCase;

class OptionTest extends TestCase
{
    public function testGetAddButtonId()
    {
        $button = new DataObject();

        $itemsBlock = $this->getMockBuilder(DataObject::class)
            ->addMethods(['getChildBlock'])
            ->disableOriginalConstructor()
            ->getMock();
        $itemsBlock->expects(
            $this->atLeastOnce()
        )->method(
            'getChildBlock'
        )->with(
            'add_button'
        )->willReturn(
            $button
        );

        $layout = $this->getMockBuilder(DataObject::class)
            ->addMethods(['getBlock'])
            ->disableOriginalConstructor()
            ->getMock();
        $layout->expects(
            $this->atLeastOnce()
        )->method(
            'getBlock'
        )->with(
            'admin.product.bundle.items'
        )->willReturn(
            $itemsBlock
        );

        $block = $this->createPartialMock(
            Option::class,
            ['getLayout']
        );
        $block->expects($this->atLeastOnce())->method('getLayout')->willReturn($layout);

        $this->assertNotEquals(42, $block->getAddButtonId());
        $button->setId(42);
        $this->assertEquals(42, $block->getAddButtonId());
    }
}
 ?>

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\Bundle\Test\Unit\Block\Adminhtml\Catalog\Product\Edit\Tab\Bundle;

use Magento\Bundle\Block\Adminhtml\Catalog\Product\Edit\Tab\Bundle\Option;
use Magento\Framework\DataObject;
use PHPUnit\Framework\TestCase;

class OptionTest extends TestCase
{
    public function testGetAddButtonId()
    {
        $button = new DataObject();

        $itemsBlock = $this->getMockBuilder(DataObject::class)
            ->addMethods(['getChildBlock'])
            ->disableOriginalConstructor()
            ->getMock();
        $itemsBlock->expects(
            $this->atLeastOnce()
        )->method(
            'getChildBlock'
        )->with(
            'add_button'
        )->willReturn(
            $button
        );

        $layout = $this->getMockBuilder(DataObject::class)
            ->addMethods(['getBlock'])
            ->disableOriginalConstructor()
            ->getMock();
        $layout->expects(
            $this->atLeastOnce()
        )->method(
            'getBlock'
        )->with(
            'admin.product.bundle.items'
        )->willReturn(
            $itemsBlock
        );

        $block = $this->createPartialMock(
            Option::class,
            ['getLayout']
        );
        $block->expects($this->atLeastOnce())->method('getLayout')->willReturn($layout);

        $this->assertNotEquals(42, $block->getAddButtonId());
        $button->setId(42);
        $this->assertEquals(42, $block->getAddButtonId());
    }
}

Function Calls

None

Variables

None

Stats

MD5 ca946075f82d1a61a64598b24695a134
Eval Count 0
Decode Time 101 ms