File tree Expand file tree Collapse file tree 1 file changed +49
-0
lines changed
app/code/Meta/Conversion/Test/Unit/CustomerData Expand file tree Collapse file tree 1 file changed +49
-0
lines changed Original file line number Diff line number Diff line change
1
+ <?php
2
+ declare (strict_types=1 );
3
+
4
+ namespace Meta \Conversion \Test \Unit \CustomerData ;
5
+
6
+ use PHPUnit \Framework \TestCase ;
7
+ use Magento \Framework \TestFramework \Unit \Helper \ObjectManager ;
8
+ use Meta \Conversion \CustomerData \EventData ;
9
+ use Magento \Customer \Model \Session as CustomerSession ;
10
+
11
+ class EventDataTest extends TestCase
12
+ {
13
+ private $ customerSessionMock ;
14
+ private $ subject ;
15
+
16
+ public function setUp (): void
17
+ {
18
+ $ this ->customerSessionMock = $ this ->getMockBuilder (CustomerSession::class)
19
+ ->addMethods (['getMetaEventIds ' ])
20
+ ->disableOriginalConstructor ()
21
+ ->getMock ();
22
+
23
+ $ object = new ObjectManager ($ this );
24
+ $ this ->subject = $ object ->getObject (EventData::class, ['customerSession ' => $ this ->customerSessionMock ]);
25
+ }
26
+
27
+ public function testGetSectionDataWithData ()
28
+ {
29
+ $ metaEventIds = [
30
+ 'addtocart ' => '123423hbv-3243r1hb-1324r4t '
31
+ ];
32
+ $ sectionData = [
33
+ 'eventIds ' => $ metaEventIds
34
+ ];
35
+
36
+ $ this ->customerSessionMock ->expects ($ this ->once ())->method ('getMetaEventIds ' )->willReturn ($ metaEventIds );
37
+ $ this ->assertEquals ($ sectionData , $ this ->subject ->getSectionData ());
38
+ }
39
+
40
+ public function testGetSectionDataWithoutData ()
41
+ {
42
+ $ sectionData = [
43
+ 'eventIds ' => []
44
+ ];
45
+
46
+ $ this ->customerSessionMock ->expects ($ this ->once ())->method ('getMetaEventIds ' )->willReturn (null );
47
+ $ this ->assertEquals ($ sectionData , $ this ->subject ->getSectionData ());
48
+ }
49
+ }
You can’t perform that action at this time.
0 commit comments