1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
<?php
/**
* Copyright © Magento, Inc. All rights reserved.
* See COPYING.txt for license details.
*/
namespace Magento\Checkout\_files;
use Magento\Catalog\Model\Product\Option\Type\File\ValidatorFile;
/**
* Creates mock for ValidatorFile to replace real instance in fixtures.
*/
class ValidatorFileMock extends \PHPUnit\Framework\TestCase
{
/**
* Returns mock.
*
* @return ValidatorFile|\PHPUnit_Framework_MockObject_MockObject
*/
public function getInstance()
{
$userValue = [
'type' => 'image/jpeg',
'title' => "test.jpg",
'quote_path' => "custom_options/quote/s/t/4624d2.jpg",
'order_path' => "custom_options/order/s/t/89d25b4624d2.jpg",
"fullpath" => "pub/media/custom_options/quote/s/t/e47389d25b4624d2.jpg",
"size"=> "71901",
"width" => 5,
"height" => 5,
"secret_key" => "10839ec1631b77e5e473",
];
$instance = $this->getMockBuilder(ValidatorFile::class)
->disableOriginalConstructor()
->getMock();
$instance->method('SetProduct')->willReturnSelf();
$instance->method('validate')->willReturn($userValue);
return $instance;
}
}