I'm doing a school project and we have to submit some unit testing examples . I read many tutorials but having trouble understanding how to use it .
This is my code below ,
I'm trying to check my validation rules by manual input :
<?php
class Student {
public static $rules = array(
'username'=>'required|alpha_num|min:6',
'firstname'=>'required|alpha|min:2',
'lastname'=>'required|alpha|min:2',
'studentid'=>'numeric|min:7|unique:student',
'email'=>'required|email|unique:student',
'password'=>'required|alpha_num|between:6,12|confirmed',
'password_confirmation'=>'required|alpha_num|between:6,12'
);
}
class ChronosTest extends TestCase {
public function testUser()
{
$student = new Student;
//$student->username = "john433";
$validator = Validator::make(array("username"=>"john433", "firstname"=>"johne"), Student::$rules);
$this->assertTrue($validator->passes());
}
}
I get this everytime i use assertTrue :

(source: 4.ii.gl)
I get this everytime i use assertFalse :

(source: 1.ii.gl)