Exemplo n.º 1
0
 public function testTableName()
 {
     $this->given($tablename = \website\model\User::tableName())->then->string($tablename)->isEqualTo('USER');
 }
Exemplo n.º 2
0
<?php

require_once 'autoload.php';
use website\Common;
use website\model\User;
use website\utils\Password;
use website\model\Module;
use website\model\StudentModuleSubscription;
use website\model\TeacherModuleSubscription;
$common = Common::getInstance();
$common->db()->exec('DELETE FROM ' . StudentModuleSubscription::tableName());
$common->db()->exec('DELETE FROM ' . TeacherModuleSubscription::tableName());
$common->db()->exec('DELETE FROM ' . User::tableName());
$common->db()->exec('DELETE FROM ' . Module::tableName());
$bananaHashed = Password::hash('banana', false);
$admin = new User();
$admin->first_name = "super admin";
$admin->last_name = "nameless";
$admin->login = '******';
$admin->password = $bananaHashed;
$admin->role = 'admin';
$admin->address = 'nowhere';
$admin->date_of_birth = '2000-01-01';
$admin->phone = '000';
$admin->email = '*****@*****.**';
$admin->valid = true;
$admin->save();
$prof = new User();
$prof->first_name = "teneyug";
$prof->last_name = "nameless";
$prof->login = '******';