Page Menu
Home
Phorge
Search
Configure Global Search
Log In
Files
F461384
ConpherenceTestCase.php
No One
Temporary
Actions
Download File
Edit File
Delete File
View Transforms
Subscribe
Flag For Later
Award Token
Size
2 KB
Referenced Files
None
Subscribers
None
ConpherenceTestCase.php
View Options
<?php
abstract
class
ConpherenceTestCase
extends
PhabricatorTestCase
{
protected
function
addParticipants
(
PhabricatorUser
$actor
,
ConpherenceThread
$conpherence
,
array
$participant_phids
)
{
$xactions
=
array
(
id
(
new
ConpherenceTransaction
())
->
setTransactionType
(
ConpherenceTransaction
::
TYPE_PARTICIPANTS
)
->
setNewValue
(
array
(
'+'
=>
$participant_phids
)),
);
$editor
=
id
(
new
ConpherenceEditor
())
->
setActor
(
$actor
)
->
setContentSource
(
PhabricatorContentSource
::
newConsoleSource
())
->
applyTransactions
(
$conpherence
,
$xactions
);
}
protected
function
removeParticipants
(
PhabricatorUser
$actor
,
ConpherenceThread
$conpherence
,
array
$participant_phids
)
{
$xactions
=
array
(
id
(
new
ConpherenceTransaction
())
->
setTransactionType
(
ConpherenceTransaction
::
TYPE_PARTICIPANTS
)
->
setNewValue
(
array
(
'-'
=>
$participant_phids
)),
);
$editor
=
id
(
new
ConpherenceEditor
())
->
setActor
(
$actor
)
->
setContentSource
(
PhabricatorContentSource
::
newConsoleSource
())
->
applyTransactions
(
$conpherence
,
$xactions
);
}
protected
function
addMessageWithFile
(
PhabricatorUser
$actor
,
ConpherenceThread
$conpherence
)
{
$file
=
$this
->
generateTestFile
(
$actor
);
$message
=
Filesystem
::
readRandomCharacters
(
64
).
sprintf
(
' {%s} '
,
$file
->
getMonogram
());
$editor
=
id
(
new
ConpherenceEditor
())
->
setActor
(
$actor
)
->
setContentSource
(
PhabricatorContentSource
::
newConsoleSource
());
$xactions
=
$editor
->
generateTransactionsFromText
(
$actor
,
$conpherence
,
$message
);
return
$editor
->
applyTransactions
(
$conpherence
,
$xactions
);
}
private
function
generateTestFile
(
PhabricatorUser
$actor
)
{
$engine
=
new
PhabricatorTestStorageEngine
();
$data
=
Filesystem
::
readRandomCharacters
(
64
);
$params
=
array
(
'name'
=>
'test.'
.
$actor
->
getPHID
(),
'viewPolicy'
=>
$actor
->
getPHID
(),
'authorPHID'
=>
$actor
->
getPHID
(),
'storageEngines'
=>
array
(
$engine
,
),
);
$file
=
PhabricatorFile
::
newFromFileData
(
$data
,
$params
);
$file
->
save
();
return
$file
;
}
}
File Metadata
Details
Attached
Mime Type
text/x-php
Expires
Mon, May 5, 4:47 PM (2 d)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
72271
Default Alt Text
ConpherenceTestCase.php (2 KB)
Attached To
Mode
rP Phorge
Attached
Detach File
Event Timeline
Log In to Comment