fixed follow space test

This commit is contained in:
Lucas Bartholemy 2019-08-22 13:29:45 +02:00
parent 27163c1c4f
commit 73a5e2e231

View File

@ -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) {