PHP User::_create Examples

PHP User::_create - 9 examples found. These are the top rated real world PHP examples of User::_create extracted from open source projects. You can rate examples to help us improve the quality of examples.
Example #1
0
 public function testCreate()
 {
     $user = User::_create(array('name' => 'test'));
     $this->assertTrue(User::$callback_tests['before_create']);
     $this->assertTrue(User::$callback_tests['after_create']);
     $this->assertTrue(User::$callback_tests['before_validation']);
     $this->assertTrue(User::$callback_tests['after_validation']);
 }
 public static function create_pearfarm_user()
 {
     foreach (array('pearfarm', 'dev', 'www', 'blog') as $user) {
         $u = User::_create(array('username' => $user, 'password' => 'mmm_pears', 'email' => 'jetviper21@gmail.com'));
     }
     $u->active = true;
     $u->save();
 }
 public static function create_users()
 {
     $u = User::_create(array('username' => 'bob', 'password' => 'password', 'email' => 'whoa@pearfarm.org'));
     $u->active = true;
     $u->save();
     User::_create(array('username' => 'joe', 'password' => 'password', 'email' => 'whoa@pearfarm.org'));
     User::_create(array('username' => 'jim', 'password' => 'password', 'email' => 'whoa@pearfarm.org'));
     $u = User::_create(array('username' => 'steve', 'password' => 'password', 'email' => 'whoa@pearfarm.org'));
     $u->active = true;
     $u->save();
 }
Example #4
0
function load_test_data()
{
    $users = array('Tim', 'Steve', 'Joe', 'Bob', 'John', 'Scott', 'Randy', 'Jessica', 'Julie');
    Photo::truncate();
    User::truncate();
    foreach ($users as $user) {
        $_user = User::_create(array('name' => $user, 'my_int' => ''));
        foreach (range(0, 100) as $i) {
            Photo::_create(array('user_id' => $_user->id, 'title' => 'photo_' . $i));
        }
    }
}
Example #5
0
 public function testUpdateFails()
 {
     $user = User::_create($this->user_data);
     $u = User::update($user->id, array('name' => NULL));
     $this->assertFalse($u->test_before_create);
     $this->assertFalse($u->test_after_create);
     $this->assertFalse($u->test_before_save);
     $this->assertFalse($u->test_after_save);
     $this->assertTrue($u->test_before_validations);
     $this->assertTrue($u->test_after_validations);
     $this->assertFalse($u->test_before_update);
     $this->assertFalse($u->test_after_update);
 }
Example #6
0
 function testCreateNewUserWithPhotos()
 {
     $user = User::_create(array('name' => 'bob2'));
     $id = $user->id;
     $this->assertTrue(!empty($id) && is_numeric($id));
     $this->assertTrue($user->saved);
     foreach (range(0, 100) as $i) {
         $photo = Photo::_create(array('user_id' => $id, 'title' => 'my photo ' . $i));
         $id2 = $photo->id;
         $this->assertTrue(!empty($id2) && is_numeric($id2));
         $this->assertTrue($photo->saved);
     }
 }
Example #7
0
 function create()
 {
     if (isset($_POST['save'])) {
         $user_password = trim($this->input->post('password'));
         $salt = "bU-View9*-ixFaNzatj";
         $user_password .= $salt;
         $user_password = sha1($user_password);
         $data = array('fullname' => trim($this->input->post('fullname')), 'password' => $user_password, 'useremail' => trim($this->input->post('useremail')), 'state' => trim($this->input->post('state')), 'user_type_id' => trim($this->input->post('user_type_id')), 'created_date' => date('Y-m-d h:m:s'), 'changed_date' => date('Y-m-d h:m:s'));
         $dataIn = $this->crud_model->insertData('user', $data);
         if ($dataIn) {
             $this->admintemp->write('message', 'User Saved Successfully');
             if ($this->input->post('user_type_id') == 3) {
                 redirect('user/golfusers');
             } else {
                 redirect('user');
             }
         } else {
             $this->admintemp->write('error', 'An error occured while inserting the section.');
             User::index();
         }
     } else {
         User::_create();
     }
 }
Example #8
0
function create_users()
{
    foreach (range(1, 10) as $i) {
        User::_create(array('name' => 'names' . $i, 'my_int' => $i));
    }
}
Example #9
0
 public function testMassDeleteManyArgs()
 {
     $start = User::count(array('cache' => false));
     $users = array();
     foreach (range(0, 3) as $i) {
         $users[] = $u = User::_create(array('name' => 'test_name' . $i, 'my_int' => 12 + $i));
         $this->assertTrue($u->saved);
         unset($u);
     }
     $this->assertEquals(User::count(array('cache' => false)), $start + 4);
     $ids = collect(function ($u) {
         return $u->id;
     }, $users);
     call_user_func_array(array('User', 'delete'), $ids);
     try {
         User::find($ids);
     } catch (NimbleRecordNotFound $e) {
         $this->assertTrue(is_a($e, 'NimbleRecordNotFound'));
         $this->assertEquals(User::count(array('cache' => false)), $start);
     }
 }