PHP Class VersionPress\Tests\Utils\ChangeInfoUtils

Afficher le fichier Open project: versionpress/versionpress Class Usage Examples

Méthodes publiques

Méthode 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

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

Method Details

captureSameAction() public static méthode

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
Résultat boolean

containsAction() public static méthode

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

getCustomTagValue() public static méthode

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

getFullAction() public static méthode

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
Résultat string

getTrackedChangeInfo() public static méthode

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
Résultat VersionPress\ChangeInfos\TrackedChangeInfo

getVpid() public static méthode

public static getVpid ( $changeInfo )