@@ 75-98 (lines=24) @@ | ||
72 | $this->assertNull($result); |
|
73 | } |
|
74 | ||
75 | public function testExecutePaypalActive() |
|
76 | { |
|
77 | $this->paymentHelper->method('isPayPalExpressActive')->willReturn(true); |
|
78 | ||
79 | $shortcut = $this->getMockBuilder(Shortcut::class)->disableOriginalConstructor()->getMock(); |
|
80 | ||
81 | $layout = $this->getMockBuilder(LayoutInterface::class)->disableOriginalConstructor()->getMock(); |
|
82 | $layout->method('createBlock')->willReturn($shortcut); |
|
83 | ||
84 | $shortcutButtons = $this->getMockBuilder(ShortcutButtons::class)->disableOriginalConstructor()->getMock(); |
|
85 | $shortcutButtons->method('getLayout')->willReturn($layout); |
|
86 | ||
87 | $event = $this->getMockBuilder(Event::class) |
|
88 | ->disableOriginalConstructor() |
|
89 | ->setMethods(['getContainer']) |
|
90 | ->getMock(); |
|
91 | $event->method('getContainer')->willReturn($shortcutButtons); |
|
92 | ||
93 | $observer = $this->getMockBuilder(Observer::class)->disableOriginalConstructor()->getMock(); |
|
94 | $observer->method('getEvent')->willReturn($event); |
|
95 | ||
96 | /** @var Observer $observer */ |
|
97 | $this->classToTest->execute($observer); |
|
98 | } |
|
99 | ||
100 | public function testExecutePaypalActiveAddToCart() |
|
101 | { |
|
@@ 100-124 (lines=25) @@ | ||
97 | $this->classToTest->execute($observer); |
|
98 | } |
|
99 | ||
100 | public function testExecutePaypalActiveAddToCart() |
|
101 | { |
|
102 | $this->paymentHelper->method('isPayPalExpressActive')->willReturn(true); |
|
103 | ||
104 | $shortcut = $this->getMockBuilder(Shortcut::class)->disableOriginalConstructor()->getMock(); |
|
105 | ||
106 | $layout = $this->getMockBuilder(LayoutInterface::class)->disableOriginalConstructor()->getMock(); |
|
107 | $layout->method('createBlock')->willReturn($shortcut); |
|
108 | ||
109 | $shortcutButtons = $this->getMockBuilder(ShortcutButtons::class)->disableOriginalConstructor()->getMock(); |
|
110 | $shortcutButtons->method('getNameInLayout')->willReturn('addtocart.shortcut.buttons'); |
|
111 | $shortcutButtons->method('getLayout')->willReturn($layout); |
|
112 | ||
113 | $event = $this->getMockBuilder(Event::class) |
|
114 | ->disableOriginalConstructor() |
|
115 | ->setMethods(['getContainer']) |
|
116 | ->getMock(); |
|
117 | $event->method('getContainer')->willReturn($shortcutButtons); |
|
118 | ||
119 | $observer = $this->getMockBuilder(Observer::class)->disableOriginalConstructor()->getMock(); |
|
120 | $observer->method('getEvent')->willReturn($event); |
|
121 | ||
122 | /** @var Observer $observer */ |
|
123 | $this->classToTest->execute($observer); |
|
124 | } |
|
125 | } |
|
126 |