/**
  * @param Observer $observer
  * @return void
  */
 public function execute(Observer $observer)
 {
     return $this;
     $response = $observer->getEvent()->getData('response');
     $body = $response->getBody();
     $this->_logger->addDebug("--------\n\n\n BODY \n\n\n " . $body);
 }
Example #2
0
 /**
  * Retrieves customer log model
  *
  * @return \Magento\Customer\Model\Log
  */
 protected function getCustomerLog()
 {
     if (!$this->customerLog) {
         $this->customerLog = $this->customerLogger->get($this->getCustomer()->getId());
     }
     return $this->customerLog;
 }
Example #3
0
 /**
  * @param int $customerId
  * @param array $data
  * @dataProvider testGetDataProvider
  * @return void
  */
 public function testGet($customerId, $data)
 {
     $logArguments = ['customerId' => $data['customer_id'], 'lastLoginAt' => $data['last_login_at'], 'lastLogoutAt' => $data['last_logout_at'], 'lastVisitAt' => $data['last_visit_at']];
     $select = $this->getMock('Magento\\Framework\\DB\\Select', [], [], '', false);
     $select->expects($this->any())->method('from')->willReturnSelf();
     $select->expects($this->any())->method('joinLeft')->willReturnSelf();
     $select->expects($this->any())->method('where')->willReturnSelf();
     $select->expects($this->any())->method('order')->willReturnSelf();
     $select->expects($this->any())->method('limit')->willReturnSelf();
     $this->adapter->expects($this->any())->method('select')->willReturn($select);
     $this->resource->expects($this->once())->method('getConnection')->with('read')->willReturn($this->adapter);
     $this->adapter->expects($this->any())->method('fetchRow')->with($select)->willReturn($data);
     $log = $this->getMock('Magento\\Customer\\Model\\Log', [], $logArguments);
     $this->logFactory->expects($this->any())->method('create')->with($logArguments)->willReturn($log);
     $this->assertEquals($log, $this->logger->get($customerId));
 }
 /**
  * Handler for 'customer_logout' event.
  *
  * @param Observer $observer
  * @return void
  */
 public function execute(Observer $observer)
 {
     $this->logger->log($observer->getEvent()->getCustomer()->getId(), ['last_logout_at' => (new \DateTime())->format(\Magento\Framework\Stdlib\DateTime::DATETIME_PHP_FORMAT)]);
 }