public function testBadOrganizationAuthenticate()
 {
     $user = new User(1);
     $organization = new Organization(2);
     $organization->setEnabled(false);
     $role = new Role('test');
     $user->setOrganizations(new ArrayCollection([$organization]));
     $user->setRoles(new ArrayCollection([$role]));
     $token = new OrganizationRememberMeToken($user, 'provider', 'testKey', $organization);
     $this->userChecker->expects($this->once())->method('checkPreAuth');
     $this->setExpectedException('Symfony\\Component\\Security\\Core\\Exception\\BadCredentialsException');
     $this->provider->authenticate($token);
 }
 /**
  * @expectedException        \Symfony\Component\Security\Core\Exception\BadCredentialsException
  * @expectedExceptionMessage You don't have active organization assigned.
  */
 public function testNoAssignedOrganizations()
 {
     $user = new User(1);
     $token = new RememberMeToken($user, 'provider', 'testKey');
     $this->userChecker->expects($this->once())->method('checkPreAuth');
     $this->provider->authenticate($token);
 }