1
1
<?php
2
+ /**
3
+ * Copyright © Magento, Inc. All rights reserved.
4
+ * See COPYING.txt for license details.
5
+ */
6
+ declare (strict_types=1 );
2
7
3
8
namespace Magento \Quote \Test \Unit \Plugin ;
4
9
5
10
use Magento \Framework \Event \Observer ;
6
11
use Magento \Framework \Webapi \Rest \Request as RestRequest ;
7
12
use Magento \Quote \Observer \SubmitObserver ;
8
13
use Magento \Quote \Plugin \SendOrderNotification ;
14
+ use PHPUnit \Framework \MockObject \MockObject ;
9
15
use PHPUnit \Framework \TestCase ;
10
16
use Magento \Sales \Model \Order ;
11
17
use Magento \Framework \Event ;
12
18
19
+ /**
20
+ * Unit test for SendOrderNotification plugin
21
+ */
13
22
class SendOrderNotificationTest extends TestCase
14
23
{
24
+ /**
25
+ * @var RestRequest|RestRequest&MockObject|MockObject
26
+ */
15
27
private RestRequest $ request ;
28
+
29
+ /**
30
+ * @var SubmitObserver|SubmitObserver&MockObject|MockObject
31
+ */
16
32
private SubmitObserver $ subject ;
33
+
34
+ /**
35
+ * @var Observer|Observer&MockObject|MockObject
36
+ */
17
37
private Observer $ observer ;
38
+
39
+ /**
40
+ * @var SendOrderNotification
41
+ */
18
42
private SendOrderNotification $ notification ;
19
43
44
+ /**
45
+ * @inheritdoc
46
+ */
20
47
protected function setUp (): void
21
48
{
22
49
$ this ->request = $ this ->createMock (RestRequest::class);
@@ -25,6 +52,9 @@ protected function setUp(): void
25
52
$ this ->notification = new SendOrderNotification ($ this ->request );
26
53
}
27
54
55
+ /**
56
+ * @return void
57
+ */
28
58
public function testBeforeExecuteWithSendConfirmation ()
29
59
{
30
60
$ this ->request ->expects ($ this ->once ())->method ('getPostValue ' )->with ('order ' )
@@ -53,6 +83,9 @@ public function testBeforeExecuteWithSendConfirmation()
53
83
$ this ->assertTrue ($ orderCheck ->getCanSendNewEmailFlag ());
54
84
}
55
85
86
+ /**
87
+ * @return void
88
+ */
56
89
public function testBeforeExecuteWithoutSendConfirmation ()
57
90
{
58
91
$ this ->request ->expects ($ this ->once ())->method ('getPostValue ' )->with ('order ' )
0 commit comments