Example #1
0
 public function testManageUser()
 {
     $this->user->register($this->getUserInfo());
     // Save user ID
     $UID = $this->user->ID;
     $this->user->login('pablo', 1234);
     $this->assertFalse($this->user->log->hasError());
     $this->assertTrue($this->user->isSigned());
     $user = $this->user->manageUser($UID);
     $this->assertInstanceOf('\\ptejada\\uFlex\\User', $user);
     $this->assertNotEquals('jose', $user->Username);
     $result = $user->update(array('Username' => 'jose'));
     $this->assertTrue($result);
     $this->assertEquals('jose', $user->Username);
     // Reload the user from the DB to confirm update
     $user = $this->user->manageUser($UID);
     $this->assertEquals('jose', $user->Username);
     // confirm the main user was not affected
     $this->assertEquals('pablo', $this->user->Username);
 }