Skip to content

Commit ffdc2b3

Browse files
committed
Fix unit size check
1 parent e487b55 commit ffdc2b3

File tree

1 file changed

+12
-12
lines changed

1 file changed

+12
-12
lines changed

tests/unit/Validator/PermissionsTest.php

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -248,25 +248,25 @@ public function testInvalidPermissions(): void
248248
// team:$value, member:$value and user:$value must have valid Key for $value
249249
// No leading special chars
250250
$this->assertFalse($object->isValid([Permission::read(Role::user('_1234'))]));
251-
$this->assertEquals('Role "user" identifier value is invalid: Parameter must contain at most 255 chars. Valid chars are a-z, A-Z, 0-9, period, hyphen, and underscore. Can\'t start with a special char', $object->getDescription());
251+
$this->assertEquals('Role "user" identifier value is invalid: Parameter must contain at most 36 chars. Valid chars are a-z, A-Z, 0-9, period, hyphen, and underscore. Can\'t start with a special char', $object->getDescription());
252252
$this->assertFalse($object->isValid([Permission::read(Role::team('-1234'))]));
253-
$this->assertEquals('Role "team" identifier value is invalid: Parameter must contain at most 255 chars. Valid chars are a-z, A-Z, 0-9, period, hyphen, and underscore. Can\'t start with a special char', $object->getDescription());
253+
$this->assertEquals('Role "team" identifier value is invalid: Parameter must contain at most 36 chars. Valid chars are a-z, A-Z, 0-9, period, hyphen, and underscore. Can\'t start with a special char', $object->getDescription());
254254
$this->assertFalse($object->isValid([Permission::read(Role::member('.1234'))]));
255-
$this->assertEquals('Role "member" identifier value is invalid: Parameter must contain at most 255 chars. Valid chars are a-z, A-Z, 0-9, period, hyphen, and underscore. Can\'t start with a special char', $object->getDescription());
255+
$this->assertEquals('Role "member" identifier value is invalid: Parameter must contain at most 36 chars. Valid chars are a-z, A-Z, 0-9, period, hyphen, and underscore. Can\'t start with a special char', $object->getDescription());
256256

257257
// No unsupported special characters
258258
$this->assertFalse($object->isValid([Permission::read(Role::user('12$4'))]));
259-
$this->assertEquals('Role "user" identifier value is invalid: Parameter must contain at most 255 chars. Valid chars are a-z, A-Z, 0-9, period, hyphen, and underscore. Can\'t start with a special char', $object->getDescription());
259+
$this->assertEquals('Role "user" identifier value is invalid: Parameter must contain at most 36 chars. Valid chars are a-z, A-Z, 0-9, period, hyphen, and underscore. Can\'t start with a special char', $object->getDescription());
260260
$this->assertFalse($object->isValid([Permission::read(Role::user('12&4'))]));
261-
$this->assertEquals('Role "user" identifier value is invalid: Parameter must contain at most 255 chars. Valid chars are a-z, A-Z, 0-9, period, hyphen, and underscore. Can\'t start with a special char', $object->getDescription());
261+
$this->assertEquals('Role "user" identifier value is invalid: Parameter must contain at most 36 chars. Valid chars are a-z, A-Z, 0-9, period, hyphen, and underscore. Can\'t start with a special char', $object->getDescription());
262262
$this->assertFalse($object->isValid([Permission::read(Role::user('ab(124'))]));
263-
$this->assertEquals('Role "user" identifier value is invalid: Parameter must contain at most 255 chars. Valid chars are a-z, A-Z, 0-9, period, hyphen, and underscore. Can\'t start with a special char', $object->getDescription());
263+
$this->assertEquals('Role "user" identifier value is invalid: Parameter must contain at most 36 chars. Valid chars are a-z, A-Z, 0-9, period, hyphen, and underscore. Can\'t start with a special char', $object->getDescription());
264264

265-
// Shorter than 255 chars
265+
// Shorter than 36 chars
266266

267-
$this->assertTrue($object->isValid([Permission::read(Role::user(ID::custom(str_repeat('a', 255))))]));
267+
$this->assertTrue($object->isValid([Permission::read(Role::user(ID::custom(str_repeat('a', 36))))]));
268268
$this->assertFalse($object->isValid([Permission::read(Role::user(ID::custom(str_repeat('a', 256))))]));
269-
$this->assertEquals('Role "user" identifier value is invalid: Parameter must contain at most 255 chars. Valid chars are a-z, A-Z, 0-9, period, hyphen, and underscore. Can\'t start with a special char', $object->getDescription());
269+
$this->assertEquals('Role "user" identifier value is invalid: Parameter must contain at most 36 chars. Valid chars are a-z, A-Z, 0-9, period, hyphen, and underscore. Can\'t start with a special char', $object->getDescription());
270270

271271
// Permission role must begin with one of: member, role, team, user
272272
$this->assertFalse($object->isValid(['update("memmber:1234")']));
@@ -278,7 +278,7 @@ public function testInvalidPermissions(): void
278278

279279
// Team permission
280280
$this->assertFalse($object->isValid([Permission::read(Role::team(ID::custom('_abcd')))]));
281-
$this->assertEquals('Role "team" identifier value is invalid: Parameter must contain at most 255 chars. Valid chars are a-z, A-Z, 0-9, period, hyphen, and underscore. Can\'t start with a special char', $object->getDescription());
281+
$this->assertEquals('Role "team" identifier value is invalid: Parameter must contain at most 36 chars. Valid chars are a-z, A-Z, 0-9, period, hyphen, and underscore. Can\'t start with a special char', $object->getDescription());
282282
$this->assertFalse($object->isValid([Permission::read(Role::team(ID::custom('abcd/')))]));
283283
$this->assertEquals('Dimension must not be empty', $object->getDescription());
284284
$this->assertFalse($object->isValid([Permission::read(Role::team(ID::custom(''), 'abcd'))]));
@@ -288,9 +288,9 @@ public function testInvalidPermissions(): void
288288
$this->assertFalse($object->isValid([Permission::read(Role::team(ID::custom('abcd'), 'e/fgh'))]));
289289
$this->assertEquals('Only one dimension can be provided', $object->getDescription());
290290
$this->assertFalse($object->isValid([Permission::read(Role::team(ID::custom('ab&cd3'), 'efgh'))]));
291-
$this->assertEquals('Role "team" identifier value is invalid: Parameter must contain at most 255 chars. Valid chars are a-z, A-Z, 0-9, period, hyphen, and underscore. Can\'t start with a special char', $object->getDescription());
291+
$this->assertEquals('Role "team" identifier value is invalid: Parameter must contain at most 36 chars. Valid chars are a-z, A-Z, 0-9, period, hyphen, and underscore. Can\'t start with a special char', $object->getDescription());
292292
$this->assertFalse($object->isValid([Permission::read(Role::team(ID::custom('abcd'), 'ef*gh'))]));
293-
$this->assertEquals('Role "team" dimension value is invalid: Parameter must contain at most 255 chars. Valid chars are a-z, A-Z, 0-9, period, hyphen, and underscore. Can\'t start with a special char', $object->getDescription());
293+
$this->assertEquals('Role "team" dimension value is invalid: Parameter must contain at most 36 chars. Valid chars are a-z, A-Z, 0-9, period, hyphen, and underscore. Can\'t start with a special char', $object->getDescription());
294294

295295
// Permission-list length must be valid
296296
$object = new Permissions(100);

0 commit comments

Comments
 (0)