public function itDoesNotIndexByLdapIdWhenNoLdapId()
 {
     $user = mock('User\\XML\\Import\\ReadyToBeImportedUser');
     $id = 108;
     $username = '******';
     $ldap_id = '';
     $this->collection->add($user, $id, $username, $ldap_id);
     $this->expectException('User\\XML\\Import\\UserNotFoundException');
     $this->collection->getUserByLdapId($ldap_id);
 }
 /** @return UsersToBeImportedCollection */
 public function build(SimpleXMLElement $xml)
 {
     $collection = new UsersToBeImportedCollection();
     foreach ($xml as $user) {
         $to_be_imported_user = $this->instantiateUserToBeImported($user);
         $collection->add($to_be_imported_user);
     }
     return $collection;
 }
 public function itDumpsToBeMappedUser()
 {
     $user1 = mock('PFUser');
     stub($user1)->getUserName()->returns('john');
     stub($user1)->getRealName()->returns('John Doe');
     stub($user1)->getEmail()->returns('*****@*****.**');
     stub($user1)->getStatus()->returns('A');
     $user2 = mock('PFUser');
     stub($user2)->getUserName()->returns('admin_john');
     stub($user2)->getRealName()->returns('John Doe (admin)');
     stub($user2)->getEmail()->returns('*****@*****.**');
     stub($user2)->getStatus()->returns('A');
     $this->collection->add(new ToBeMappedUser('jdoe', 'John Doe', array($user1, $user2), 104, 'ldap1234'));
     $this->collection->toCSV($this->output_filename);
     $data = $this->getCSVFirstData();
     $this->assertEqual($data, array('jdoe', 'map:', 'User John Doe (jdoe) has the same email address than following users: John Doe (john) [A], John Doe (admin) (admin_john) [A].' . ' Use one of the following actions to confirm the mapping: "map:john", "map:admin_john".'));
 }
 protected function addToBeMappedUserToCollection()
 {
     $this->collection->add(new ToBeMappedUser('to.be.mapped', 'To Be Mapped', array(aUser()->withUserName('cstevens')->build()), 104, 'ldap1234'));
 }