Skip to content

Commit

Permalink
magento2-login-as-customer/issues/90: Logging update.
Browse files Browse the repository at this point in the history
  • Loading branch information
engcom-Foxtrot committed Apr 27, 2020
1 parent 9cf2a1c commit 4a30707
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 21 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -39,16 +39,18 @@ public function __construct(
public function afterPlace(Order $subject, Order $result): Order
{
$adminUser = $this->userSession->getUser();
$subject->addCommentToStatusHistory(
'Order Placed by Store Administrator',
false,
true
)->setIsCustomerNotified(false);
$subject->addCommentToStatusHistory(
"Order Placed by {$adminUser->getFirstName()} {$adminUser->getLastName()} using Admin Panel",
false,
false
)->setIsCustomerNotified(false);
if ($adminUser) {
$subject->addCommentToStatusHistory(
'Order Placed by Store Administrator',
false,
true
)->setIsCustomerNotified(false);
$subject->addCommentToStatusHistory(
"Order Placed by {$adminUser->getFirstName()} {$adminUser->getLastName()} using Admin Panel",
false,
false
)->setIsCustomerNotified(false);
}

return $result;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@
*/
namespace Magento\Sales\Model\AdminOrder;

use Magento\Backend\Model\Auth;
use Magento\Backend\Model\Session\Quote as SessionQuote;
use Magento\Customer\Api\AddressRepositoryInterface;
use Magento\Customer\Api\CustomerRepositoryInterface;
Expand Down Expand Up @@ -43,21 +42,11 @@ class CreateTest extends \PHPUnit\Framework\TestCase
*/
private $objectManager;

/**
* @var Auth
*/
private $auth;

protected function setUp()
{
$this->objectManager = Bootstrap::getObjectManager();
$this->messageManager = $this->objectManager->get(ManagerInterface::class);
$this->model =$this->objectManager->create(Create::class, ['messageManager' => $this->messageManager]);
$this->auth = $this->objectManager->create(Auth::class);
$this->auth->login(
\Magento\TestFramework\Bootstrap::ADMIN_NAME,
\Magento\TestFramework\Bootstrap::ADMIN_PASSWORD
);
}

/**
Expand Down

0 comments on commit 4a30707

Please sign in to comment.