File tree Expand file tree Collapse file tree 2 files changed +12
-21
lines changed
app/code/Magento/LoginAsCustomer/Plugin
dev/tests/integration/testsuite/Magento/Sales/Model/AdminOrder Expand file tree Collapse file tree 2 files changed +12
-21
lines changed Original file line number Diff line number Diff line change @@ -39,16 +39,18 @@ public function __construct(
39
39
public function afterPlace (Order $ subject , Order $ result ): Order
40
40
{
41
41
$ adminUser = $ this ->userSession ->getUser ();
42
- $ subject ->addCommentToStatusHistory (
43
- 'Order Placed by Store Administrator ' ,
44
- false ,
45
- true
46
- )->setIsCustomerNotified (false );
47
- $ subject ->addCommentToStatusHistory (
48
- "Order Placed by {$ adminUser ->getFirstName ()} {$ adminUser ->getLastName ()} using Admin Panel " ,
49
- false ,
50
- false
51
- )->setIsCustomerNotified (false );
42
+ if ($ adminUser ) {
43
+ $ subject ->addCommentToStatusHistory (
44
+ 'Order Placed by Store Administrator ' ,
45
+ false ,
46
+ true
47
+ )->setIsCustomerNotified (false );
48
+ $ subject ->addCommentToStatusHistory (
49
+ "Order Placed by {$ adminUser ->getFirstName ()} {$ adminUser ->getLastName ()} using Admin Panel " ,
50
+ false ,
51
+ false
52
+ )->setIsCustomerNotified (false );
53
+ }
52
54
53
55
return $ result ;
54
56
}
Original file line number Diff line number Diff line change 5
5
*/
6
6
namespace Magento \Sales \Model \AdminOrder ;
7
7
8
- use Magento \Backend \Model \Auth ;
9
8
use Magento \Backend \Model \Session \Quote as SessionQuote ;
10
9
use Magento \Customer \Api \AddressRepositoryInterface ;
11
10
use Magento \Customer \Api \CustomerRepositoryInterface ;
@@ -43,21 +42,11 @@ class CreateTest extends \PHPUnit\Framework\TestCase
43
42
*/
44
43
private $ objectManager ;
45
44
46
- /**
47
- * @var Auth
48
- */
49
- private $ auth ;
50
-
51
45
protected function setUp ()
52
46
{
53
47
$ this ->objectManager = Bootstrap::getObjectManager ();
54
48
$ this ->messageManager = $ this ->objectManager ->get (ManagerInterface::class);
55
49
$ this ->model =$ this ->objectManager ->create (Create::class, ['messageManager ' => $ this ->messageManager ]);
56
- $ this ->auth = $ this ->objectManager ->create (Auth::class);
57
- $ this ->auth ->login (
58
- \Magento \TestFramework \Bootstrap::ADMIN_NAME ,
59
- \Magento \TestFramework \Bootstrap::ADMIN_PASSWORD
60
- );
61
50
}
62
51
63
52
/**
You can’t perform that action at this time.
0 commit comments