throw new InvalidArgumentException( '$parentId should match the parent of $revision' );
}
- if ( $revision
- && $user
- && $revision->getUser( RevisionRecord::RAW )->getName() !== $user->getName()
- ) {
- throw new InvalidArgumentException( '$user should match the author of $revision' );
- }
-
+ // NOTE: For null revisions, $user may be different from $this->revision->getUser
+ // and also from $revision->getUser.
+ // But $user should always match $this->user.
if ( $user && $this->user && $user->getName() !== $this->user->getName() ) {
return false;
}
return false;
}
- if ( $revision && !$user ) {
- $user = $revision->getUser( RevisionRecord::RAW );
- }
-
if ( $this->pageState
&& $revision
&& $revision->getParentId() !== null
return false;
}
- if ( $this->revision
- && $user
- && $this->revision->getUser( RevisionRecord::RAW )
- && $this->revision->getUser( RevisionRecord::RAW )->getName() !== $user->getName()
- ) {
- return false;
- }
-
- if ( $revision
- && $this->user
- && $this->revision->getUser( RevisionRecord::RAW )
- && $revision->getUser( RevisionRecord::RAW )->getName() !== $this->user->getName()
- ) {
- return false;
- }
-
// NOTE: this check is the primary reason for having the $this->slotsUpdate field!
if ( $this->slotsUpdate
&& $slotsUpdate
'$forParent' => 0,
'$isReusable' => false,
];
- yield 'mismatch prepareUpdate revision user' => [
- '$prepUser' => null,
- '$prepRevision' => $rev2,
- '$prepUpdate' => null,
- '$forUser' => null,
- '$forRevision' => $rev2x,
- '$forUpdate' => null,
- '$forParent' => 0,
- '$isReusable' => false,
- ];
yield 'mismatch prepareUpdate revision id' => [
'$prepUser' => null,
'$prepRevision' => $rev2,