Skip to:
Content

BuddyPress.org

Ticket #6127: 6127.unittest.patch

File 6127.unittest.patch, 1.2 KB (added by imath, 10 years ago)
  • tests/phpunit/testcases/activity/cache.php

    diff --git tests/phpunit/testcases/activity/cache.php tests/phpunit/testcases/activity/cache.php
    index f0b9259..0e4c6dc 100644
    class BP_Tests_Activity_Cache extends BP_UnitTestCase { 
    5353
    5454                $this->assertEquals( $expected, $found );
    5555        }
     56
     57        /**
     58         * @group bp_activity_clear_cache_for_activity
     59         */
     60        public function test_bp_activity_clear_cache_for_activity() {
     61                $u = $this->factory->user->create();
     62
     63                $a = $this->factory->activity->create( array(
     64                        'component'     => buddypress()->activity->id,
     65                        'type'          => 'activity_update',
     66                        'user_id'       => $u,
     67                        'content'       => 'foo bar',
     68                ) );
     69
     70                $a_fp = bp_activity_get( array(
     71                        'type' => 'activity_update',
     72                        'user' => array( 'filter' => array( 'user_id' => $u ) ),
     73                ) );
     74
     75                $activity_updated = new BP_Activity_Activity( $a );
     76                $activity_updated->content = 'bar foo';
     77                $activity_updated->save();
     78
     79                $a_fp = bp_activity_get( array(
     80                        'type' => 'activity_update',
     81                        'user' => array( 'filter' => array( 'user_id' => $u ) ),
     82                ) );
     83
     84                $this->assertSame( 'bar foo', $a_fp['activities'][0]->content );
     85        }
    5686}