/**
  * @expectedException        \Symfony\Component\Security\Core\Exception\BadCredentialsException
  * @expectedExceptionMessage You don't have access to organization 'Inactive Org'
  */
 public function testBadOrganizationAuthenticate()
 {
     $organization = new Organization(2);
     $organization->setEnabled(false);
     $organization->setName('Inactive Org');
     $user = new User(1);
     $user->addOrganization($organization);
     $token = new OrganizationRememberMeToken($user, 'provider', 'testKey', $organization);
     $this->userChecker->expects($this->once())->method('checkPreAuth');
     $this->provider->authenticate($token);
 }
 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);
 }