Files
snipe-it/tests/unit/UserTest.php
T
2015-08-11 18:27:28 -07:00

29 lines
601 B
PHP

<?php
class UserTest extends TestCase {
/**
* Username is required
*/
public function testUsernameIsRequired()
{
// Create a new User
$user = new User;
$user->email = "name@example.com";
$user->password = "password";
// User should not save
$this->assertFalse($user->save());
// Save the errors
$errors = $user->errors()->all();
// There should be 1 error
$this->assertCount(1, $errors);
// The username error should be set
$this->assertEquals($errors[0], "The username field is required.");
}
}