17 | | // Remove the following lines when you implement this test. |
18 | | $this->markTestIncomplete( |
19 | | 'This test has not been implemented yet.' |
20 | | ); |
| 16 | $f1 = $this->factory->forum->create(); |
| 17 | $f2 = $this->factory->forum->create( array( |
| 18 | 'post_parent' => $f1, |
| 19 | ) ); |
| 20 | |
| 21 | $t1 = $this->factory->topic->create( array( |
| 22 | 'post_parent' => $f1, |
| 23 | ) ); |
| 24 | |
| 25 | $id = bbp_update_forum_last_topic_id( $f1, $t1 ); |
| 26 | $this->assertSame( $t1, $id ); |
| 27 | |
| 28 | $id = bbp_get_forum_last_topic_id( $f1 ); |
| 29 | $this->assertSame( $t1, $id ); |
| 30 | |
| 31 | $t2 = $this->factory->topic->create( array( |
| 32 | 'post_parent' => $f2, |
| 33 | ) ); |
| 34 | |
| 35 | bbp_update_forum_last_topic_id( $f2 ); |
| 36 | $id = bbp_get_forum_last_topic_id( $f2 ); |
| 37 | $this->assertSame( $t2, $id ); |
| 38 | |
| 39 | bbp_update_forum_last_topic_id( $f1 ); |
| 40 | $id = bbp_get_forum_last_topic_id( $f1 ); |
| 41 | $this->assertSame( $t2, $id ); |
28 | | // Remove the following lines when you implement this test. |
29 | | $this->markTestIncomplete( |
30 | | 'This test has not been implemented yet.' |
31 | | ); |
| 48 | $f1 = $this->factory->forum->create(); |
| 49 | $f2 = $this->factory->forum->create( array( |
| 50 | 'post_parent' => $f1, |
| 51 | ) ); |
| 52 | |
| 53 | $t1 = $this->factory->topic->create( array( |
| 54 | 'post_parent' => $f1, |
| 55 | ) ); |
| 56 | $t2 = $this->factory->topic->create( array( |
| 57 | 'post_parent' => $f2, |
| 58 | ) ); |
| 59 | |
| 60 | $r1 = $this->factory->reply->create( array( |
| 61 | 'post_parent' => $t1, |
| 62 | ) ); |
| 63 | |
| 64 | $id = bbp_update_forum_last_reply_id( $f1, $r1 ); |
| 65 | $this->assertSame( $r1, $id ); |
| 66 | |
| 67 | $id = bbp_get_forum_last_reply_id( $f1 ); |
| 68 | $this->assertSame( $r1, $id ); |
| 69 | |
| 70 | $r2 = $this->factory->reply->create( array( |
| 71 | 'post_parent' => $t2, |
| 72 | ) ); |
| 73 | |
| 74 | bbp_update_forum_last_reply_id( $f2 ); |
| 75 | $id = bbp_get_forum_last_reply_id( $f2 ); |
| 76 | $this->assertSame( $r2, $id ); |
| 77 | |
| 78 | bbp_update_forum_last_reply_id( $f1 ); |
| 79 | $id = bbp_get_forum_last_reply_id( $f1 ); |
| 80 | $this->assertSame( $r2, $id ); |
39 | | // Remove the following lines when you implement this test. |
40 | | $this->markTestIncomplete( |
41 | | 'This test has not been implemented yet.' |
42 | | ); |
| 87 | $f1 = $this->factory->forum->create(); |
| 88 | $f2 = $this->factory->forum->create( array( |
| 89 | 'post_parent' => $f1, |
| 90 | ) ); |
| 91 | |
| 92 | $t1 = $this->factory->topic->create( array( |
| 93 | 'post_parent' => $f1, |
| 94 | ) ); |
| 95 | $r1 = $this->factory->reply->create( array( |
| 96 | 'post_parent' => $t1, |
| 97 | ) ); |
| 98 | |
| 99 | $id = bbp_update_forum_last_active_id( $f1, $r1 ); |
| 100 | $this->assertSame( $r1, $id ); |
| 101 | |
| 102 | $id = bbp_get_forum_last_active_id( $f1 ); |
| 103 | $this->assertSame( $r1, $id ); |
| 104 | |
| 105 | $t2 = $this->factory->topic->create( array( |
| 106 | 'post_parent' => $f2, |
| 107 | ) ); |
| 108 | $r2 = $this->factory->reply->create( array( |
| 109 | 'post_parent' => $t2, |
| 110 | ) ); |
| 111 | |
| 112 | bbp_update_forum_last_active_id( $f2 ); |
| 113 | $id = bbp_get_forum_last_active_id( $f2 ); |
| 114 | $this->assertSame( $r2, $id ); |
| 115 | |
| 116 | bbp_update_forum_last_active_id( $f1 ); |
| 117 | $id = bbp_get_forum_last_active_id( $f1 ); |
| 118 | $this->assertSame( $r2, $id ); |
50 | | // Remove the following lines when you implement this test. |
51 | | $this->markTestIncomplete( |
52 | | 'This test has not been implemented yet.' |
53 | | ); |
| 125 | $f1 = $this->factory->forum->create(); |
| 126 | $f2 = $this->factory->forum->create( array( |
| 127 | 'post_parent' => $f1, |
| 128 | ) ); |
| 129 | |
| 130 | $t1 = $this->factory->topic->create( array( |
| 131 | 'post_parent' => $f1, |
| 132 | ) ); |
| 133 | $r1 = $this->factory->reply->create( array( |
| 134 | 'post_parent' => $t1, |
| 135 | 'reply_meta' => array( |
| 136 | 'forum_id' => $f1, |
| 137 | 'topic_id' => $t1, |
| 138 | ), |
| 139 | ) ); |
| 140 | |
| 141 | $r1_time_raw = get_post_field( 'post_date', $r1 ); |
| 142 | $r1_time_formatted = bbp_get_time_since( bbp_convert_date( $r1_time_raw ) ); |
| 143 | |
| 144 | $time = bbp_update_forum_last_active_time( $f1, $r1_time_raw ); |
| 145 | $this->assertSame( $r1_time_raw, $time ); |
| 146 | |
| 147 | $time = bbp_get_forum_last_active_time( $f1 ); |
| 148 | $this->assertSame( $r1_time_formatted, $time ); |
| 149 | |
| 150 | $t2 = $this->factory->topic->create( array( |
| 151 | 'post_parent' => $f2, |
| 152 | ) ); |
| 153 | $r2 = $this->factory->reply->create( array( |
| 154 | 'post_parent' => $t2, |
| 155 | 'reply_meta' => array( |
| 156 | 'forum_id' => $f2, |
| 157 | 'topic_id' => $t2, |
| 158 | ), |
| 159 | ) ); |
| 160 | |
| 161 | $r2_time_raw = get_post_field( 'post_date', $r2 ); |
| 162 | $r2_time_formatted = bbp_get_time_since( bbp_convert_date( $r2_time_raw ) ); |
| 163 | |
| 164 | bbp_update_forum_last_active_time( $f2 ); |
| 165 | $time = bbp_get_forum_last_active_time( $f2 ); |
| 166 | $this->assertSame( $r2_time_formatted, $time ); |
| 167 | |
| 168 | bbp_update_forum_last_active_time( $f1 ); |
| 169 | $time = bbp_get_forum_last_active_time( $f1 ); |
| 170 | $this->assertSame( $r2_time_formatted, $time ); |