10
10
use Magento \Framework \App \State ;
11
11
use Magento \Framework \Filesystem \DriverInterface ;
12
12
use Magento \Framework \TestFramework \Unit \Helper \ObjectManager ;
13
- use Magento \Store \Api \Data \StoreInterface ;
14
13
use Magento \Store \Model \ScopeInterface ;
15
- use Magento \Store \Model \StoreManagerInterface ;
16
14
use Monolog \Formatter \FormatterInterface ;
17
15
use Monolog \Logger ;
18
16
@@ -41,16 +39,6 @@ class DebugTest extends \PHPUnit_Framework_TestCase
41
39
*/
42
40
private $ scopeConfigMock ;
43
41
44
- /**
45
- * @var StoreManagerInterface|\PHPUnit_Framework_MockObject_MockObject
46
- */
47
- private $ storeManagerMock ;
48
-
49
- /**
50
- * @var StoreInterface|\PHPUnit_Framework_MockObject_MockObject
51
- */
52
- private $ storeMock ;
53
-
54
42
/**
55
43
* @var FormatterInterface|\PHPUnit_Framework_MockObject_MockObject
56
44
*/
@@ -65,16 +53,9 @@ protected function setUp()
65
53
->getMock ();
66
54
$ this ->scopeConfigMock = $ this ->getMockBuilder (ScopeConfigInterface::class)
67
55
->getMockForAbstractClass ();
68
- $ this ->storeMock = $ this ->getMockBuilder (StoreInterface::class)
69
- ->getMockForAbstractClass ();
70
- $ this ->storeManagerMock = $ this ->getMockBuilder (StoreManagerInterface::class)
71
- ->getMockForAbstractClass ();
72
56
$ this ->formatterMock = $ this ->getMockBuilder (FormatterInterface::class)
73
57
->getMockForAbstractClass ();
74
58
75
- $ this ->storeManagerMock ->expects ($ this ->any ())
76
- ->method ('getStore ' )
77
- ->willReturn ($ this ->storeMock );
78
59
$ this ->formatterMock ->expects ($ this ->any ())
79
60
->method ('format ' )
80
61
->willReturn (null );
@@ -83,32 +64,25 @@ protected function setUp()
83
64
'filesystem ' => $ this ->filesystemMock ,
84
65
'state ' => $ this ->stateMock ,
85
66
'scopeConfig ' => $ this ->scopeConfigMock ,
86
- 'storeManager ' => $ this ->storeManagerMock
87
67
]);
88
68
$ this ->model ->setFormatter ($ this ->formatterMock );
89
69
}
90
70
91
71
public function testHandle ()
92
72
{
93
- $ this ->storeMock ->expects ($ this ->once ())
94
- ->method ('getCode ' )
95
- ->willReturn ('test_code ' );
96
73
$ this ->stateMock ->expects ($ this ->once ())
97
74
->method ('getMode ' )
98
75
->willReturn (State::MODE_DEVELOPER );
99
76
$ this ->scopeConfigMock ->expects ($ this ->once ())
100
77
->method ('getValue ' )
101
- ->with ('dev/debug/debug_logging ' , ScopeInterface::SCOPE_STORE , ' test_code ' )
78
+ ->with ('dev/debug/debug_logging ' , ScopeInterface::SCOPE_STORE , null )
102
79
->willReturn (true );
103
80
104
81
$ this ->model ->handle (['formatted ' => false , 'level ' => Logger::DEBUG ]);
105
82
}
106
83
107
84
public function testHandleDisabledByProduction ()
108
85
{
109
- $ this ->storeMock ->expects ($ this ->once ())
110
- ->method ('getCode ' )
111
- ->willReturn ('test_code ' );
112
86
$ this ->stateMock ->expects ($ this ->once ())
113
87
->method ('getMode ' )
114
88
->willReturn (State::MODE_PRODUCTION );
@@ -120,25 +94,19 @@ public function testHandleDisabledByProduction()
120
94
121
95
public function testHandleDisabledByConfig ()
122
96
{
123
- $ this ->storeMock ->expects ($ this ->once ())
124
- ->method ('getCode ' )
125
- ->willReturn ('test_code ' );
126
97
$ this ->stateMock ->expects ($ this ->once ())
127
98
->method ('getMode ' )
128
99
->willReturn (State::MODE_DEVELOPER );
129
100
$ this ->scopeConfigMock ->expects ($ this ->once ())
130
101
->method ('getValue ' )
131
- ->with ('dev/debug/debug_logging ' , ScopeInterface::SCOPE_STORE , ' test_code ' )
102
+ ->with ('dev/debug/debug_logging ' , ScopeInterface::SCOPE_STORE , null )
132
103
->willReturn (false );
133
104
134
105
$ this ->model ->handle (['formatted ' => false , 'level ' => Logger::DEBUG ]);
135
106
}
136
107
137
108
public function testHandleDisabledByLevel ()
138
109
{
139
- $ this ->storeMock ->expects ($ this ->once ())
140
- ->method ('getCode ' )
141
- ->willReturn ('test_code ' );
142
110
$ this ->stateMock ->expects ($ this ->never ())
143
111
->method ('getMode ' );
144
112
$ this ->scopeConfigMock ->expects ($ this ->never ())
0 commit comments