ValidatorFileMock.php 1.2 KB

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