/**
  * Test case when module is enabled and user is logged in
  *
  * @return void
  */
 public function testReportConcurrentAdmins()
 {
     $testAction = 'JSON string';
     /** @var \Magento\Framework\Event\Observer|\PHPUnit_Framework_MockObject_MockObject $eventObserver */
     $eventObserver = $this->getMockBuilder('Magento\\Framework\\Event\\Observer')->disableOriginalConstructor()->getMock();
     $this->config->expects($this->once())->method('isNewRelicEnabled')->willReturn(true);
     $this->backendAuthSession->expects($this->once())->method('isLoggedIn')->willReturn(true);
     $userMock = $this->getMockBuilder('Magento\\User\\Model\\User')->disableOriginalConstructor()->getMock();
     $this->backendAuthSession->expects($this->once())->method('getUser')->willReturn($userMock);
     $this->jsonEncoder->expects($this->once())->method('encode')->willReturn($testAction);
     $this->usersModel->expects($this->once())->method('setData')->with(['type' => 'admin_activity', 'action' => $testAction])->willReturnSelf();
     $this->usersModel->expects($this->once())->method('save');
     $this->model->execute($eventObserver);
 }
 /**
  * Test case when module is enabled and user is logged in
  *
  * @return void
  */
 public function testReportConcurrentUsers()
 {
     $testCustomerId = 1;
     $testAction = 'JSON string';
     /** @var \Magento\Framework\Event\Observer|\PHPUnit_Framework_MockObject_MockObject $eventObserver */
     $eventObserver = $this->getMockBuilder('Magento\\Framework\\Event\\Observer')->disableOriginalConstructor()->getMock();
     $this->config->expects($this->once())->method('isNewRelicEnabled')->willReturn(true);
     $this->customerSession->expects($this->once())->method('isLoggedIn')->willReturn(true);
     $this->customerSession->expects($this->once())->method('getCustomerId')->willReturn($testCustomerId);
     $customerMock = $this->getMockBuilder('Magento\\Customer\\Api\\Data\\CustomerInterface')->getMock();
     $this->customerRepository->expects($this->once())->method('getById')->willReturn($customerMock);
     $storeMock = $this->getMockBuilder('Magento\\Store\\Model\\Store')->disableOriginalConstructor()->getMock();
     $this->storeManager->expects($this->once())->method('getStore')->willReturn($storeMock);
     $websiteMock = $this->getMockBuilder('Magento\\Store\\Model\\Website')->disableOriginalConstructor()->getMock();
     $this->storeManager->expects($this->once())->method('getWebsite')->willReturn($websiteMock);
     $this->jsonEncoder->expects($this->once())->method('encode')->willReturn($testAction);
     $this->usersModel->expects($this->once())->method('setData')->with(['type' => 'user_action', 'action' => $testAction])->willReturnSelf();
     $this->usersModel->expects($this->once())->method('save');
     $this->model->execute($eventObserver);
 }