mirror of
https://github.com/BookStackApp/BookStack.git
synced 2024-10-01 01:36:00 -04:00
Reviewed #4533, formatting and tweaks
- Updating formatting. - Tweaked truncation to roughly match elipsis char to width used. - Updated testing to use existing helpers, and ran check as admin user to avoid name conflicts.
This commit is contained in:
parent
83028f3fbe
commit
a452092e40
@ -345,7 +345,7 @@ class User extends Model implements AuthenticatableContract, CanResetPasswordCon
|
|||||||
return $splitName[0];
|
return $splitName[0];
|
||||||
}
|
}
|
||||||
|
|
||||||
return mb_substr($this->name, 0, $chars-3) . '…';
|
return mb_substr($this->name, 0, max($chars - 2, 0)) . '…';
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -155,17 +155,13 @@ class CommentTest extends TestCase
|
|||||||
|
|
||||||
public function test_comment_creator_name_truncated()
|
public function test_comment_creator_name_truncated()
|
||||||
{
|
{
|
||||||
$longNamedUser = $this->users->admin();
|
[$longNamedUser] = $this->users->newUserWithRole(['name' => 'Wolfeschlegelsteinhausenbergerdorff'], ['comment-create-all', 'page-view-all']);
|
||||||
$longNamedUser->name = 'Wolfeschlegelsteinhausenbergerdorff';
|
|
||||||
$longNamedUser->save();
|
|
||||||
$this->actingAs($longNamedUser);
|
|
||||||
|
|
||||||
$page = $this->entities->page();
|
$page = $this->entities->page();
|
||||||
|
|
||||||
$comment = Comment::factory()->make();
|
$comment = Comment::factory()->make();
|
||||||
$this->postJson("/comment/$page->id", $comment->getAttributes());
|
$this->actingAs($longNamedUser)->postJson("/comment/$page->id", $comment->getAttributes());
|
||||||
|
|
||||||
$pageResp = $this->get($page->getUrl());
|
$pageResp = $this->asAdmin()->get($page->getUrl());
|
||||||
$pageResp->assertSee('Wolfeschlegel…');
|
$pageResp->assertSee('Wolfeschlegels…');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user