Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Submit feedback
Sign in
Toggle navigation
S
solarium
Project overview
Project overview
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Commits
Open sidebar
common
solarium
Commits
b0f45027
Commit
b0f45027
authored
Jan 13, 2012
by
stefanooldeman
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
add failing and success for formatDate
parent
8fe28ca9
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
26 additions
and
17 deletions
+26
-17
tests/Solarium/Query/HelperTest.php
tests/Solarium/Query/HelperTest.php
+26
-17
No files found.
tests/Solarium/Query/HelperTest.php
View file @
b0f45027
...
@@ -187,48 +187,57 @@ class Solarium_Query_HelperTest extends PHPUnit_Framework_TestCase
...
@@ -187,48 +187,57 @@ class Solarium_Query_HelperTest extends PHPUnit_Framework_TestCase
public
function
testFormatTimestampInput
()
public
function
testFormatTimestampInput
()
{
{
$actual
=
$this
->
_helper
->
formatDate
(
strtotime
(
'2011-10-01'
));
$this
->
assertFalse
(
$this
->
_helper
->
formatDate
(
strtotime
(
'2011---'
)),
'Expects invalid strtotime/timestamp input (false) not to be accpted'
);
//allow negative dates.
$this
->
assertNotEquals
(
$this
->
assertNotEquals
(
false
,
false
,
$actual
,
$this
->
_helper
->
formatDate
(
strtotime
(
strtotime
(
'2011-10-01'
))),
'Expects timestamp input to be accpted'
'Expects negative timestamp input to be accpted'
);
//@todo find out if we need to any test for php versions / platforms which do not support negative timestamp
$this
->
assertFalse
(
$this
->
_helper
->
formatDate
(
strtotime
(
'2010-31-02'
)),
'Expects invalid timestamp input (not in calendar) not to be accpted'
);
);
$this
->
assertEquals
(
$this
->
assertEquals
(
$this
->
_mockFormatDateOutput
(
strtotime
(
'2011-10-01'
)),
$this
->
_mockFormatDateOutput
(
strtotime
(
'2011-10-01'
)),
$
actual
,
$
this
->
_helper
->
formatDate
(
strtotime
(
'2011-10-01'
))
,
'Expects formatDate with Timstamp input to output ISO8601 with stripped timezone'
'Expects formatDate with Timstamp input to output ISO8601 with stripped timezone'
);
);
}
}
public
function
testFormatDateStringInput
()
public
function
testFormatDateStringInput
()
{
{
$actual
=
$this
->
_helper
->
formatDate
(
date
(
'Y-m-d'
,
strtotime
(
'2011-10-01'
)));
$this
->
assertFalse
(
$this
->
_helper
->
formatDate
(
date
(
'Y-m-d'
,
strtotime
(
'2011-11-31'
))),
$this
->
assertNotEquals
(
'Expects an invalid date string input not to be accepted'
false
,
$actual
,
'Expects date string inputs to be accepted'
);
);
$this
->
assertEquals
(
$this
->
assertEquals
(
$this
->
_mockFormatDateOutput
(
strtotime
(
'2011-10-01'
)),
$this
->
_mockFormatDateOutput
(
strtotime
(
'2011-10-01'
)),
$
actual
,
$
this
->
_helper
->
formatDate
(
date
(
'Y-m-d'
,
strtotime
(
'2011-10-01'
)))
,
'Expects formatDate with String input to output ISO8601 with stripped timezone'
'Expects formatDate with String input to output ISO8601 with stripped timezone'
);
);
}
}
public
function
testFormatDateTimeInput
()
public
function
testFormatDateTimeInput
()
{
{
$actual
=
$this
->
_helper
->
formatDate
(
new
DateTime
(
strtotime
(
'2011-10-01'
)));
$this
->
assertNotEquals
(
$this
->
assertFalse
(
false
,
$this
->
_helper
->
formatDate
(
new
stdClass
()),
$actual
,
'Expect any other object not to be accepted'
'Expects DateTime object to be accepted'
);
);
$this
->
assertEquals
(
$this
->
assertEquals
(
$this
->
_mockFormatDateOutput
(
strtotime
(
'2011-10-01'
)),
$this
->
_mockFormatDateOutput
(
strtotime
(
'2011-10-01'
)),
$
actual
,
$
this
->
_helper
->
formatDate
(
new
DateTime
(
strtotime
(
'2011-10-01'
)))
,
'Expects formatDate with DateTime input to output ISO8601 with stripped timezone'
'Expects formatDate with DateTime input to output ISO8601 with stripped timezone'
);
);
}
}
...
...
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