Page Menu
Home
c4science
Search
Configure Global Search
Log In
Files
F77455665
PhabricatorQueryOrderTestCase.php
No One
Temporary
Actions
Download File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Award Token
Subscribers
None
File Metadata
Details
File Info
Storage
Attached
Created
Wed, Aug 14, 14:36
Size
1 KB
Mime Type
text/x-php
Expires
Fri, Aug 16, 14:36 (1 d, 23 h)
Engine
blob
Format
Raw Data
Handle
19873180
Attached To
rPH Phabricator
PhabricatorQueryOrderTestCase.php
View Options
<?php
final
class
PhabricatorQueryOrderTestCase
extends
PhabricatorTestCase
{
public
function
testQueryOrderItem
()
{
$item
=
PhabricatorQueryOrderItem
::
newFromScalar
(
'id'
);
$this
->
assertEqual
(
'id'
,
$item
->
getOrderKey
());
$this
->
assertEqual
(
false
,
$item
->
getIsReversed
());
$item
=
PhabricatorQueryOrderItem
::
newFromScalar
(
'-id'
);
$this
->
assertEqual
(
'id'
,
$item
->
getOrderKey
());
$this
->
assertEqual
(
true
,
$item
->
getIsReversed
());
}
public
function
testQueryOrderBadVectors
()
{
$bad
=
array
(
array
(),
null
,
1
,
array
(
2
),
array
(
'id'
,
'id'
),
array
(
'id'
,
'-id'
),
);
foreach
(
$bad
as
$input
)
{
$caught
=
null
;
try
{
PhabricatorQueryOrderVector
::
newFromVector
(
$input
);
}
catch
(
Exception
$ex
)
{
$caught
=
$ex
;
}
$this
->
assertTrue
((
$caught
instanceof
Exception
));
}
}
public
function
testQueryOrderVector
()
{
$vector
=
PhabricatorQueryOrderVector
::
newFromVector
(
array
(
'a'
,
'b'
,
'-c'
,
'd'
,
));
$this
->
assertEqual
(
array
(
'a'
=>
'a'
,
'b'
=>
'b'
,
'c'
=>
'c'
,
'd'
=>
'd'
,
),
mpull
(
iterator_to_array
(
$vector
),
'getOrderKey'
));
$this
->
assertEqual
(
array
(
'a'
=>
false
,
'b'
=>
false
,
'c'
=>
true
,
'd'
=>
false
,
),
mpull
(
iterator_to_array
(
$vector
),
'getIsReversed'
));
}
}
Event Timeline
Log In to Comment