Skip to content

Commit 1f47644

Browse files
committed
Allow user to collaborate on enitity types for room boundry checks.
1 parent e0ec045 commit 1f47644

1 file changed

Lines changed: 24 additions & 0 deletions

File tree

tests/phpunit/tests/rest-api/rest-collaboration-server.php

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2152,6 +2152,18 @@ public function test_collaboration_awareness_non_array_json_ignored(): void {
21522152
public function test_collaboration_room_name_at_max_length_accepted(): void {
21532153
wp_set_current_user( self::$editor_id );
21542154

2155+
add_filter(
2156+
'wp_collaborate_can_user_collaborate_on_entity_type',
2157+
static function ( $can_collaborate, $entity_type, $entity_name ) {
2158+
if ( 'root' === $entity_type && $entity_name === str_repeat( 'a', 186 ) ) {
2159+
return true;
2160+
}
2161+
return $can_collaborate;
2162+
},
2163+
10,
2164+
3
2165+
);
2166+
21552167
// 191 characters using a collection room: 'root/' (5) + 186 chars.
21562168
$room = 'root/' . str_repeat( 'a', 186 );
21572169
$this->assertSame( 191, strlen( $room ), 'Room name should be 191 characters.' );
@@ -2170,6 +2182,18 @@ public function test_collaboration_room_name_at_max_length_accepted(): void {
21702182
public function test_collaboration_room_name_max_length_rejected(): void {
21712183
wp_set_current_user( self::$editor_id );
21722184

2185+
add_filter(
2186+
'wp_collaborate_can_user_collaborate_on_entity_type',
2187+
static function ( $can_collaborate, $entity_type, $entity_name ) {
2188+
if ( 'postType' === $entity_type && $entity_name === str_repeat( 'a', 183 ) ) {
2189+
return true;
2190+
}
2191+
return $can_collaborate;
2192+
},
2193+
10,
2194+
3
2195+
);
2196+
21732197
// 192 characters: 'postType/' (9) + 183 chars.
21742198
$long_room = 'postType/' . str_repeat( 'a', 183 );
21752199
$this->assertSame( 192, strlen( $long_room ), 'Room name should be 192 characters.' );

0 commit comments

Comments
 (0)