| 
 | 1 | +<?php  | 
 | 2 | +/**  | 
 | 3 | + * Copyright © Magento, Inc. All rights reserved.  | 
 | 4 | + * See COPYING.txt for license details.  | 
 | 5 | + */  | 
 | 6 | + | 
 | 7 | +namespace Magento\ConfigurableProduct\Test\Unit\Controller\Adminhtml\Product;  | 
 | 8 | + | 
 | 9 | +use Magento\Framework\Controller\ResultFactory;  | 
 | 10 | +use Magento\Framework\TestFramework\Unit\Helper\ObjectManager as ObjectManagerHelper;  | 
 | 11 | + | 
 | 12 | +class WizardTest extends \PHPUnit_Framework_TestCase  | 
 | 13 | +{  | 
 | 14 | +    /**  | 
 | 15 | +     * @var \PHPUnit_Framework_MockObject_MockObject  | 
 | 16 | +     */  | 
 | 17 | +    private $resultFactory;  | 
 | 18 | + | 
 | 19 | +    /**  | 
 | 20 | +     * @var \PHPUnit_Framework_MockObject_MockObject  | 
 | 21 | +     */  | 
 | 22 | +    private $productBuilder;  | 
 | 23 | + | 
 | 24 | +    /**  | 
 | 25 | +     * @var \PHPUnit_Framework_MockObject_MockObject  | 
 | 26 | +     */  | 
 | 27 | +    private $request;  | 
 | 28 | + | 
 | 29 | +    /**  | 
 | 30 | +     * @var \Magento\ConfigurableProduct\Controller\Adminhtml\Product\Wizard  | 
 | 31 | +     */  | 
 | 32 | +    private $model;  | 
 | 33 | + | 
 | 34 | +    protected function setUp()  | 
 | 35 | +    {  | 
 | 36 | +        $this->resultFactory = $this->getMockBuilder(\Magento\Framework\Controller\ResultFactory::class)  | 
 | 37 | +            ->disableOriginalConstructor()  | 
 | 38 | +            ->getMock();  | 
 | 39 | +        $this->productBuilder = $this->getMockBuilder(\Magento\Catalog\Controller\Adminhtml\Product\Builder::class)  | 
 | 40 | +            ->disableOriginalConstructor()  | 
 | 41 | +            ->setMethods(['build'])  | 
 | 42 | +            ->getMock();  | 
 | 43 | +        $this->request = $this->getMockBuilder(\Magento\Framework\App\RequestInterface::class)  | 
 | 44 | +            ->disableOriginalConstructor()  | 
 | 45 | +            ->getMock();  | 
 | 46 | +        $context = $this->getMockBuilder(\Magento\Backend\App\Action\Context::class)  | 
 | 47 | +            ->disableOriginalConstructor()  | 
 | 48 | +            ->getMock();  | 
 | 49 | + | 
 | 50 | +        $context->expects($this->any())->method('getResultFactory')->willReturn($this->resultFactory);  | 
 | 51 | +        $context->expects($this->any())->method('getRequest')->willReturn($this->request);  | 
 | 52 | + | 
 | 53 | +        $objectManagerHelper = new ObjectManagerHelper($this);  | 
 | 54 | +        $this->model = $objectManagerHelper->getObject(  | 
 | 55 | +            \Magento\ConfigurableProduct\Controller\Adminhtml\Product\Wizard::class,  | 
 | 56 | +            [  | 
 | 57 | +                'context' => $context,  | 
 | 58 | +                'productBuilder' => $this->productBuilder  | 
 | 59 | +            ]  | 
 | 60 | +        );  | 
 | 61 | +    }  | 
 | 62 | + | 
 | 63 | +    public function testExecute()  | 
 | 64 | +    {  | 
 | 65 | +        $this->productBuilder->expects($this->once())->method('build')->with($this->request);  | 
 | 66 | +        $this->resultFactory->expects($this->once())->method('create')->with(ResultFactory::TYPE_LAYOUT);  | 
 | 67 | + | 
 | 68 | +        $this->model->execute();  | 
 | 69 | +    }  | 
 | 70 | +}  | 
0 commit comments