/**
  * Test user creation
  */
 public function testCreateUser()
 {
     $uid = TaskerMAN\Application\UserManagement::create($this->email, $this->name, $this->password, $this->admin);
     // Test that user was created correctly
     $this->assertTrue(is_numeric($uid));
     // Test loading the user
     $this->loadUser($uid);
     // Test that they can log in
     $this->login($uid);
     // Delete test user
     $this->deleteUser($uid);
 }
Exemplo n.º 2
0
<?php

// Hide default template
TaskerMAN\WebInterface\WebInterface::showTemplate(false);
// Intialize installation engine
$install = new TaskerMAN\Core\Install();
if (!$install->required()) {
    throw new TaskerMAN\Core\FatalException('Install Not Required', new \Exception('All database tables already exist, so an install is not required.'));
}
$alert = null;
if (isset($_POST['submit'])) {
    // Create tables
    $install->createTables();
    // Create user
    try {
        $uid = TaskerMAN\Application\UserManagement::create(TaskerMAN\Core\IO::POST('email'), TaskerMAN\Core\IO::POST('name'), TaskerMAN\Core\IO::POST('password'), true);
        header('Location: index.php?p=user&id=' . $uid);
    } catch (TaskerMAN\Application\UserManagementException $e) {
        $alert = '<div class="alert alert-danger" role="alert">' . $e->getMessage() . '</div>';
    }
}
?>

<!DOCTYPE html>
<html lang="en">
  <head>
    <meta charset="utf-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1">

    <title>Install &middot; TaskerMAN</title>