24
24
*/
25
25
class EventSaverTest extends TestCase
26
26
{
27
+ const STUB_CUSTOMER_ID = 1 ;
28
+ const STUB_VISITOR_ID = 2 ;
29
+ const STUB_EVENT_TYPE_ID = 1 ;
30
+ const STUB_OBJECT_ID = 1 ;
31
+ const STUB_STORE_ID = 1 ;
32
+
27
33
/**
28
34
* @var Session|MockObject
29
35
*/
@@ -74,7 +80,7 @@ public function setUp()
74
80
->willReturn ($ this ->storeMock );
75
81
$ this ->storeMock ->expects ($ this ->once ())
76
82
->method ('getId ' )
77
- ->willReturn (1 );
83
+ ->willReturn (self :: STUB_STORE_ID );
78
84
79
85
$ this ->eventMock = $ this ->createMock (Event::class);
80
86
$ this ->eventFactoryMock = $ this ->createMock (EventFactory::class);
@@ -112,7 +118,7 @@ public function testSaveWithSubject()
112
118
->method ('getCustomerId ' );
113
119
$ this ->customerVisitorMock ->expects ($ this ->never ())
114
120
->method ('getId ' );
115
- $ this ->eventSaver ->save (1 , 1 , $ subjectId );
121
+ $ this ->eventSaver ->save (self :: STUB_EVENT_TYPE_ID , self :: STUB_OBJECT_ID , $ subjectId );
116
122
}
117
123
118
124
/**
@@ -125,8 +131,8 @@ public function testSaveWithoutSubjectWhenLoggedIn()
125
131
->willReturn (true );
126
132
$ this ->customerSessionMock ->expects ($ this ->once ())
127
133
->method ('getCustomerId ' )
128
- ->willReturn (1 );
129
- $ this ->eventSaver ->save (1 , 1 , null );
134
+ ->willReturn (self :: STUB_CUSTOMER_ID );
135
+ $ this ->eventSaver ->save (self :: STUB_EVENT_TYPE_ID , self :: STUB_OBJECT_ID , null );
130
136
}
131
137
132
138
/**
@@ -139,7 +145,7 @@ public function testSaveWithoutSubjectForGuest()
139
145
->willReturn (false );
140
146
$ this ->customerVisitorMock ->expects ($ this ->once ())
141
147
->method ('getId ' )
142
- ->willReturn (2 );
143
- $ this ->eventSaver ->save (1 , 1 , null );
148
+ ->willReturn (self :: STUB_VISITOR_ID );
149
+ $ this ->eventSaver ->save (self :: STUB_EVENT_TYPE_ID , self :: STUB_OBJECT_ID , null );
144
150
}
145
151
}
0 commit comments