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
49331d74
Commit
49331d74
authored
Sep 07, 2012
by
Franz Liedke
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add unit tests for date_format validator rule.
parent
a56f0b2f
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
22 additions
and
0 deletions
+22
-0
laravel/tests/cases/validator.test.php
+22
-0
No files found.
laravel/tests/cases/validator.test.php
View file @
49331d74
...
@@ -484,6 +484,28 @@ class ValidatorTest extends PHPUnit_Framework_TestCase {
...
@@ -484,6 +484,28 @@ class ValidatorTest extends PHPUnit_Framework_TestCase {
}
}
/**
/**
* Tests the date_format validation rule.
*
* @group laravel
*/
public
function
testTheDateFormatRule
()
{
$input
=
array
(
'date'
=>
'15-Feb-2009'
);
$rules
=
array
(
'date'
=>
'date_format:j-M-Y'
);
$this
->
assertTrue
(
Validator
::
make
(
$input
,
$rules
)
->
valid
());
$input
[
'date'
]
=
'2009-02-15 15:16:17'
;
$rules
=
array
(
'date'
=>
'date_format:Y-m-d H\\:i\\:s'
);
$this
->
assertTrue
(
Validator
::
make
(
$input
,
$rules
)
->
valid
());
$input
[
'date'
]
=
'2009-02-15'
;
$this
->
assertFalse
(
Validator
::
make
(
$input
,
$rules
)
->
valid
());
$input
[
'date'
]
=
'15:16:17'
;
$this
->
assertFalse
(
Validator
::
make
(
$input
,
$rules
)
->
valid
());
}
/**
* Test that the validator sets the correct messages.
* Test that the validator sets the correct messages.
*
*
* @group laravel
* @group laravel
...
...
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