forked from summerblue/phphub
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
1f27398
commit 88022ac
Showing
27 changed files
with
455 additions
and
71 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -30,3 +30,9 @@ Reply: | |
body: $text | ||
created_at: $date | ||
updated_at: $date | ||
|
||
Favorite: | ||
user_id: | ||
type: User | ||
topic_id: | ||
type: Topic |
44 changes: 44 additions & 0 deletions
44
tests/functional/Notifications/NotificationAttentionCept.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
<?php | ||
|
||
/** | ||
* ------------------------------------ | ||
* Notify attented user | ||
* ------------------------------------ | ||
*/ | ||
|
||
$I = new FunctionalTester($scenario); | ||
|
||
Route::enableFilters(); | ||
|
||
$I->wantTo('Notify A User when he/she attented a Topic'); | ||
$topic = $I->postATopic(['title' => 'My Awsome Topic.']); | ||
|
||
// attented a topic | ||
$user = $I->signIn(); | ||
$I->amOnRoute('topics.show', $topic->id ); | ||
$I->click('#topic-attent-button'); | ||
|
||
// another user leave a reply | ||
$randomUser = $I->signIn(); | ||
$I->amOnRoute('topics.show', $topic->id ); | ||
$I->fillField(['name' => 'body'], 'The Awsome Reply.'); | ||
$I->click('#reply-create-submit'); | ||
$I->see('The Awsome Reply.'); | ||
|
||
// the first user sign in again | ||
$user = $I->signIn($user); | ||
|
||
$I->seeRecord('users', [ | ||
'id' => $user->id, | ||
'notification_count' => 1 | ||
]); | ||
|
||
$I->amOnRoute('notifications.index'); | ||
$I->see('My Awsome Topic.'); | ||
$I->see('The Awsome Reply.'); | ||
$I->see($randomUser->name); | ||
|
||
$I->seeRecord('users', [ | ||
'id' => $user->id, | ||
'notification_count' => 0 | ||
]); |
43 changes: 43 additions & 0 deletions
43
tests/functional/Notifications/NotificationReplyAtUserCept.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
<?php | ||
|
||
/** | ||
* ------------------------------------ | ||
* Notify user being "@" | ||
* ------------------------------------ | ||
*/ | ||
|
||
$I = new FunctionalTester($scenario); | ||
|
||
Route::enableFilters(); | ||
|
||
$I->wantTo('Notify a User when he/she is being AT on a newly Reply'); | ||
|
||
$SuperMan = $I->have('User', ['name' => 'SuperMan']); | ||
|
||
$user = $I->signIn(); | ||
$topic = $I->postATopic(['title' => 'My Awsome Topic.', 'user_id' => $user->id]); | ||
|
||
// another user leave a reply | ||
$randomUser = $I->signIn(); | ||
$I->amOnRoute('topics.show', $topic->id ); | ||
$I->fillField(['name' => 'body'], 'The Awsome Reply. @SuperMan'); | ||
$I->click('#reply-create-submit'); | ||
$I->see('The Awsome Reply. [@SuperMan](' .route('users.show', $SuperMan->id).')'); | ||
|
||
// sign in the author | ||
$user = $I->signIn($SuperMan); | ||
|
||
$I->seeRecord('users', [ | ||
'id' => $user->id, | ||
'notification_count' => 1 | ||
]); | ||
|
||
$I->amOnRoute('notifications.index'); | ||
$I->see('My Awsome Topic.'); | ||
$I->see('The Awsome Reply. [@SuperMan](' .route('users.show', $SuperMan->id).')'); | ||
$I->see($randomUser->name); | ||
|
||
$I->seeRecord('users', [ | ||
'id' => $user->id, | ||
'notification_count' => 0 | ||
]); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
<?php | ||
|
||
/** | ||
* ------------------------------------ | ||
* Notify newly reply | ||
* ------------------------------------ | ||
*/ | ||
|
||
$I = new FunctionalTester($scenario); | ||
|
||
Route::enableFilters(); | ||
|
||
$I->wantTo('Notify The Author when his/her Topic has a new Reply'); | ||
|
||
$user = $I->have('User', ['name' => 'SuperMan']); | ||
$topic = $I->postATopic(['title' => 'My Awsome Topic.', 'user_id' => $user->id]); | ||
|
||
// another user leave a reply | ||
$randomUser = $I->signIn(); | ||
$I->amOnRoute('topics.show', $topic->id ); | ||
$I->fillField(['name' => 'body'], 'The Awsome Reply.'); | ||
$I->click('#reply-create-submit'); | ||
$I->see('The Awsome Reply.'); | ||
|
||
// sign in the author | ||
$user = $I->signIn($user); | ||
|
||
$I->seeRecord('users', [ | ||
'id' => $user->id, | ||
'notification_count' => 1 | ||
]); | ||
|
||
$I->amOnRoute('notifications.index'); | ||
$I->see('My Awsome Topic.'); | ||
$I->see('The Awsome Reply.'); | ||
$I->see($randomUser->name); | ||
|
||
$I->seeRecord('users', [ | ||
'id' => $user->id, | ||
'notification_count' => 0 | ||
]); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.