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); }
public function testValidations() { $user = new User(array('Username' => 'Pablo', 'Password' => 'password', 'RegDate' => 1396148789)); $user->Username = '******'; $user->addValidation('Username', '1-5'); $this->assertFalse($user->log->hasError()); }