17 | | // Remove the following lines when you implement this test. |
18 | | $this->markTestIncomplete( |
19 | | 'This test has not been implemented yet.' |
20 | | ); |
| 16 | $f = $this->factory->forum->create(); |
| 17 | $t = $this->factory->topic->create( array( |
| 18 | 'post_parent' => $f, |
| 19 | ) ); |
| 20 | $r1 = $this->factory->reply->create( array( |
| 21 | 'post_parent' => $t, |
| 22 | ) ); |
| 23 | |
| 24 | $id = bbp_update_topic_last_active_id( $t, $r1 ); |
| 25 | $this->assertSame( $r1, $id ); |
| 26 | |
| 27 | $id = bbp_get_topic_last_active_id( $t ); |
| 28 | $this->assertSame( $r1, $id ); |
| 29 | |
| 30 | $r2 = $this->factory->reply->create_many( 2, array( |
| 31 | 'post_parent' => $t, |
| 32 | ) ); |
| 33 | |
| 34 | bbp_update_topic_last_active_id( $t ); |
| 35 | $id = bbp_get_topic_last_active_id( $t ); |
| 36 | $this->assertSame( $r2[1], $id ); |
28 | | // Remove the following lines when you implement this test. |
29 | | $this->markTestIncomplete( |
30 | | 'This test has not been implemented yet.' |
31 | | ); |
| 43 | $f = $this->factory->forum->create(); |
| 44 | $t = $this->factory->topic->create( array( |
| 45 | 'post_parent' => $f, |
| 46 | ) ); |
| 47 | $r1 = $this->factory->reply->create( array( |
| 48 | 'post_parent' => $t, |
| 49 | ) ); |
| 50 | |
| 51 | $r1_time_raw = get_post_field( 'post_date', $r1 ); |
| 52 | $r1_time_formatted = bbp_get_time_since( bbp_convert_date( $r1_time_raw ) ); |
| 53 | |
| 54 | $time = bbp_update_topic_last_active_time( $t, $r1_time_raw ); |
| 55 | $this->assertSame( $r1_time_raw, $time ); |
| 56 | |
| 57 | $time = bbp_get_topic_last_active_time( $t ); |
| 58 | $this->assertSame( $r1_time_formatted, $time ); |
| 59 | |
| 60 | $r2 = $this->factory->reply->create_many( 2, array( |
| 61 | 'post_parent' => $t, |
| 62 | ) ); |
| 63 | |
| 64 | $r2_time_raw = get_post_field( 'post_date', $r2[1] ); |
| 65 | $r2_time_formatted = bbp_get_time_since( bbp_convert_date( $r2_time_raw ) ); |
| 66 | |
| 67 | bbp_update_topic_last_active_time( $t ); |
| 68 | $time = bbp_get_topic_last_active_time( $t ); |
| 69 | $this->assertSame( $r2_time_formatted, $time ); |
39 | | // Remove the following lines when you implement this test. |
40 | | $this->markTestIncomplete( |
41 | | 'This test has not been implemented yet.' |
42 | | ); |
| 76 | $f = $this->factory->forum->create(); |
| 77 | $t = $this->factory->topic->create( array( |
| 78 | 'post_parent' => $f, |
| 79 | ) ); |
| 80 | $r1 = $this->factory->reply->create( array( |
| 81 | 'post_parent' => $t, |
| 82 | ) ); |
| 83 | |
| 84 | $id = bbp_update_topic_last_reply_id( $t, $r1 ); |
| 85 | $this->assertSame( $r1, $id ); |
| 86 | |
| 87 | $id = bbp_get_topic_last_reply_id( $t ); |
| 88 | $this->assertSame( $r1, $id ); |
| 89 | |
| 90 | $r2 = $this->factory->reply->create_many( 2, array( |
| 91 | 'post_parent' => $t, |
| 92 | ) ); |
| 93 | |
| 94 | bbp_update_topic_last_reply_id( $t ); |
| 95 | $id = bbp_get_topic_last_reply_id( $t ); |
| 96 | $this->assertSame( $r2[1], $id ); |