public function testEmailValidation() { $this->specify("email is required", function () { $this->model->email = null; expect("email should not be empty", $this->model->validate(['email']))->false(); }); $this->specify("email is trimed", function () { $this->model->email = ' asd@asd.com'; $this->model->validate(['email']); expect("email should be trimed left", $this->model->email)->same('*****@*****.**'); $this->model->email = 'asd@asd.com '; $this->model->validate(['email']); expect("email should be trimed right", $this->model->email)->same('*****@*****.**'); $this->model->email = ' asd@asd.com '; $this->model->validate(['email']); expect("email should be trimed both side", $this->model->email)->same('*****@*****.**'); }); $this->specify("email is valid email adress", function () { $this->model->email = 'John Smith <*****@*****.**>'; expect("email should not be with name", $this->model->validate(['email']))->false(); $this->model->email = '*****@*****.**'; expect("property `email` should be without name", $this->model->validate(['email']))->true(); }); }