PHP Class VersionPress\Tests\Utils\ChangeInfoUtils

ファイルを表示 Open project: versionpress/versionpress Class Usage Examples

Public Methods

Method Description
captureSameAction ( TrackedChangeInfo | ChangeInfoEnvelope $changeInfo1, TrackedChangeInfo | ChangeInfoEnvelope $changeInfo2 ) : boolean Returns true if two changeinfos capture the same thing, i.e., if their commits are logically equivalent. Currently compares that it was the same action on the same entity (incl. VPID) and that the set of custom VP tags is the same (keys must be the same, values may differ).
containsAction ( ChangeInfoEnvelope | UntrackedChangeInfo $changeInfo, string $fullAction ) : boolean
getCustomTagValue ( VersionPress\ChangeInfos\ChangeInfo $changeInfo, string $tagKey ) : string | null
getFullAction ( VersionPress\ChangeInfos\ChangeInfo $changeInfo ) : string Returns full action such as "post/edit" or "wordpress/update".
getTrackedChangeInfo ( VersionPress\ChangeInfos\ChangeInfo $changeInfo ) : TrackedChangeInfo Returns an actionable tracked change info (ChangeInfoEnvelope isn't so it returns its most important internal changeinfo).
getVpid ( $changeInfo )

Private Methods

Method Description
bothAreEnvelopesContainingTheSame ( ChangeInfoEnvelope $firstChangeInfo, ChangeInfoEnvelope $secondChangeInfo ) : boolean
firstIsEnvelopeContainingSecond ( $firstChangeInfo, $secondChangeInfo )
listsContainSameChangeInfos ( TrackedChangeInfo[] $firstChangeInfoList, TrackedChangeInfo[] $secondChangeInfoList ) : boolean

Method Details

captureSameAction() public static method

Returns true if two changeinfos capture the same thing, i.e., if their commits are logically equivalent. Currently compares that it was the same action on the same entity (incl. VPID) and that the set of custom VP tags is the same (keys must be the same, values may differ).
public static captureSameAction ( TrackedChangeInfo | ChangeInfoEnvelope $changeInfo1, TrackedChangeInfo | ChangeInfoEnvelope $changeInfo2 ) : boolean
$changeInfo1 VersionPress\ChangeInfos\TrackedChangeInfo | VersionPress\ChangeInfos\ChangeInfoEnvelope
$changeInfo2 VersionPress\ChangeInfos\TrackedChangeInfo | VersionPress\ChangeInfos\ChangeInfoEnvelope
return boolean

containsAction() public static method

public static containsAction ( ChangeInfoEnvelope | UntrackedChangeInfo $changeInfo, string $fullAction ) : boolean
$changeInfo VersionPress\ChangeInfos\ChangeInfoEnvelope | VersionPress\ChangeInfos\UntrackedChangeInfo
$fullAction string
return boolean

getCustomTagValue() public static method

public static getCustomTagValue ( VersionPress\ChangeInfos\ChangeInfo $changeInfo, string $tagKey ) : string | null
$changeInfo VersionPress\ChangeInfos\ChangeInfo
$tagKey string
return string | null Value or null if key not found

getFullAction() public static method

Note: changeinfo objects in production code don't have a need to represent the concept of "full action"; tracked entities simply have entity names and actions. This helper is so far useful only in tests so it has been moved here.
public static getFullAction ( VersionPress\ChangeInfos\ChangeInfo $changeInfo ) : string
$changeInfo VersionPress\ChangeInfos\ChangeInfo
return string

getTrackedChangeInfo() public static method

Returns an actionable tracked change info (ChangeInfoEnvelope isn't so it returns its most important internal changeinfo).
public static getTrackedChangeInfo ( VersionPress\ChangeInfos\ChangeInfo $changeInfo ) : TrackedChangeInfo
$changeInfo VersionPress\ChangeInfos\ChangeInfo
return VersionPress\ChangeInfos\TrackedChangeInfo

getVpid() public static method

public static getVpid ( $changeInfo )