/**
  * @return void
  */
 public function testLogoutOtherUserSessions()
 {
     $useId = 1;
     $sessionLifetime = 100;
     $sessionId = 50;
     $this->adminSessionInfoCollectionFactoryMock->expects($this->once())->method('create')->willReturn($this->adminSessionInfoCollectionMock);
     $this->authSessionMock->expects($this->once())->method('getUser')->willReturn($this->userMock);
     $this->authSessionMock->expects($this->once())->method('getSessionId')->willReturn($sessionId);
     $this->userMock->expects($this->once())->method('getId')->willReturn($useId);
     $this->adminSessionInfoCollectionMock->expects($this->once())->method('filterByUser')->with($useId, \Magento\Security\Model\AdminSessionInfo::LOGGED_IN, $sessionId)->willReturnSelf();
     $this->securityConfigMock->expects($this->once())->method('getAdminSessionLifetime')->willReturn($sessionLifetime);
     $this->adminSessionInfoCollectionMock->expects($this->once())->method('filterExpiredSessions')->with($sessionLifetime)->willReturnSelf();
     $this->adminSessionInfoCollectionMock->expects($this->once())->method('loadData')->willReturnSelf();
     $this->adminSessionInfoCollectionMock->expects($this->once())->method('setDataToAll')->with($this->equalTo('status'), \Magento\Security\Model\AdminSessionInfo::LOGGED_OUT_MANUALLY)->willReturnSelf();
     $this->adminSessionInfoCollectionMock->expects($this->once())->method('save');
     $this->model->logoutOtherUserSessions();
 }
Ejemplo n.º 2
0
 /**
  * @return \Magento\Security\Model\ResourceModel\AdminSessionInfo\Collection
  */
 protected function createAdminSessionInfoCollection()
 {
     return $this->adminSessionInfoCollectionFactory->create();
 }