Skip to content

Commit 5342a25

Browse files
committed
Constants added
1 parent e543d0a commit 5342a25

File tree

1 file changed

+12
-6
lines changed

1 file changed

+12
-6
lines changed

app/code/Magento/Reports/Test/Unit/Observer/EventSaverTest.php

Lines changed: 12 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,12 @@
2424
*/
2525
class EventSaverTest extends TestCase
2626
{
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+
2733
/**
2834
* @var Session|MockObject
2935
*/
@@ -74,7 +80,7 @@ public function setUp()
7480
->willReturn($this->storeMock);
7581
$this->storeMock->expects($this->once())
7682
->method('getId')
77-
->willReturn(1);
83+
->willReturn(self::STUB_STORE_ID);
7884

7985
$this->eventMock = $this->createMock(Event::class);
8086
$this->eventFactoryMock = $this->createMock(EventFactory::class);
@@ -112,7 +118,7 @@ public function testSaveWithSubject()
112118
->method('getCustomerId');
113119
$this->customerVisitorMock->expects($this->never())
114120
->method('getId');
115-
$this->eventSaver->save(1, 1, $subjectId);
121+
$this->eventSaver->save(self::STUB_EVENT_TYPE_ID, self::STUB_OBJECT_ID, $subjectId);
116122
}
117123

118124
/**
@@ -125,8 +131,8 @@ public function testSaveWithoutSubjectWhenLoggedIn()
125131
->willReturn(true);
126132
$this->customerSessionMock->expects($this->once())
127133
->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);
130136
}
131137

132138
/**
@@ -139,7 +145,7 @@ public function testSaveWithoutSubjectForGuest()
139145
->willReturn(false);
140146
$this->customerVisitorMock->expects($this->once())
141147
->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);
144150
}
145151
}

0 commit comments

Comments
 (0)