mirror of
https://github.com/humhub/humhub.git
synced 2025-01-17 14:18:27 +01:00
fixed follow space test
This commit is contained in:
parent
27163c1c4f
commit
73a5e2e231
@ -19,22 +19,23 @@ class SpaceFollowTest extends HumHubDbTestCase
|
||||
|
||||
// Follow Space 2
|
||||
$space = Space::findOne(['id' => 2]);
|
||||
$space->removeMember(2);
|
||||
$space->follow(null, false);
|
||||
|
||||
|
||||
// Check if follow record was saved
|
||||
$follow = Follow::findOne(['object_model' => Space::class, 'object_id' => 2, 'user_id' => 2]);
|
||||
$this->assertNotNull($follow);
|
||||
$this->assertFalse(boolval($follow->send_notifications));
|
||||
|
||||
|
||||
// Get all spaces this user follows and check if the new space is included
|
||||
$spaces = Follow::getFollowedSpacesQuery(Yii::$app->user->getIdentity())->all();
|
||||
$this->assertEquals(count($spaces), 1);
|
||||
$this->assertEquals($spaces[0]->id, 2);
|
||||
|
||||
|
||||
// Get all followers of Space 2 and check if the user is included
|
||||
$followers = Follow::getFollowersQuery($space)->all();
|
||||
$this->assertEquals(count($followers), 2);
|
||||
|
||||
|
||||
if($followers[0]->id == 2) {
|
||||
$this->assertTrue(true);
|
||||
} elseif($followers[1]->id == 2) {
|
||||
|
Loading…
x
Reference in New Issue
Block a user