File tree Expand file tree Collapse file tree 7 files changed +95
-0
lines changed
AdminNotification/Test/Unit/Block
Page/System/Config/Robots Expand file tree Collapse file tree 7 files changed +95
-0
lines changed Original file line number Diff line number Diff line change 12
12
13
13
use Magento \AdminNotification \Block \ToolbarEntry ;
14
14
use Magento \AdminNotification \Model \ResourceModel \Inbox \Collection \Unread ;
15
+ use Magento \Directory \Helper \Data as DirectoryHelper ;
16
+ use Magento \Framework \Json \Helper \Data as JsonHelper ;
15
17
use Magento \Framework \TestFramework \Unit \Helper \ObjectManager ;
16
18
use PHPUnit \Framework \TestCase ;
17
19
@@ -26,6 +28,17 @@ class ToolbarEntryTest extends TestCase
26
28
protected function _getBlockInstance ($ unreadNotifications )
27
29
{
28
30
$ objectManagerHelper = new ObjectManager ($ this );
31
+ $ objects = [
32
+ [
33
+ JsonHelper::class,
34
+ $ this ->createMock (JsonHelper::class)
35
+ ],
36
+ [
37
+ DirectoryHelper::class,
38
+ $ this ->createMock (DirectoryHelper::class)
39
+ ]
40
+ ];
41
+ $ objectManagerHelper ->prepareObjectManager ($ objects );
29
42
// mock collection of unread notifications
30
43
$ notificationList = $ this ->createPartialMock (
31
44
Unread::class,
@@ -52,6 +65,18 @@ public function testGetLatestUnreadNotifications()
52
65
{
53
66
$ helper = new ObjectManager ($ this );
54
67
68
+ $ objects = [
69
+ [
70
+ JsonHelper::class,
71
+ $ this ->createMock (JsonHelper::class)
72
+ ],
73
+ [
74
+ DirectoryHelper::class,
75
+ $ this ->createMock (DirectoryHelper::class)
76
+ ]
77
+ ];
78
+ $ helper ->prepareObjectManager ($ objects );
79
+
55
80
// 1. Create mocks
56
81
$ notificationList = $ this ->createMock (Unread::class);
57
82
Original file line number Diff line number Diff line change 15
15
use Magento \Framework \TestFramework \Unit \Helper \ObjectManager ;
16
16
use PHPUnit \Framework \MockObject \MockObject ;
17
17
use PHPUnit \Framework \TestCase ;
18
+ use Magento \Framework \App \Response \FileFactory ;
18
19
19
20
class FileFactoryTest extends TestCase
20
21
{
@@ -46,6 +47,14 @@ class FileFactoryTest extends TestCase
46
47
protected function setUp (): void
47
48
{
48
49
$ helper = new ObjectManager ($ this );
50
+ $ objects = [
51
+ [
52
+ FileFactory::class,
53
+ $ this ->createMock (FileFactory::class)
54
+ ]
55
+ ];
56
+ $ helper ->prepareObjectManager ($ objects );
57
+
49
58
$ this ->_responseMock = $ this ->createPartialMock (
50
59
Http::class,
51
60
['setRedirect ' , '__wakeup ' ]
Original file line number Diff line number Diff line change 16
16
use Magento \Backend \Model \Menu \Filter \IteratorFactory ;
17
17
use Magento \Backend \Model \Menu \Item ;
18
18
use Magento \Backend \Model \UrlInterface ;
19
+ use Magento \Directory \Helper \Data as DirectoryHelper ;
20
+ use Magento \Framework \Json \Helper \Data as JsonHelper ;
19
21
use Magento \Framework \Locale \ResolverInterface ;
20
22
use Magento \Framework \TestFramework \Unit \Helper \ObjectManager as ObjectManagerHelper ;
21
23
use PHPUnit \Framework \MockObject \MockObject ;
@@ -73,6 +75,17 @@ protected function setUp(): void
73
75
->getMock ();
74
76
75
77
$ objectManagerHelper = new ObjectManagerHelper ($ this );
78
+ $ objects = [
79
+ [
80
+ JsonHelper::class,
81
+ $ this ->createMock (JsonHelper::class)
82
+ ],
83
+ [
84
+ DirectoryHelper::class,
85
+ $ this ->createMock (DirectoryHelper::class)
86
+ ]
87
+ ];
88
+ $ objectManagerHelper ->prepareObjectManager ($ objects );
76
89
$ this ->menu = $ objectManagerHelper ->getObject (
77
90
Menu::class,
78
91
[
Original file line number Diff line number Diff line change 14
14
use Magento \Backend \Block \Template \Context ;
15
15
use Magento \Framework \App \Config \ScopeConfigInterface ;
16
16
use Magento \Framework \TestFramework \Unit \Helper \ObjectManager ;
17
+ use Magento \Framework \View \Helper \SecureHtmlRenderer ;
17
18
use PHPUnit \Framework \MockObject \MockObject ;
18
19
use PHPUnit \Framework \TestCase ;
19
20
@@ -37,6 +38,13 @@ protected function setUp(): void
37
38
$ this ->configMock = $ this ->getMockForAbstractClass (ScopeConfigInterface::class);
38
39
39
40
$ objectHelper = new ObjectManager ($ this );
41
+ $ objects = [
42
+ [
43
+ SecureHtmlRenderer::class,
44
+ $ this ->createMock (SecureHtmlRenderer::class)
45
+ ]
46
+ ];
47
+ $ objectHelper ->prepareObjectManager ($ objects );
40
48
$ context = $ objectHelper ->getObject (
41
49
Context::class,
42
50
['scopeConfig ' => $ this ->configMock ]
Original file line number Diff line number Diff line change 8
8
namespace Magento \Backend \Test \Unit \Block \Widget \Button ;
9
9
10
10
use Magento \Backend \Block \Widget \Button \SplitButton ;
11
+ use Magento \Directory \Helper \Data as DirectoryHelper ;
12
+ use Magento \Framework \Json \Helper \Data as JsonHelper ;
11
13
use Magento \Framework \TestFramework \Unit \Helper \ObjectManager ;
12
14
use PHPUnit \Framework \TestCase ;
13
15
@@ -16,6 +18,17 @@ class SplitTest extends TestCase
16
18
public function testHasSplit ()
17
19
{
18
20
$ objectManagerHelper = new ObjectManager ($ this );
21
+ $ objects = [
22
+ [
23
+ JsonHelper::class,
24
+ $ this ->createMock (JsonHelper::class)
25
+ ],
26
+ [
27
+ DirectoryHelper::class,
28
+ $ this ->createMock (DirectoryHelper::class)
29
+ ]
30
+ ];
31
+ $ objectManagerHelper ->prepareObjectManager ($ objects );
19
32
/** @var SplitButton $block */
20
33
$ block = $ objectManagerHelper ->getObject (SplitButton::class);
21
34
$ this ->assertTrue ($ block ->hasSplit ());
Original file line number Diff line number Diff line change 12
12
13
13
use Magento \Backend \Block \Widget \Button ;
14
14
use Magento \Backend \Model \Url ;
15
+ use Magento \Directory \Helper \Data as DirectoryHelper ;
16
+ use Magento \Framework \Json \Helper \Data as JsonHelper ;
15
17
use Magento \Framework \TestFramework \Unit \Helper \ObjectManager ;
16
18
use Magento \Framework \View \Layout ;
17
19
use PHPUnit \Framework \MockObject \MockObject ;
@@ -49,6 +51,18 @@ protected function setUp(): void
49
51
];
50
52
51
53
$ objectManagerHelper = new ObjectManager ($ this );
54
+ $ objects = [
55
+ [
56
+ JsonHelper::class,
57
+ $ this ->createMock (JsonHelper::class)
58
+ ],
59
+ [
60
+ DirectoryHelper::class,
61
+ $ this ->createMock (DirectoryHelper::class)
62
+ ]
63
+ ];
64
+ $ objectManagerHelper ->prepareObjectManager ($ objects );
65
+
52
66
$ this ->_blockMock = $ objectManagerHelper ->getObject (Button::class, $ arguments );
53
67
}
54
68
Original file line number Diff line number Diff line change 12
12
13
13
use Magento \Backend \Block \Widget \Grid \ColumnSet ;
14
14
use Magento \Backend \Block \Widget \Grid \Extended ;
15
+ use Magento \Directory \Helper \Data as DirectoryHelper ;
15
16
use Magento \Framework \App \Request \Http ;
16
17
use Magento \Framework \Data \Collection ;
18
+ use Magento \Framework \Json \Helper \Data as JsonHelper ;
17
19
use Magento \Framework \TestFramework \Unit \Helper \ObjectManager ;
18
20
use Magento \Framework \View \Layout ;
19
21
use PHPUnit \Framework \TestCase ;
@@ -28,6 +30,17 @@ class ExtendedTest extends TestCase
28
30
protected function setUp (): void
29
31
{
30
32
$ this ->_objectManager = new ObjectManager ($ this );
33
+ $ objects = [
34
+ [
35
+ JsonHelper::class,
36
+ $ this ->createMock (JsonHelper::class)
37
+ ],
38
+ [
39
+ DirectoryHelper::class,
40
+ $ this ->createMock (DirectoryHelper::class)
41
+ ]
42
+ ];
43
+ $ this ->_objectManager ->prepareObjectManager ($ objects );
31
44
}
32
45
33
46
public function testPrepareLoadedCollection ()
You can’t perform that action at this time.
0 commit comments