Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore(mentions): add integration test for reply approval notification #3748

Open
wants to merge 6 commits into
base: 2.x
Choose a base branch
from

Conversation

OrdinaryJellyfish
Copy link
Contributor

Changes proposed in this pull request:

Reviewers should focus on:

Screenshot

Necessity

  • Has the problem that is being solved here been clearly explained?
  • If applicable, have various options for solving this problem been considered?
  • For core PRs, does this need to be in core, or could it be in an extension?
  • Are we willing to maintain this for years / potentially forever?

Confirmed

  • Frontend changes: tested on a local Flarum installation.
  • Backend changes: tests are green (run composer test).
  • Core developer confirmed locally this works as intended.
  • Tests have been added, or are not appropriate here.

Required changes:

  • Related documentation PR: (Remove if irrelevant)
  • Related core extension PRs: (Remove if irrelevant)

@OrdinaryJellyfish OrdinaryJellyfish requested a review from a team as a code owner March 7, 2023 17:04
SychO9
SychO9 previously approved these changes Apr 16, 2023
]
])
);
}
Copy link
Sponsor Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should there be another assert after here?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

an $this->assertEquals(1, $mainUser->getUnreadNotificationCount()); is what will confirm this works.

['id' => 33, 'title' => __CLASS__, 'created_at' => Carbon::now(), 'last_posted_at' => Carbon::now(), 'user_id' => 1, 'first_post_id' => 33, 'comment_count' => 6, 'last_post_number' => 6, 'last_post_id' => 38],
],
'posts' => [
['id' => 1, 'discussion_id' => 1, 'created_at' => Carbon::createFromDate(1975, 5, 21)->toDateTimeString(), 'user_id' => 1, 'type' => 'comment', 'content' => '<t><p>foo bar</p></t>', 'number' => 1],
Copy link
Sponsor Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do we need this much loading data?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

we can delete the 33 discussion and posts from 33+

@SychO9 SychO9 dismissed their stale review April 24, 2023 14:06

Not sure why I assumed this was completed, looking again it isn't. @OrdinaryJellyfish could you look into this please

'json' => [
'data' => [
'attributes' => [
'content' => 'reply with predetermined content for automated testing - too-obscure',
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

To test the reply notification works let's add a post mention (post mention = replying to a post)
we should try to mention a post created by mainUser (userId = 2) so let's do @"mainUser"#p2
and change the user_id of post id 2 to 2

$json = json_decode($response->getBody()->getContents(), true);

$this->send(
$this->request('PATCH', '/api/posts'.$json['data']['id'], [
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
$this->request('PATCH', '/api/posts'.$json['data']['id'], [
$this->request('PATCH', '/api/posts/'.$json['data']['id'], [

@SychO9 SychO9 changed the base branch from main to 2.x May 27, 2023 17:41
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

5 participants