Changeset 5928
- Timestamp:
- 08/25/2015 04:12:42 AM (10 years ago)
- Location:
- trunk/tests/phpunit/testcases/users/functions
- Files:
-
- 2 edited
-
favorites.php (modified) (1 diff)
-
subscriptions.php (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
trunk/tests/phpunit/testcases/users/functions/favorites.php
r5755 r5928 10 10 class BBP_Tests_Users_Functions_Favorites extends BBP_UnitTestCase { 11 11 12 /** 13 * @covers ::bbp_get_topic_favoriters 14 * @todo Implement test_bbp_get_topic_favoriters(). 15 */ 16 public function test_bbp_get_topic_favoriters() 17 { 18 // Remove the following lines when you implement this test. 19 $this->markTestIncomplete( 20 'This test has not been implemented yet.' 21 ); 22 } 12 /** 13 * @covers ::bbp_get_topic_favoriters 14 */ 15 public function test_bbp_get_topic_favoriters() { 16 $u = $this->factory->user->create_many( 3 ); 17 $t = $this->factory->topic->create(); 23 18 24 /** 25 * @covers ::bbp_get_user_favorites 26 * @todo Implement test_bbp_get_user_favorites(). 27 */ 28 public function test_bbp_get_user_favorites() 29 { 30 // Remove the following lines when you implement this test. 31 $this->markTestIncomplete( 32 'This test has not been implemented yet.' 33 ); 34 } 19 // Add topic favorites. 20 bbp_add_user_favorite( $u[0], $t ); 21 bbp_add_user_favorite( $u[1], $t ); 35 22 36 /** 37 * @covers ::bbp_get_user_favorites_topic_ids 38 * @todo Implement test_bbp_get_user_favorites_topic_ids(). 39 */ 40 public function test_bbp_get_user_favorites_topic_ids() 41 { 42 // Remove the following lines when you implement this test. 43 $this->markTestIncomplete( 44 'This test has not been implemented yet.' 45 ); 46 } 23 $expected = array( $u[0], $u[1] ); 24 $favoriters = bbp_get_topic_favoriters( $t ); 47 25 48 /** 49 * @covers ::bbp_is_user_favorite 50 * @todo Implement test_bbp_is_user_favorite(). 51 */ 52 public function test_bbp_is_user_favorite() 53 { 54 // Remove the following lines when you implement this test. 55 $this->markTestIncomplete( 56 'This test has not been implemented yet.' 57 ); 58 } 26 $this->assertEquals( $expected, $favoriters ); 59 27 60 /** 61 * @covers ::bbp_add_user_favorite 62 * @todo Implement test_bbp_add_user_favorite(). 63 */ 64 public function test_bbp_add_user_favorite() 65 { 66 // Remove the following lines when you implement this test. 67 $this->markTestIncomplete( 68 'This test has not been implemented yet.' 69 ); 70 } 28 // Add topic favorites. 29 bbp_add_user_favorite( $u[2], $t ); 71 30 72 /** 73 * @covers ::bbp_remove_user_favorite 74 * @todo Implement test_bbp_remove_user_favorite(). 75 */ 76 public function test_bbp_remove_user_favorite() 77 { 78 // Remove the following lines when you implement this test. 79 $this->markTestIncomplete( 80 'This test has not been implemented yet.' 81 ); 82 } 31 $expected = array( $u[0], $u[1], $u[2] ); 32 $favoriters = bbp_get_topic_favoriters( $t ); 83 33 84 /** 85 * @covers ::bbp_favorites_handler 86 * @todo Implement test_bbp_favorites_handler(). 87 */ 88 public function test_bbp_favorites_handler() 89 { 90 // Remove the following lines when you implement this test. 91 $this->markTestIncomplete( 92 'This test has not been implemented yet.' 93 ); 94 } 34 $this->assertEquals( $expected, $favoriters ); 35 36 // Remove user favorite. 37 bbp_remove_user_favorite( $u[1], $t ); 38 39 $expected = array( $u[0], $u[2] ); 40 $favoriters = bbp_get_topic_favoriters( $t ); 41 42 $this->assertEquals( $expected, $favoriters ); 43 } 44 45 /** 46 * @covers ::bbp_get_user_favorites 47 */ 48 public function test_bbp_get_user_favorites() { 49 $u = $this->factory->user->create(); 50 $t = $this->factory->topic->create_many( 3 ); 51 52 // Add topic favorites. 53 bbp_add_user_favorite( $u, $t[0] ); 54 bbp_add_user_favorite( $u, $t[1] ); 55 bbp_add_user_favorite( $u, $t[2] ); 56 57 $expected = bbp_has_topics( array( 'post__in' => array( $t[0], $t[1], $t[2] ) ) ); 58 $favorites = bbp_get_user_favorites( $u ); 59 60 $this->assertEquals( $expected, $favorites ); 61 62 // Remove user favorite. 63 bbp_remove_user_favorite( $u, $t[1] ); 64 65 $expected = bbp_has_topics( array( 'post__in' => array( $t[0], $t[2] ) ) ); 66 $favorites = bbp_get_user_favorites( $u ); 67 68 $this->assertEquals( $expected, $favorites ); 69 } 70 71 /** 72 * @covers ::bbp_get_user_favorites_topic_ids 73 */ 74 public function test_bbp_get_user_favorites_topic_ids() { 75 $u = $this->factory->user->create(); 76 $t = $this->factory->topic->create_many( 3 ); 77 78 // Add topic favorites. 79 bbp_add_user_favorite( $u, $t[0] ); 80 bbp_add_user_favorite( $u, $t[1] ); 81 bbp_add_user_favorite( $u, $t[2] ); 82 83 $favorites = bbp_get_user_favorites_topic_ids( $u ); 84 85 $this->assertEquals( array( $t[0], $t[1], $t[2] ), $favorites ); 86 87 // Remove user favorite. 88 bbp_remove_user_favorite( $u, $t[1] ); 89 90 $favorites = bbp_get_user_favorites_topic_ids( $u ); 91 92 $this->assertEquals( array( $t[0], $t[2] ), $favorites ); 93 } 94 95 /** 96 * @covers ::bbp_is_user_favorite 97 */ 98 public function test_bbp_is_user_favorite() { 99 $u = $this->factory->user->create(); 100 $t = $this->factory->topic->create(); 101 102 $favorite = bbp_is_user_favorite( $u, $t ); 103 104 $this->assertFalse( $favorite ); 105 106 // Add topic favorite. 107 bbp_add_user_favorite( $u, $t ); 108 109 $favorite = bbp_is_user_favorite( $u, $t ); 110 111 $this->assertTrue( $favorite ); 112 } 113 114 /** 115 * @covers ::bbp_add_user_favorite 116 */ 117 public function test_bbp_add_user_favorite() { 118 $u = $this->factory->user->create(); 119 $t = $this->factory->topic->create_many( 3 ); 120 121 // Add topic favorites. 122 update_user_option( $u, '_bbp_favorites', $t[0] ); 123 124 // Add user favorite. 125 bbp_add_user_favorite( $u, $t[1] ); 126 127 $favorites = bbp_get_user_favorites_topic_ids( $u ); 128 129 $this->assertEquals( array( $t[0], $t[1] ), $favorites ); 130 131 // Add user favorite. 132 bbp_add_user_favorite( $u, $t[2] ); 133 134 $favorites = bbp_get_user_favorites_topic_ids( $u ); 135 136 $this->assertEquals( array( $t[0], $t[1], $t[2] ), $favorites ); 137 } 138 139 /** 140 * @covers ::bbp_remove_user_favorite 141 */ 142 public function test_bbp_remove_user_favorite() { 143 $u = $this->factory->user->create(); 144 $t = $this->factory->topic->create_many( 3 ); 145 146 // Add topic favorites. 147 update_user_option( $u, '_bbp_favorites', implode( ',', $t ) ); 148 149 // Remove user favorite. 150 bbp_remove_user_favorite( $u, $t[2] ); 151 152 $favorites = bbp_get_user_favorites_topic_ids( $u ); 153 154 $this->assertEquals( array( $t[0], $t[1] ), $favorites ); 155 156 // Remove user favorite. 157 bbp_remove_user_favorite( $u, $t[1] ); 158 159 $favorites = bbp_get_user_favorites_topic_ids( $u ); 160 161 $this->assertEquals( array( $t[0] ), $favorites ); 162 } 163 164 /** 165 * @covers ::bbp_favorites_handler 166 * @todo Implement test_bbp_favorites_handler(). 167 */ 168 public function test_bbp_favorites_handler() { 169 // Remove the following lines when you implement this test. 170 $this->markTestIncomplete( 171 'This test has not been implemented yet.' 172 ); 173 } 95 174 } -
trunk/tests/phpunit/testcases/users/functions/subscriptions.php
r5755 r5928 10 10 class BBP_Tests_Users_Functions_Subscriptions extends BBP_UnitTestCase { 11 11 12 /** 13 * @covers ::bbp_get_forum_subscribers 14 * @todo Implement test_bbp_get_forum_subscribers(). 15 */ 16 public function test_bbp_get_forum_subscribers() 17 { 18 // Remove the following lines when you implement this test. 19 $this->markTestIncomplete( 20 'This test has not been implemented yet.' 21 ); 22 } 23 24 /** 25 * @covers ::bbp_get_topic_subscribers 26 * @todo Implement test_bbp_get_topic_subscribers(). 27 */ 28 public function test_bbp_get_topic_subscribers() 29 { 30 // Remove the following lines when you implement this test. 31 $this->markTestIncomplete( 32 'This test has not been implemented yet.' 33 ); 34 } 35 36 /** 37 * @covers ::bbp_get_user_subscriptions 38 * @todo Implement test_bbp_get_user_subscriptions(). 39 */ 40 public function test_bbp_get_user_subscriptions() 41 { 42 // Remove the following lines when you implement this test. 43 $this->markTestIncomplete( 44 'This test has not been implemented yet.' 45 ); 46 } 47 48 /** 49 * @covers ::bbp_get_user_topic_subscriptions 50 * @todo Implement test_bbp_get_user_topic_subscriptions(). 51 */ 52 public function test_bbp_get_user_topic_subscriptions() 53 { 54 // Remove the following lines when you implement this test. 55 $this->markTestIncomplete( 56 'This test has not been implemented yet.' 57 ); 58 } 59 60 /** 61 * @covers ::bbp_get_user_forum_subscriptions 62 * @todo Implement test_bbp_get_user_forum_subscriptions(). 63 */ 64 public function test_bbp_get_user_forum_subscriptions() 65 { 66 // Remove the following lines when you implement this test. 67 $this->markTestIncomplete( 68 'This test has not been implemented yet.' 69 ); 70 } 71 72 /** 73 * @covers ::bbp_get_user_subscribed_forum_ids 74 * @todo Implement test_bbp_get_user_subscribed_forum_ids(). 75 */ 76 public function test_bbp_get_user_subscribed_forum_ids() 77 { 78 // Remove the following lines when you implement this test. 79 $this->markTestIncomplete( 80 'This test has not been implemented yet.' 81 ); 82 } 83 84 /** 85 * @covers ::bbp_get_user_subscribed_topic_ids 86 * @todo Implement test_bbp_get_user_subscribed_topic_ids(). 87 */ 88 public function test_bbp_get_user_subscribed_topic_ids() 89 { 90 // Remove the following lines when you implement this test. 91 $this->markTestIncomplete( 92 'This test has not been implemented yet.' 93 ); 94 } 95 96 /** 97 * @covers ::bbp_is_user_subscribed 98 * @todo Implement test_bbp_is_user_subscribed(). 99 */ 100 public function test_bbp_is_user_subscribed() 101 { 102 // Remove the following lines when you implement this test. 103 $this->markTestIncomplete( 104 'This test has not been implemented yet.' 105 ); 106 } 107 108 /** 109 * @covers ::bbp_is_user_subscribed_to_forum 110 * @todo Implement test_bbp_is_user_subscribed_to_forum(). 111 */ 112 public function test_bbp_is_user_subscribed_to_forum() 113 { 114 // Remove the following lines when you implement this test. 115 $this->markTestIncomplete( 116 'This test has not been implemented yet.' 117 ); 118 } 119 120 /** 121 * @covers ::bbp_is_user_subscribed_to_topic 122 * @todo Implement test_bbp_is_user_subscribed_to_topic(). 123 */ 124 public function test_bbp_is_user_subscribed_to_topic() 125 { 126 // Remove the following lines when you implement this test. 127 $this->markTestIncomplete( 128 'This test has not been implemented yet.' 129 ); 130 } 131 132 /** 133 * @covers ::bbp_add_user_subscription 134 * @todo Implement test_bbp_add_user_subscription(). 135 */ 136 public function test_bbp_add_user_subscription() 137 { 138 // Remove the following lines when you implement this test. 139 $this->markTestIncomplete( 140 'This test has not been implemented yet.' 141 ); 142 } 143 144 /** 145 * @covers ::bbp_add_user_forum_subscription 146 * @todo Implement test_bbp_add_user_forum_subscription(). 147 */ 148 public function test_bbp_add_user_forum_subscription() 149 { 150 // Remove the following lines when you implement this test. 151 $this->markTestIncomplete( 152 'This test has not been implemented yet.' 153 ); 154 } 155 156 /** 157 * @covers ::bbp_add_user_topic_subscription 158 * @todo Implement test_bbp_add_user_topic_subscription(). 159 */ 160 public function test_bbp_add_user_topic_subscription() 161 { 162 // Remove the following lines when you implement this test. 163 $this->markTestIncomplete( 164 'This test has not been implemented yet.' 165 ); 166 } 167 168 /** 169 * @covers ::bbp_remove_user_subscription 170 * @todo Implement test_bbp_remove_user_subscription(). 171 */ 172 public function test_bbp_remove_user_subscription() 173 { 174 // Remove the following lines when you implement this test. 175 $this->markTestIncomplete( 176 'This test has not been implemented yet.' 177 ); 178 } 179 180 /** 181 * @covers ::bbp_remove_user_forum_subscription 182 * @todo Implement test_bbp_remove_user_forum_subscription(). 183 */ 184 public function test_bbp_remove_user_forum_subscription() 185 { 186 // Remove the following lines when you implement this test. 187 $this->markTestIncomplete( 188 'This test has not been implemented yet.' 189 ); 190 } 191 192 /** 193 * @covers ::bbp_remove_user_topic_subscription 194 * @todo Implement test_bbp_remove_user_topic_subscription(). 195 */ 196 public function test_bbp_remove_user_topic_subscription() 197 { 198 // Remove the following lines when you implement this test. 199 $this->markTestIncomplete( 200 'This test has not been implemented yet.' 201 ); 202 } 203 204 /** 205 * @covers ::bbp_forum_subscriptions_handler 206 * @todo Implement test_bbp_forum_subscriptions_handler(). 207 */ 208 public function test_bbp_forum_subscriptions_handler() 209 { 210 // Remove the following lines when you implement this test. 211 $this->markTestIncomplete( 212 'This test has not been implemented yet.' 213 ); 214 } 215 216 /** 217 * @covers ::bbp_subscriptions_handler 218 * @todo Implement test_bbp_subscriptions_handler(). 219 */ 220 public function test_bbp_subscriptions_handler() 221 { 222 // Remove the following lines when you implement this test. 223 $this->markTestIncomplete( 224 'This test has not been implemented yet.' 225 ); 226 } 12 /** 13 * @covers ::bbp_get_forum_subscribers 14 */ 15 public function test_bbp_get_forum_subscribers() { 16 $u = $this->factory->user->create_many( 3 ); 17 $f = $this->factory->forum->create_many( 2 ); 18 19 // Add forum subscriptions. 20 bbp_add_user_forum_subscription( $u[0], $f[0] ); 21 bbp_add_user_forum_subscription( $u[1], $f[0] ); 22 bbp_add_user_forum_subscription( $u[2], $f[0] ); 23 24 $subscribers = bbp_get_forum_subscribers( $f[0] ); 25 26 $this->assertEquals( array( $u[0], $u[1], $u[2] ), $subscribers ); 27 28 // Add forum subscriptions. 29 bbp_add_user_forum_subscription( $u[0], $f[1] ); 30 bbp_add_user_forum_subscription( $u[2], $f[1] ); 31 32 $subscribers = bbp_get_forum_subscribers( $f[1] ); 33 34 $this->assertEquals( array( $u[0], $u[2] ), $subscribers ); 35 } 36 37 /** 38 * @covers ::bbp_get_topic_subscribers 39 */ 40 public function test_bbp_get_topic_subscribers() { 41 $u = $this->factory->user->create_many( 3 ); 42 $t = $this->factory->topic->create_many( 2 ); 43 44 // Add topic subscriptions. 45 bbp_add_user_topic_subscription( $u[0], $t[0] ); 46 bbp_add_user_topic_subscription( $u[1], $t[0] ); 47 bbp_add_user_topic_subscription( $u[2], $t[0] ); 48 49 $subscribers = bbp_get_topic_subscribers( $t[0] ); 50 51 $this->assertEquals( array( $u[0], $u[1], $u[2] ), $subscribers ); 52 53 // Add topic subscriptions. 54 bbp_add_user_topic_subscription( $u[0], $t[1] ); 55 bbp_add_user_topic_subscription( $u[2], $t[1] ); 56 57 $subscribers = bbp_get_topic_subscribers( $t[1] ); 58 59 $this->assertEquals( array( $u[0], $u[2] ), $subscribers ); 60 } 61 62 /** 63 * @covers ::bbp_get_user_subscriptions 64 * @expectedDeprecated bbp_get_user_subscriptions 65 */ 66 public function test_bbp_get_user_subscriptions() { 67 $u = $this->factory->user->create(); 68 $t = $this->factory->topic->create_many( 3 ); 69 70 // Add topic subscriptions. 71 bbp_add_user_topic_subscription( $u, $t[0] ); 72 bbp_add_user_topic_subscription( $u, $t[1] ); 73 bbp_add_user_topic_subscription( $u, $t[2] ); 74 75 $expected = bbp_has_topics( array( 'post__in' => array( $t[0], $t[1], $t[2] ) ) ); 76 $subscriptions = bbp_get_user_subscriptions( $u ); 77 78 $this->assertEquals( $expected, $subscriptions ); 79 80 // Remove topic subscription. 81 bbp_remove_user_topic_subscription( $u, $t[1] ); 82 83 $expected = bbp_has_topics( array( 'post__in' => array( $t[0], $t[2] ) ) ); 84 $subscriptions = bbp_get_user_subscriptions( $u ); 85 86 $this->assertEquals( $expected, $subscriptions ); 87 } 88 89 /** 90 * @covers ::bbp_get_user_topic_subscriptions 91 */ 92 public function test_bbp_get_user_topic_subscriptions() { 93 $u = $this->factory->user->create(); 94 $t = $this->factory->topic->create_many( 3 ); 95 96 // Add topic subscriptions. 97 bbp_add_user_topic_subscription( $u, $t[0] ); 98 bbp_add_user_topic_subscription( $u, $t[1] ); 99 bbp_add_user_topic_subscription( $u, $t[2] ); 100 101 $expected = bbp_has_topics( array( 'post__in' => array( $t[0], $t[1], $t[2] ) ) ); 102 $subscriptions = bbp_get_user_topic_subscriptions( $u ); 103 104 $this->assertEquals( $expected, $subscriptions ); 105 106 // Remove topic subscription. 107 bbp_remove_user_topic_subscription( $u, $t[1] ); 108 109 $expected = bbp_has_topics( array( 'post__in' => array( $t[0], $t[2] ) ) ); 110 $subscriptions = bbp_get_user_topic_subscriptions( $u ); 111 112 $this->assertEquals( $expected, $subscriptions ); 113 } 114 115 /** 116 * @covers ::bbp_get_user_forum_subscriptions 117 */ 118 public function test_bbp_get_user_forum_subscriptions() { 119 $u = $this->factory->user->create(); 120 $f = $this->factory->forum->create_many( 3 ); 121 122 // Add forum subscriptions. 123 bbp_add_user_forum_subscription( $u, $f[0] ); 124 bbp_add_user_forum_subscription( $u, $f[1] ); 125 bbp_add_user_forum_subscription( $u, $f[2] ); 126 127 $expected = bbp_has_forums( array( 'post__in' => array( $f[0], $f[1], $f[2] ) ) ); 128 $subscriptions = bbp_get_user_forum_subscriptions( $u ); 129 130 $this->assertEquals( $expected, $subscriptions ); 131 132 // Remove forum subscription. 133 bbp_remove_user_forum_subscription( $u, $f[1] ); 134 135 $expected = bbp_has_forums( array( 'post__in' => array( $f[0], $f[2] ) ) ); 136 $subscriptions = bbp_get_user_forum_subscriptions( $u ); 137 138 $this->assertEquals( $expected, $subscriptions ); 139 } 140 141 /** 142 * @covers ::bbp_get_user_subscribed_forum_ids 143 */ 144 public function test_bbp_get_user_subscribed_forum_ids() { 145 $u = $this->factory->user->create(); 146 $f = $this->factory->forum->create_many( 3 ); 147 148 // Add forum subscriptions. 149 bbp_add_user_forum_subscription( $u, $f[0] ); 150 bbp_add_user_forum_subscription( $u, $f[1] ); 151 bbp_add_user_forum_subscription( $u, $f[2] ); 152 153 $subscriptions = bbp_get_user_subscribed_forum_ids( $u ); 154 155 $this->assertEquals( array( $f[0], $f[1], $f[2] ), $subscriptions ); 156 157 // Remove forum subscription. 158 bbp_remove_user_forum_subscription( $u, $f[1] ); 159 160 $subscriptions = bbp_get_user_subscribed_forum_ids( $u ); 161 162 $this->assertEquals( array( $f[0], $f[2] ), $subscriptions ); 163 } 164 165 /** 166 * @covers ::bbp_get_user_subscribed_topic_ids 167 */ 168 public function test_bbp_get_user_subscribed_topic_ids() { 169 $u = $this->factory->user->create(); 170 $t = $this->factory->topic->create_many( 3 ); 171 172 // Add topic subscriptions. 173 bbp_add_user_topic_subscription( $u, $t[0] ); 174 bbp_add_user_topic_subscription( $u, $t[1] ); 175 bbp_add_user_topic_subscription( $u, $t[2] ); 176 177 $subscriptions = bbp_get_user_subscribed_topic_ids( $u ); 178 179 $this->assertEquals( array( $t[0], $t[1], $t[2] ), $subscriptions ); 180 181 // Remove topic subscription. 182 bbp_remove_user_topic_subscription( $u, $t[1] ); 183 184 $subscriptions = bbp_get_user_subscribed_topic_ids( $u ); 185 186 $this->assertEquals( array( $t[0], $t[2] ), $subscriptions ); 187 } 188 189 /** 190 * @covers ::bbp_is_user_subscribed 191 */ 192 public function test_bbp_is_user_subscribed() { 193 $u = $this->factory->user->create(); 194 $f = $this->factory->forum->create_many( 2 ); 195 $t = $this->factory->topic->create_many( 2 ); 196 197 // Add forum subscription. 198 bbp_add_user_forum_subscription( $u, $f[0] ); 199 200 $this->assertTrue( bbp_is_user_subscribed( $u, $f[0] ) ); 201 $this->assertFalse( bbp_is_user_subscribed( $u, $f[1] ) ); 202 203 // Add topic subscription. 204 bbp_add_user_topic_subscription( $u, $t[0] ); 205 206 $this->assertTrue( bbp_is_user_subscribed( $u, $t[0] ) ); 207 $this->assertFalse( bbp_is_user_subscribed( $u, $t[1] ) ); 208 } 209 210 /** 211 * @covers ::bbp_is_user_subscribed_to_forum 212 */ 213 public function test_bbp_is_user_subscribed_to_forum() { 214 $u = $this->factory->user->create(); 215 $f = $this->factory->forum->create_many( 2 ); 216 217 // Add forum subscription. 218 bbp_add_user_forum_subscription( $u, $f[0] ); 219 220 $this->assertTrue( bbp_is_user_subscribed_to_forum( $u, $f[0] ) ); 221 $this->assertFalse( bbp_is_user_subscribed_to_forum( $u, $f[1] ) ); 222 } 223 224 /** 225 * @covers ::bbp_is_user_subscribed_to_topic 226 */ 227 public function test_bbp_is_user_subscribed_to_topic() { 228 $u = $this->factory->user->create(); 229 $t = $this->factory->topic->create_many( 2 ); 230 231 // Add topic subscription. 232 bbp_add_user_topic_subscription( $u, $t[0] ); 233 234 $this->assertTrue( bbp_is_user_subscribed_to_topic( $u, $t[0] ) ); 235 $this->assertFalse( bbp_is_user_subscribed_to_topic( $u, $t[1] ) ); 236 } 237 238 /** 239 * @covers ::bbp_add_user_subscription 240 */ 241 public function test_bbp_add_user_subscription() { 242 $u = $this->factory->user->create(); 243 $f = $this->factory->forum->create(); 244 $t = $this->factory->topic->create( array( 245 'post_parent' => $f, 246 'topic_meta' => array( 247 'forum_id' => $f, 248 ), 249 ) ); 250 251 // Add forum subscription. 252 bbp_add_user_subscription( $u, $f ); 253 254 $this->assertTrue( bbp_is_user_subscribed_to_forum( $u, $f ) ); 255 256 // Add topic subscription. 257 bbp_add_user_subscription( $u, $t ); 258 259 $this->assertTrue( bbp_is_user_subscribed_to_topic( $u, $t ) ); 260 } 261 262 /** 263 * @covers ::bbp_add_user_forum_subscription 264 */ 265 public function test_bbp_add_user_forum_subscription() { 266 $u = $this->factory->user->create(); 267 $f = $this->factory->forum->create(); 268 269 // Add forum subscription. 270 bbp_add_user_forum_subscription( $u, $f ); 271 272 $this->assertTrue( bbp_is_user_subscribed_to_forum( $u, $f ) ); 273 } 274 275 /** 276 * @covers ::bbp_add_user_topic_subscription 277 */ 278 public function test_bbp_add_user_topic_subscription() { 279 $u = $this->factory->user->create(); 280 $t = $this->factory->topic->create(); 281 282 // Add forum subscription. 283 bbp_add_user_topic_subscription( $u, $t ); 284 285 $this->assertTrue( bbp_is_user_subscribed_to_topic( $u, $t ) ); 286 } 287 288 /** 289 * @covers ::bbp_remove_user_subscription 290 */ 291 public function test_bbp_remove_user_subscription() { 292 $u = $this->factory->user->create(); 293 $f = $this->factory->forum->create(); 294 $t = $this->factory->topic->create( array( 295 'post_parent' => $f, 296 'topic_meta' => array( 297 'forum_id' => $f, 298 ), 299 ) ); 300 301 // Add forum subscription. 302 bbp_add_user_subscription( $u, $f ); 303 304 $this->assertTrue( bbp_is_user_subscribed_to_forum( $u, $f ) ); 305 306 // Remove forum subscription. 307 bbp_remove_user_subscription( $u, $f ); 308 309 $this->assertFalse( bbp_is_user_subscribed_to_forum( $u, $f ) ); 310 311 // Add topic subscription. 312 bbp_add_user_subscription( $u, $t ); 313 314 $this->assertTrue( bbp_is_user_subscribed_to_topic( $u, $t ) ); 315 316 // Remove topic subscription. 317 bbp_remove_user_subscription( $u, $t ); 318 319 $this->assertFalse( bbp_is_user_subscribed_to_topic( $u, $t ) ); 320 } 321 322 /** 323 * @covers ::bbp_remove_user_forum_subscription 324 */ 325 public function test_bbp_remove_user_forum_subscription() { 326 $u = $this->factory->user->create(); 327 $f = $this->factory->forum->create(); 328 329 // Add forum subscription. 330 bbp_add_user_forum_subscription( $u, $f ); 331 332 $this->assertTrue( bbp_is_user_subscribed_to_forum( $u, $f ) ); 333 334 // Remove forum subscription. 335 bbp_remove_user_forum_subscription( $u, $f ); 336 337 $this->assertFalse( bbp_is_user_subscribed_to_forum( $u, $f ) ); 338 } 339 340 /** 341 * @covers ::bbp_remove_user_topic_subscription 342 */ 343 public function test_bbp_remove_user_topic_subscription() { 344 $u = $this->factory->user->create(); 345 $t = $this->factory->topic->create(); 346 347 // Add forum subscription. 348 bbp_add_user_topic_subscription( $u, $t ); 349 350 $this->assertTrue( bbp_is_user_subscribed_to_topic( $u, $t ) ); 351 352 // Remove topic subscription. 353 bbp_remove_user_topic_subscription( $u, $t ); 354 355 $this->assertFalse( bbp_is_user_subscribed_to_topic( $u, $t ) ); 356 } 357 358 /** 359 * @covers ::bbp_forum_subscriptions_handler 360 * @todo Implement test_bbp_forum_subscriptions_handler(). 361 */ 362 public function test_bbp_forum_subscriptions_handler() { 363 // Remove the following lines when you implement this test. 364 $this->markTestIncomplete( 365 'This test has not been implemented yet.' 366 ); 367 } 368 369 /** 370 * @covers ::bbp_subscriptions_handler 371 * @todo Implement test_bbp_subscriptions_handler(). 372 */ 373 public function test_bbp_subscriptions_handler() { 374 // Remove the following lines when you implement this test. 375 $this->markTestIncomplete( 376 'This test has not been implemented yet.' 377 ); 378 } 227 379 }
Note: See TracChangeset
for help on using the changeset viewer.