Example #1
0
 public function testCreateUserDefaultMethod()
 {
     $user = new User(['username' => 'foo']);
     $this->assertFalse($user->isValid());
     $this->assertEquals(['email' => ['Is not a valid email address']], $user->getErrors());
     $user->email = '*****@*****.**';
     $this->assertTrue($user->isValid());
     $this->assertEquals([], $user->getErrors());
     $this->assertTrue($user->save());
     $this->assertEquals(1, $user->pk);
     $this->assertEquals('foo', $user->username);
     $this->assertNull($user->password);
     $this->assertFalse($user->is_staff);
     $this->assertFalse($user->is_superuser);
     // Mails don't send automatically
     $this->assertEquals([], $this->app->mail->out);
 }