mirror of
https://github.com/flarum/core.git
synced 2025-08-11 02:44:04 +02:00
chore: update dependencies (#4012)
* chore: phpunit 10 * chore: config * Apply fixes from StyleCI * chore: phpunit 11 (php 8.2 minimum requirement) * feat: laravel 11 * Apply fixes from StyleCI * feat: carbon v3 * fixes
This commit is contained in:
@@ -17,6 +17,7 @@ use Flarum\Post\Post;
|
||||
use Flarum\Testing\integration\RetrievesAuthorizedUsers;
|
||||
use Flarum\Testing\integration\TestCase;
|
||||
use Flarum\User\User;
|
||||
use PHPUnit\Framework\Attributes\Test;
|
||||
|
||||
class GroupMentionsTest extends TestCase
|
||||
{
|
||||
@@ -63,9 +64,7 @@ class GroupMentionsTest extends TestCase
|
||||
]);
|
||||
}
|
||||
|
||||
/**
|
||||
* @test
|
||||
*/
|
||||
#[Test]
|
||||
public function rendering_a_valid_group_mention_works()
|
||||
{
|
||||
$response = $this->send(
|
||||
@@ -83,9 +82,7 @@ class GroupMentionsTest extends TestCase
|
||||
$this->assertNotNull(CommentPost::find($response['data']['id'])->mentionsGroups->find(4));
|
||||
}
|
||||
|
||||
/**
|
||||
* @test
|
||||
*/
|
||||
#[Test]
|
||||
public function mentioning_an_invalid_group_doesnt_work()
|
||||
{
|
||||
$response = $this->send(
|
||||
@@ -114,9 +111,7 @@ class GroupMentionsTest extends TestCase
|
||||
$this->assertCount(0, CommentPost::find($response['data']['id'])->mentionsGroups);
|
||||
}
|
||||
|
||||
/**
|
||||
* @test
|
||||
*/
|
||||
#[Test]
|
||||
public function deleted_group_mentions_render_with_deleted_label()
|
||||
{
|
||||
$deleted_text = $this->app()->getContainer()->make('translator')->trans('flarum-mentions.forum.group_mention.deleted_text');
|
||||
@@ -138,9 +133,7 @@ class GroupMentionsTest extends TestCase
|
||||
$this->assertCount(0, CommentPost::find($response['data']['id'])->mentionsGroups);
|
||||
}
|
||||
|
||||
/**
|
||||
* @test
|
||||
*/
|
||||
#[Test]
|
||||
public function group_mentions_render_with_fresh_data()
|
||||
{
|
||||
$response = $this->send(
|
||||
@@ -159,9 +152,7 @@ class GroupMentionsTest extends TestCase
|
||||
$this->assertNotNull(CommentPost::find($response['data']['id'])->mentionsGroups->find(11));
|
||||
}
|
||||
|
||||
/**
|
||||
* @test
|
||||
*/
|
||||
#[Test]
|
||||
public function mentioning_a_group_as_an_admin_user_works()
|
||||
{
|
||||
$response = $this->send(
|
||||
@@ -192,9 +183,7 @@ class GroupMentionsTest extends TestCase
|
||||
$this->assertCount(1, CommentPost::find($response['data']['id'])->mentionsGroups);
|
||||
}
|
||||
|
||||
/**
|
||||
* @test
|
||||
*/
|
||||
#[Test]
|
||||
public function mentioning_multiple_groups_as_an_admin_user_works()
|
||||
{
|
||||
$response = $this->send(
|
||||
@@ -227,9 +216,7 @@ class GroupMentionsTest extends TestCase
|
||||
$this->assertCount(2, CommentPost::find($response['data']['id'])->mentionsGroups);
|
||||
}
|
||||
|
||||
/**
|
||||
* @test
|
||||
*/
|
||||
#[Test]
|
||||
public function mentioning_a_virtual_group_as_an_admin_user_does_not_work()
|
||||
{
|
||||
$response = $this->send(
|
||||
@@ -262,18 +249,14 @@ class GroupMentionsTest extends TestCase
|
||||
$this->assertCount(0, CommentPost::find($response['data']['id'])->mentionsGroups);
|
||||
}
|
||||
|
||||
/**
|
||||
* @test
|
||||
*/
|
||||
#[Test]
|
||||
public function regular_user_does_not_have_group_mention_permission_by_default()
|
||||
{
|
||||
$this->database();
|
||||
$this->assertFalse(User::find(3)->can('mentionGroups'));
|
||||
}
|
||||
|
||||
/**
|
||||
* @test
|
||||
*/
|
||||
#[Test]
|
||||
public function regular_user_does_have_group_mention_permission_when_added()
|
||||
{
|
||||
$this->prepareDatabase([
|
||||
@@ -286,9 +269,7 @@ class GroupMentionsTest extends TestCase
|
||||
$this->assertTrue(User::find(3)->can('mentionGroups'));
|
||||
}
|
||||
|
||||
/**
|
||||
* @test
|
||||
*/
|
||||
#[Test]
|
||||
public function user_without_permission_cannot_mention_groups()
|
||||
{
|
||||
$response = $this->send(
|
||||
@@ -318,9 +299,7 @@ class GroupMentionsTest extends TestCase
|
||||
$this->assertCount(0, CommentPost::find($response['data']['id'])->mentionsGroups);
|
||||
}
|
||||
|
||||
/**
|
||||
* @test
|
||||
*/
|
||||
#[Test]
|
||||
public function user_with_permission_can_mention_groups()
|
||||
{
|
||||
$response = $this->send(
|
||||
@@ -350,9 +329,7 @@ class GroupMentionsTest extends TestCase
|
||||
$this->assertCount(1, CommentPost::find($response['data']['id'])->mentionsGroups);
|
||||
}
|
||||
|
||||
/**
|
||||
* @test
|
||||
*/
|
||||
#[Test]
|
||||
public function user_with_permission_cannot_mention_hidden_groups()
|
||||
{
|
||||
$response = $this->send(
|
||||
@@ -382,9 +359,7 @@ class GroupMentionsTest extends TestCase
|
||||
$this->assertCount(0, CommentPost::find($response['data']['id'])->mentionsGroups);
|
||||
}
|
||||
|
||||
/**
|
||||
* @test
|
||||
*/
|
||||
#[Test]
|
||||
public function editing_a_post_that_has_a_mention_works()
|
||||
{
|
||||
$response = $this->send(
|
||||
|
@@ -17,6 +17,8 @@ use Flarum\Testing\integration\RetrievesAuthorizedUsers;
|
||||
use Flarum\Testing\integration\TestCase;
|
||||
use Flarum\User\User;
|
||||
use Illuminate\Support\Arr;
|
||||
use PHPUnit\Framework\Attributes\DataProvider;
|
||||
use PHPUnit\Framework\Attributes\Test;
|
||||
|
||||
class ListPostsTest extends TestCase
|
||||
{
|
||||
@@ -52,9 +54,7 @@ class ListPostsTest extends TestCase
|
||||
]);
|
||||
}
|
||||
|
||||
/**
|
||||
* @test
|
||||
*/
|
||||
#[Test]
|
||||
public function mentioned_filter_works()
|
||||
{
|
||||
$response = $this->send(
|
||||
@@ -71,9 +71,7 @@ class ListPostsTest extends TestCase
|
||||
$this->assertEqualsCanonicalizing(['2', '3'], $ids, 'IDs do not match');
|
||||
}
|
||||
|
||||
/**
|
||||
* @test
|
||||
*/
|
||||
#[Test]
|
||||
public function mentioned_filter_works_negated()
|
||||
{
|
||||
$response = $this->send(
|
||||
@@ -90,9 +88,7 @@ class ListPostsTest extends TestCase
|
||||
$this->assertEqualsCanonicalizing(['4'], $ids, 'IDs do not match');
|
||||
}
|
||||
|
||||
/**
|
||||
* @test
|
||||
*/
|
||||
#[Test]
|
||||
public function mentioned_filter_works_with_sort()
|
||||
{
|
||||
$response = $this->send(
|
||||
@@ -149,7 +145,7 @@ class ListPostsTest extends TestCase
|
||||
]);
|
||||
}
|
||||
|
||||
/** @test */
|
||||
#[Test]
|
||||
public function mentioned_by_relation_returns_limited_results_and_shows_only_visible_posts_in_show_post_endpoint()
|
||||
{
|
||||
$this->prepareMentionedByData();
|
||||
@@ -175,7 +171,7 @@ class ListPostsTest extends TestCase
|
||||
$this->assertEquals([102, 104, 105, 106], Arr::pluck($mentionedBy, 'id'));
|
||||
}
|
||||
|
||||
/** @test */
|
||||
#[Test]
|
||||
public function mentioned_by_relation_returns_limited_results_and_shows_only_visible_posts_in_list_posts_endpoint()
|
||||
{
|
||||
$this->prepareMentionedByData();
|
||||
@@ -203,10 +199,8 @@ class ListPostsTest extends TestCase
|
||||
$this->assertEquals([102, 104, 105, 106], Arr::pluck($mentionedBy, 'id'));
|
||||
}
|
||||
|
||||
/**
|
||||
* @dataProvider mentionedByIncludeProvider
|
||||
* @test
|
||||
*/
|
||||
#[Test]
|
||||
#[DataProvider('mentionedByIncludeProvider')]
|
||||
public function mentioned_by_relation_returns_limited_results_and_shows_only_visible_posts_in_show_discussion_endpoint(?string $include)
|
||||
{
|
||||
$this->prepareMentionedByData();
|
||||
@@ -236,7 +230,7 @@ class ListPostsTest extends TestCase
|
||||
$this->assertEquals([102, 104, 105, 106], Arr::pluck($mentionedBy, 'id'));
|
||||
}
|
||||
|
||||
public function mentionedByIncludeProvider(): array
|
||||
public static function mentionedByIncludeProvider(): array
|
||||
{
|
||||
return [
|
||||
['posts,posts.mentionedBy'],
|
||||
@@ -245,7 +239,7 @@ class ListPostsTest extends TestCase
|
||||
];
|
||||
}
|
||||
|
||||
/** @test */
|
||||
#[Test]
|
||||
public function mentioned_by_count_only_includes_visible_posts_to_actor()
|
||||
{
|
||||
$this->prepareMentionedByData();
|
||||
@@ -264,7 +258,7 @@ class ListPostsTest extends TestCase
|
||||
$this->assertEquals(0, $data['attributes']['mentionedByCount']);
|
||||
}
|
||||
|
||||
/** @test */
|
||||
#[Test]
|
||||
public function mentioned_by_count_works_on_show_endpoint()
|
||||
{
|
||||
$this->prepareMentionedByData();
|
||||
@@ -283,7 +277,7 @@ class ListPostsTest extends TestCase
|
||||
$this->assertEquals(10, $data['attributes']['mentionedByCount']);
|
||||
}
|
||||
|
||||
/** @test */
|
||||
#[Test]
|
||||
public function mentioned_by_count_works_on_list_endpoint()
|
||||
{
|
||||
$this->prepareMentionedByData();
|
||||
|
@@ -19,6 +19,7 @@ use Flarum\Testing\integration\RetrievesAuthorizedUsers;
|
||||
use Flarum\Testing\integration\TestCase;
|
||||
use Flarum\User\DisplayName\DriverInterface;
|
||||
use Flarum\User\User;
|
||||
use PHPUnit\Framework\Attributes\Test;
|
||||
|
||||
class PostMentionsTest extends TestCase
|
||||
{
|
||||
@@ -73,9 +74,7 @@ class PostMentionsTest extends TestCase
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* @test
|
||||
*/
|
||||
#[Test]
|
||||
public function mentioning_a_valid_post_with_old_format_doesnt_work()
|
||||
{
|
||||
$response = $this->send(
|
||||
@@ -107,9 +106,7 @@ class PostMentionsTest extends TestCase
|
||||
$this->assertNull(CommentPost::find($response['data']['id'])->mentionsPosts->find(4));
|
||||
}
|
||||
|
||||
/**
|
||||
* @test
|
||||
*/
|
||||
#[Test]
|
||||
public function mentioning_a_valid_post_with_new_format_works()
|
||||
{
|
||||
$response = $this->send(
|
||||
@@ -139,9 +136,7 @@ class PostMentionsTest extends TestCase
|
||||
$this->assertNotNull(CommentPost::find($response['data']['id'])->mentionsPosts->find(4));
|
||||
}
|
||||
|
||||
/**
|
||||
* @test
|
||||
*/
|
||||
#[Test]
|
||||
public function cannot_mention_a_post_without_access()
|
||||
{
|
||||
$response = $this->send(
|
||||
@@ -171,9 +166,7 @@ class PostMentionsTest extends TestCase
|
||||
$this->assertNull(CommentPost::find($response['data']['id'])->mentionsPosts->find(50));
|
||||
}
|
||||
|
||||
/**
|
||||
* @test
|
||||
*/
|
||||
#[Test]
|
||||
public function mentioning_a_valid_post_with_new_format_with_smart_quotes_works_and_falls_back_to_normal_quotes()
|
||||
{
|
||||
$response = $this->send(
|
||||
@@ -205,9 +198,7 @@ class PostMentionsTest extends TestCase
|
||||
$this->assertNotNull(CommentPost::find($response['data']['id'])->mentionsPosts->find(4));
|
||||
}
|
||||
|
||||
/**
|
||||
* @test
|
||||
*/
|
||||
#[Test]
|
||||
public function mentioning_an_invalid_post_doesnt_work()
|
||||
{
|
||||
$response = $this->send(
|
||||
@@ -237,9 +228,7 @@ class PostMentionsTest extends TestCase
|
||||
$this->assertCount(0, CommentPost::find($response['data']['id'])->mentionsPosts);
|
||||
}
|
||||
|
||||
/**
|
||||
* @test
|
||||
*/
|
||||
#[Test]
|
||||
public function mentioning_multiple_posts_works()
|
||||
{
|
||||
$response = $this->send(
|
||||
@@ -271,9 +260,7 @@ class PostMentionsTest extends TestCase
|
||||
$this->assertCount(2, CommentPost::find($response['data']['id'])->mentionsPosts);
|
||||
}
|
||||
|
||||
/**
|
||||
* @test
|
||||
*/
|
||||
#[Test]
|
||||
public function post_mentions_render_with_fresh_data()
|
||||
{
|
||||
$response = $this->send(
|
||||
@@ -291,9 +278,7 @@ class PostMentionsTest extends TestCase
|
||||
$this->assertCount(1, CommentPost::find($response['data']['id'])->mentionsPosts);
|
||||
}
|
||||
|
||||
/**
|
||||
* @test
|
||||
*/
|
||||
#[Test]
|
||||
public function post_mentions_unparse_with_fresh_data()
|
||||
{
|
||||
$response = $this->send(
|
||||
@@ -310,9 +295,7 @@ class PostMentionsTest extends TestCase
|
||||
$this->assertCount(1, CommentPost::find($response['data']['id'])->mentionsPosts);
|
||||
}
|
||||
|
||||
/**
|
||||
* @test
|
||||
*/
|
||||
#[Test]
|
||||
public function deleted_post_mentions_s_user_unparse_and_render_without_user_data()
|
||||
{
|
||||
$deleted_text = $this->app()->getContainer()->make('translator')->trans('core.lib.username.deleted_text');
|
||||
@@ -335,9 +318,7 @@ class PostMentionsTest extends TestCase
|
||||
$this->assertCount(1, CommentPost::find($response['data']['id'])->mentionsPosts);
|
||||
}
|
||||
|
||||
/**
|
||||
* @test
|
||||
*/
|
||||
#[Test]
|
||||
public function deleted_post_mentions_unparse_and_render_without_user_data()
|
||||
{
|
||||
$deleted_text = $this->app()->getContainer()->make('translator')->trans('flarum-mentions.forum.post_mention.deleted_text');
|
||||
@@ -360,9 +341,7 @@ class PostMentionsTest extends TestCase
|
||||
$this->assertCount(0, CommentPost::find($response['data']['id'])->mentionsPosts);
|
||||
}
|
||||
|
||||
/**
|
||||
* @test
|
||||
*/
|
||||
#[Test]
|
||||
public function deleted_post_mentions_and_deleted_user_unparse_and_render_without_user_data()
|
||||
{
|
||||
$deleted_text = $this->app()->getContainer()->make('translator')->trans('flarum-mentions.forum.post_mention.deleted_text');
|
||||
@@ -385,9 +364,7 @@ class PostMentionsTest extends TestCase
|
||||
$this->assertCount(0, CommentPost::find($response['data']['id'])->mentionsPosts);
|
||||
}
|
||||
|
||||
/**
|
||||
* @test
|
||||
*/
|
||||
#[Test]
|
||||
public function post_mentions_with_unremoved_bad_string_from_display_names_doesnt_work()
|
||||
{
|
||||
$response = $this->send(
|
||||
@@ -417,9 +394,7 @@ class PostMentionsTest extends TestCase
|
||||
$this->assertNotNull(CommentPost::find($response['data']['id'])->mentionsPosts->find(6));
|
||||
}
|
||||
|
||||
/**
|
||||
* @test
|
||||
*/
|
||||
#[Test]
|
||||
public function post_mentions_unparsing_removes_bad_display_name_string()
|
||||
{
|
||||
$response = $this->send(
|
||||
@@ -438,9 +413,7 @@ class PostMentionsTest extends TestCase
|
||||
$this->assertNotNull(CommentPost::find($response['data']['id'])->mentionsPosts->find(9));
|
||||
}
|
||||
|
||||
/**
|
||||
* @test
|
||||
*/
|
||||
#[Test]
|
||||
public function post_mentions_with_removed_bad_string_from_display_names_works()
|
||||
{
|
||||
$response = $this->send(
|
||||
@@ -470,9 +443,7 @@ class PostMentionsTest extends TestCase
|
||||
$this->assertNotNull(CommentPost::find($response['data']['id'])->mentionsPosts->find(9));
|
||||
}
|
||||
|
||||
/**
|
||||
* @test
|
||||
*/
|
||||
#[Test]
|
||||
public function editing_a_post_that_has_a_mention_works()
|
||||
{
|
||||
$response = $this->send(
|
||||
@@ -499,9 +470,7 @@ class PostMentionsTest extends TestCase
|
||||
$this->assertNotNull(CommentPost::find($response['data']['id'])->mentionsPosts->find(9));
|
||||
}
|
||||
|
||||
/**
|
||||
* @test
|
||||
*/
|
||||
#[Test]
|
||||
public function editing_a_post_with_deleted_author_that_has_a_mention_works()
|
||||
{
|
||||
$response = $this->send(
|
||||
@@ -530,9 +499,7 @@ class PostMentionsTest extends TestCase
|
||||
$this->assertNotNull(CommentPost::find($response['data']['id'])->mentionsPosts->find(9));
|
||||
}
|
||||
|
||||
/**
|
||||
* @test
|
||||
*/
|
||||
#[Test]
|
||||
public function editing_a_post_with_a_mention_of_a_post_with_deleted_author_works()
|
||||
{
|
||||
$response = $this->send(
|
||||
@@ -559,9 +526,7 @@ class PostMentionsTest extends TestCase
|
||||
$this->assertNotNull(CommentPost::find($response['data']['id'])->mentionsPosts->find(11));
|
||||
}
|
||||
|
||||
/**
|
||||
* @test
|
||||
*/
|
||||
#[Test]
|
||||
public function rendering_post_mention_with_a_post_context_works()
|
||||
{
|
||||
/** @var Formatter $formatter */
|
||||
@@ -576,9 +541,7 @@ class PostMentionsTest extends TestCase
|
||||
$this->assertStringContainsString('TOBY$', $renderedHtml);
|
||||
}
|
||||
|
||||
/**
|
||||
* @test
|
||||
*/
|
||||
#[Test]
|
||||
public function rendering_post_mention_without_a_context_works()
|
||||
{
|
||||
/** @var Formatter $formatter */
|
||||
|
@@ -18,6 +18,7 @@ use Flarum\Tags\Tag;
|
||||
use Flarum\Testing\integration\RetrievesAuthorizedUsers;
|
||||
use Flarum\Testing\integration\TestCase;
|
||||
use Flarum\User\User;
|
||||
use PHPUnit\Framework\Attributes\Test;
|
||||
|
||||
class TagMentionsTest extends TestCase
|
||||
{
|
||||
@@ -64,7 +65,7 @@ class TagMentionsTest extends TestCase
|
||||
]);
|
||||
}
|
||||
|
||||
/** @test */
|
||||
#[Test]
|
||||
public function mentioning_a_valid_tag_with_valid_format_works()
|
||||
{
|
||||
$response = $this->send(
|
||||
@@ -93,7 +94,7 @@ class TagMentionsTest extends TestCase
|
||||
$this->assertNotNull(CommentPost::find($response['data']['id'])->mentionsTags->find(2));
|
||||
}
|
||||
|
||||
/** @test */
|
||||
#[Test]
|
||||
public function mentioning_a_valid_tag_using_cjk_slug_with_valid_format_works()
|
||||
{
|
||||
$response = $this->send(
|
||||
@@ -123,7 +124,7 @@ class TagMentionsTest extends TestCase
|
||||
$this->assertNotNull(CommentPost::find($response['data']['id'])->mentionsTags->find(6));
|
||||
}
|
||||
|
||||
/** @test */
|
||||
#[Test]
|
||||
public function mentioning_an_invalid_tag_doesnt_work()
|
||||
{
|
||||
$response = $this->send(
|
||||
@@ -152,7 +153,7 @@ class TagMentionsTest extends TestCase
|
||||
$this->assertCount(0, CommentPost::find($response['data']['id'])->mentionsTags);
|
||||
}
|
||||
|
||||
/** @test */
|
||||
#[Test]
|
||||
public function mentioning_a_tag_when_tags_disabled_does_not_cause_errors()
|
||||
{
|
||||
$this->extensions = ['flarum-mentions'];
|
||||
@@ -183,7 +184,7 @@ class TagMentionsTest extends TestCase
|
||||
$this->assertNull(CommentPost::find($response['data']['id'])->mentionsTags);
|
||||
}
|
||||
|
||||
/** @test */
|
||||
#[Test]
|
||||
public function mentioning_a_restricted_tag_doesnt_work_without_privileges()
|
||||
{
|
||||
$response = $this->send(
|
||||
@@ -212,7 +213,7 @@ class TagMentionsTest extends TestCase
|
||||
$this->assertCount(0, CommentPost::find($response['data']['id'])->mentionsTags);
|
||||
}
|
||||
|
||||
/** @test */
|
||||
#[Test]
|
||||
public function mentioning_a_restricted_tag_works_with_privileges()
|
||||
{
|
||||
$response = $this->send(
|
||||
@@ -241,7 +242,7 @@ class TagMentionsTest extends TestCase
|
||||
$this->assertCount(1, CommentPost::find($response['data']['id'])->mentionsTags);
|
||||
}
|
||||
|
||||
/** @test */
|
||||
#[Test]
|
||||
public function mentioning_multiple_tags_works()
|
||||
{
|
||||
$response = $this->send(
|
||||
@@ -273,7 +274,7 @@ class TagMentionsTest extends TestCase
|
||||
$this->assertCount(4, CommentPost::find($response['data']['id'])->mentionsTags);
|
||||
}
|
||||
|
||||
/** @test */
|
||||
#[Test]
|
||||
public function tag_mentions_render_with_fresh_data()
|
||||
{
|
||||
$response = $this->send(
|
||||
@@ -291,7 +292,7 @@ class TagMentionsTest extends TestCase
|
||||
$this->assertCount(1, CommentPost::find($response['data']['id'])->mentionsTags);
|
||||
}
|
||||
|
||||
/** @test */
|
||||
#[Test]
|
||||
public function tag_mentions_dont_cause_errors_when_tags_disabled()
|
||||
{
|
||||
$this->extensions = ['flarum-mentions'];
|
||||
@@ -305,7 +306,7 @@ class TagMentionsTest extends TestCase
|
||||
$this->assertEquals(200, $response->getStatusCode());
|
||||
}
|
||||
|
||||
/** @test */
|
||||
#[Test]
|
||||
public function tag_mentions_unparse_with_fresh_data()
|
||||
{
|
||||
$response = $this->send(
|
||||
@@ -322,7 +323,7 @@ class TagMentionsTest extends TestCase
|
||||
$this->assertCount(1, CommentPost::find($response['data']['id'])->mentionsTags);
|
||||
}
|
||||
|
||||
/** @test */
|
||||
#[Test]
|
||||
public function deleted_tag_mentions_unparse_and_render_as_expected()
|
||||
{
|
||||
// No reason to hide a deleted tag's name.
|
||||
@@ -345,7 +346,7 @@ class TagMentionsTest extends TestCase
|
||||
$this->assertCount(0, CommentPost::find($response['data']['id'])->mentionsTags);
|
||||
}
|
||||
|
||||
/** @test */
|
||||
#[Test]
|
||||
public function deleted_tag_mentions_relation_unparse_and_render_as_expected()
|
||||
{
|
||||
// No reason to hide a deleted tag's name.
|
||||
@@ -368,7 +369,7 @@ class TagMentionsTest extends TestCase
|
||||
$this->assertCount(0, CommentPost::find($response['data']['id'])->mentionsTags);
|
||||
}
|
||||
|
||||
/** @test */
|
||||
#[Test]
|
||||
public function editing_a_post_that_has_a_tag_mention_works()
|
||||
{
|
||||
$response = $this->send(
|
||||
|
@@ -18,6 +18,7 @@ use Flarum\Testing\integration\RetrievesAuthorizedUsers;
|
||||
use Flarum\Testing\integration\TestCase;
|
||||
use Flarum\User\DisplayName\DriverInterface;
|
||||
use Flarum\User\User;
|
||||
use PHPUnit\Framework\Attributes\Test;
|
||||
|
||||
class UserMentionsTest extends TestCase
|
||||
{
|
||||
@@ -63,9 +64,7 @@ class UserMentionsTest extends TestCase
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* @test
|
||||
*/
|
||||
#[Test]
|
||||
public function mentioning_a_valid_user_with_old_format_doesnt_work_if_off()
|
||||
{
|
||||
$this->setting('flarum-mentions.allow_username_format', '0');
|
||||
@@ -97,9 +96,7 @@ class UserMentionsTest extends TestCase
|
||||
$this->assertCount(0, CommentPost::find($response['data']['id'])->mentionsUsers);
|
||||
}
|
||||
|
||||
/**
|
||||
* @test
|
||||
*/
|
||||
#[Test]
|
||||
public function mentioning_a_valid_user_with_old_format_works_if_on()
|
||||
{
|
||||
$this->setting('flarum-mentions.allow_username_format', '1');
|
||||
@@ -131,9 +128,7 @@ class UserMentionsTest extends TestCase
|
||||
$this->assertNotNull(CommentPost::find($response['data']['id'])->mentionsUsers->find(3));
|
||||
}
|
||||
|
||||
/**
|
||||
* @test
|
||||
*/
|
||||
#[Test]
|
||||
public function mentioning_a_valid_user_with_new_format_works()
|
||||
{
|
||||
$response = $this->send(
|
||||
@@ -163,9 +158,7 @@ class UserMentionsTest extends TestCase
|
||||
$this->assertNotNull(CommentPost::find($response['data']['id'])->mentionsUsers->find(3));
|
||||
}
|
||||
|
||||
/**
|
||||
* @test
|
||||
*/
|
||||
#[Test]
|
||||
public function mentioning_a_valid_user_with_new_format_with_smart_quotes_works_and_falls_back_to_normal_quotes()
|
||||
{
|
||||
$response = $this->send(
|
||||
@@ -195,9 +188,7 @@ class UserMentionsTest extends TestCase
|
||||
$this->assertNotNull(CommentPost::find($response['data']['id'])->mentionsUsers->find(3));
|
||||
}
|
||||
|
||||
/**
|
||||
* @test
|
||||
*/
|
||||
#[Test]
|
||||
public function mentioning_an_invalid_user_doesnt_work()
|
||||
{
|
||||
$response = $this->send(
|
||||
@@ -227,9 +218,7 @@ class UserMentionsTest extends TestCase
|
||||
$this->assertCount(0, CommentPost::find($response['data']['id'])->mentionsUsers);
|
||||
}
|
||||
|
||||
/**
|
||||
* @test
|
||||
*/
|
||||
#[Test]
|
||||
public function mentioning_multiple_users_works()
|
||||
{
|
||||
$response = $this->send(
|
||||
@@ -261,9 +250,7 @@ class UserMentionsTest extends TestCase
|
||||
$this->assertCount(2, CommentPost::find($response['data']['id'])->mentionsUsers);
|
||||
}
|
||||
|
||||
/**
|
||||
* @test
|
||||
*/
|
||||
#[Test]
|
||||
public function old_user_mentions_still_render()
|
||||
{
|
||||
$response = $this->send(
|
||||
@@ -281,9 +268,7 @@ class UserMentionsTest extends TestCase
|
||||
$this->assertCount(1, CommentPost::find($response['data']['id'])->mentionsUsers);
|
||||
}
|
||||
|
||||
/**
|
||||
* @test
|
||||
*/
|
||||
#[Test]
|
||||
public function user_mentions_render_with_fresh_data()
|
||||
{
|
||||
$response = $this->send(
|
||||
@@ -312,9 +297,7 @@ class UserMentionsTest extends TestCase
|
||||
$this->assertNotNull(CommentPost::find($response['data']['id'])->mentionsUsers->find(3));
|
||||
}
|
||||
|
||||
/**
|
||||
* @test
|
||||
*/
|
||||
#[Test]
|
||||
public function user_mentions_unparse_with_fresh_data()
|
||||
{
|
||||
$response = $this->send(
|
||||
@@ -342,9 +325,7 @@ class UserMentionsTest extends TestCase
|
||||
$this->assertNotNull(CommentPost::find($response['data']['id'])->mentionsUsers->find(3));
|
||||
}
|
||||
|
||||
/**
|
||||
* @test
|
||||
*/
|
||||
#[Test]
|
||||
public function deleted_user_mentions_unparse_and_render_without_user_data()
|
||||
{
|
||||
$deleted_text = $this->app()->getContainer()->make('translator')->trans('core.lib.username.deleted_text');
|
||||
@@ -368,9 +349,7 @@ class UserMentionsTest extends TestCase
|
||||
$this->assertCount(0, CommentPost::find($response['data']['id'])->mentionsUsers);
|
||||
}
|
||||
|
||||
/**
|
||||
* @test
|
||||
*/
|
||||
#[Test]
|
||||
public function user_mentions_with_unremoved_bad_string_from_display_names_doesnt_work()
|
||||
{
|
||||
$response = $this->send(
|
||||
@@ -400,9 +379,7 @@ class UserMentionsTest extends TestCase
|
||||
$this->assertNull(CommentPost::find($response['data']['id'])->mentionsUsers->find(5));
|
||||
}
|
||||
|
||||
/**
|
||||
* @test
|
||||
*/
|
||||
#[Test]
|
||||
public function user_mentions_unparsing_removes_bad_display_name_string()
|
||||
{
|
||||
$response = $this->send(
|
||||
@@ -421,9 +398,7 @@ class UserMentionsTest extends TestCase
|
||||
$this->assertNotNull(CommentPost::find($response['data']['id'])->mentionsUsers->find(5));
|
||||
}
|
||||
|
||||
/**
|
||||
* @test
|
||||
*/
|
||||
#[Test]
|
||||
public function user_mentions_with_removed_bad_string_from_display_names_works()
|
||||
{
|
||||
$response = $this->send(
|
||||
@@ -453,9 +428,7 @@ class UserMentionsTest extends TestCase
|
||||
$this->assertNotNull(CommentPost::find($response['data']['id'])->mentionsUsers->find(5));
|
||||
}
|
||||
|
||||
/**
|
||||
* @test
|
||||
*/
|
||||
#[Test]
|
||||
public function editing_a_post_that_has_a_mention_works()
|
||||
{
|
||||
$response = $this->send(
|
||||
@@ -482,9 +455,7 @@ class UserMentionsTest extends TestCase
|
||||
$this->assertNotNull(CommentPost::find($response['data']['id'])->mentionsUsers->find(5));
|
||||
}
|
||||
|
||||
/**
|
||||
* @test
|
||||
*/
|
||||
#[Test]
|
||||
public function editing_a_post_with_deleted_author_that_has_a_mention_works()
|
||||
{
|
||||
$response = $this->send(
|
||||
|
Reference in New Issue
Block a user