8
8
9
9
namespace Magento \Theme \Test \Unit \Model \Design \Backend ;
10
10
11
- use Magento \Config \Model \Config \Backend \File \RequestData \RequestDataInterface ;
12
- use Magento \Framework \App \Cache \TypeListInterface ;
13
- use Magento \Framework \App \Config \ScopeConfigInterface ;
14
- use Magento \Framework \Data \Collection \AbstractDb ;
15
- use Magento \Framework \Filesystem ;
16
11
use Magento \Framework \Filesystem \Io \File as IoFile ;
17
- use Magento \Framework \Model \Context ;
18
- use Magento \Framework \Model \ResourceModel \AbstractResource ;
19
- use Magento \Framework \Registry ;
20
- use Magento \Framework \UrlInterface ;
21
- use Magento \MediaStorage \Helper \File \Storage \Database ;
22
- use Magento \MediaStorage \Model \File \UploaderFactory ;
23
12
use Magento \Theme \Model \Design \Backend \Image ;
24
13
use Magento \Framework \Filesystem \Directory \ReadFactory ;
14
+ use Magento \Framework \TestFramework \Unit \Helper \ObjectManager ;
25
15
26
16
/**
27
17
* @SuppressWarnings(PHPMD.CouplingBetweenObjects)
@@ -44,36 +34,13 @@ class ImageTest extends \PHPUnit\Framework\TestCase
44
34
*/
45
35
public function setUp ()
46
36
{
47
- $ context = $ this ->getMockObject (Context::class);
48
- $ registry = $ this ->getMockObject (Registry::class);
49
- $ config = $ this ->getMockObject (ScopeConfigInterface::class);
50
- $ cacheTypeList = $ this ->getMockObject (TypeListInterface::class);
51
- $ uploaderFactory = $ this ->getMockObject (UploaderFactory::class);
52
- $ requestData = $ this ->getMockObject (RequestDataInterface::class);
53
- $ filesystem = $ this ->getMockObject (Filesystem::class);
54
- $ urlBuilder = $ this ->getMockObject (UrlInterface::class);
55
- $ databaseHelper = $ this ->getMockObject (Database::class);
56
- $ abstractResource = $ this ->getMockObject (AbstractResource::class);
57
- $ abstractDb = $ this ->getMockObject (AbstractDb::class);
58
37
$ this ->ioFileSystem = $ this ->getMockObject (IoFile::class);
59
38
$ this ->tmpDirectory = $ this ->getMockObject (ReadFactory::class);
60
39
61
- $ this ->imageBackend = new Image (
62
- $ context ,
63
- $ registry ,
64
- $ config ,
65
- $ cacheTypeList ,
66
- $ uploaderFactory ,
67
- $ requestData ,
68
- $ filesystem ,
69
- $ urlBuilder ,
70
- $ abstractResource ,
71
- $ abstractDb ,
72
- [],
73
- $ databaseHelper ,
74
- $ this ->ioFileSystem ,
75
- $ this ->tmpDirectory
76
- );
40
+ $ objectManagerHelper = new ObjectManager ($ this );
41
+ $ this ->imageBackend = $ objectManagerHelper ->getObject (Image::class, [
42
+ 'ioFileSystem ' => $ this ->ioFileSystem ,
43
+ ]);
77
44
}
78
45
79
46
/**
0 commit comments