Page Menu
Home
Phabricator
Search
Configure Global Search
Log In
Files
F19082516
HarbormasterAutotargetsTestCase.php
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Award Token
Flag For Later
Size
1 KB
Referenced Files
None
Subscribers
None
HarbormasterAutotargetsTestCase.php
View Options
<?php
final
class
HarbormasterAutotargetsTestCase
extends
PhabricatorTestCase
{
protected
function
getPhabricatorTestCaseConfiguration
()
{
return
array
(
self
::
PHABRICATOR_TESTCONFIG_BUILD_STORAGE_FIXTURES
=>
true
,
);
}
public
function
testGenerateHarbormasterAutotargets
()
{
$viewer
=
$this
->
generateNewTestUser
();
$raw_diff
=
<<<EODIFF
diff --git a/fruit b/fruit
new file mode 100644
index 0000000..1c0f49d
--- /dev/null
+++ b/fruit
@@ -0,0 +1,2 @@
+apal
+banan
EODIFF;
$parser
=
new
ArcanistDiffParser
();
$changes
=
$parser
->
parseDiff
(
$raw_diff
);
$diff
=
DifferentialDiff
::
newFromRawChanges
(
$viewer
,
$changes
)
->
setLintStatus
(
DifferentialLintStatus
::
LINT_AUTO_SKIP
)
->
setUnitStatus
(
DifferentialUnitStatus
::
UNIT_AUTO_SKIP
)
->
attachRevision
(
null
)
->
save
();
$params
=
array
(
'objectPHID'
=>
$diff
->
getPHID
(),
'targetKeys'
=>
array
(
HarbormasterArcLintBuildStepImplementation
::
STEPKEY
,
HarbormasterArcUnitBuildStepImplementation
::
STEPKEY
,
),
);
// Creation of autotargets should work from an empty state.
$result
=
id
(
new
ConduitCall
(
'harbormaster.queryautotargets'
,
$params
))
->
setUser
(
$viewer
)
->
execute
();
$targets
=
idx
(
$result
,
'targetMap'
);
foreach
(
$params
[
'targetKeys'
]
as
$target_key
)
{
$this
->
assertTrue
((
bool
)
$result
[
'targetMap'
][
$target_key
]);
}
// Querying the same autotargets again should produce the same results,
// not make new ones.
$retry
=
id
(
new
ConduitCall
(
'harbormaster.queryautotargets'
,
$params
))
->
setUser
(
$viewer
)
->
execute
();
$this
->
assertEqual
(
$result
,
$retry
);
}
}
File Metadata
Details
Attached
Mime Type
text/x-diff
Expires
Thu, Dec 4, 11:25 AM (1 d, 21 h)
Storage Engine
blob
Storage Format
Encrypted (AES-256-CBC)
Storage Handle
8247283
Default Alt Text
HarbormasterAutotargetsTestCase.php (1 KB)
Attached To
Mode
rP Phabricator
Attached
Detach File
Event Timeline
Log In to Comment