/**
  * @param int $customerId
  * @param array $data
  * @dataProvider testLogDataProvider
  * @return void
  */
 public function testLog($customerId, $data)
 {
     $tableName = 'customer_log_table_name';
     $data = array_filter($data);
     if (!$data) {
         $this->setExpectedException('\\InvalidArgumentException', 'Log data is empty');
         $this->logger->log($customerId, $data);
         return;
     }
     $this->resource->expects($this->once())->method('getConnection')->with('write')->willReturn($this->adapter);
     $this->resource->expects($this->once())->method('getTableName')->with('customer_log')->willReturn($tableName);
     $this->adapter->expects($this->once())->method('insertOnDuplicate')->with($tableName, array_merge(['customer_id' => $customerId], $data), array_keys($data));
     $this->assertEquals($this->logger, $this->logger->log($customerId, $data));
 }
 /**
  * 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)]);
 }