Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
U
UserAdminV2
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
庄欣
UserAdminV2
Commits
f8e63f31
Commit
f8e63f31
authored
Oct 16, 2011
by
Taylor Otwell
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
adding validator tests.
parent
8bd6d346
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
32 additions
and
1 deletions
+32
-1
laravel/validation/validator.php
+1
-1
tests/Cases/ValidatorTest.php
+31
-0
No files found.
laravel/validation/validator.php
View file @
f8e63f31
...
@@ -208,7 +208,7 @@ class Validator {
...
@@ -208,7 +208,7 @@ class Validator {
*/
*/
protected
function
validate_required
(
$attribute
,
$value
)
protected
function
validate_required
(
$attribute
,
$value
)
{
{
return
(
is_null
(
$value
)
or
(
is_string
(
$value
)
and
trim
(
$value
)
===
''
));
return
!
(
is_null
(
$value
)
or
(
is_string
(
$value
)
and
trim
(
$value
)
===
''
));
}
}
/**
/**
...
...
tests/Cases/ValidatorTest.php
0 → 100644
View file @
f8e63f31
<?php
use
Laravel\Validation\Validator
;
class
ValidatorTest
extends
PHPUnit_Framework_TestCase
{
public
function
test_simple_group_of_validations
()
{
$rules
=
array
(
'email'
=>
'required|email'
,
'password'
=>
'required|confirmed|min:6'
,
'name'
=>
'required|alpha'
,
);
$attributes
=
array
(
'email'
=>
'taylorotwell'
,
'password'
=>
'something'
,
'password_confirmation'
=>
'something'
,
'name'
=>
'taylor5'
,
);
$messages
=
array
(
'name_alpha'
=>
'The name must be alphabetic!'
);
$validator
=
Validator
::
make
(
$attributes
,
$rules
,
$messages
);
$this
->
assertFalse
(
$validator
->
valid
());
$this
->
assertFalse
(
$validator
->
errors
->
has
(
'password'
));
}
}
\ No newline at end of file
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment