[buddypress-trac] [BuddyPress Trac] #5727: Unit Tests: unset globals when using friends_add_friend() in setUp()

buddypress-trac noreply at wordpress.org
Sat Jun 21 19:23:53 UTC 2014


#5727: Unit Tests: unset globals when using friends_add_friend() in setUp()
--------------------------+-----------------
 Reporter:  DJPaul        |      Owner:
     Type:  defect (bug)  |     Status:  new
 Priority:  normal        |  Milestone:  2.1
Component:  Unit Tests    |    Version:
 Severity:  normal        |   Keywords:
--------------------------+-----------------
 If you run this unit test
 https://gist.github.com/paulgibbs/98890701a68202794570, it will produce
 the following warnings:

 {{{
 vagrant at vvv:~/wp-content/plugins/buddypress$ phpunit --filter
 PaulsDopeTest
 Installing...
 Running as single site... To run multisite, use -c
 tests/phpunit/multisite.xml
 Installing BuddyPress...
 Not running ajax tests... To execute these, use --group ajax.
 PHPUnit 4.0.14 by Sebastian Bergmann.

 Configuration read from /srv/www/wordpress-develop/src/wp-
 content/plugins/buddypress/phpunit.xml.dist

 E

 Time: 8.16 seconds, Memory: 28.75Mb

 There was 1 error:

 1) BP_Tests_PaulIsCool::test_PaulsDopeTest
 Undefined property: stdClass::$show_avatars

 /srv/www/wordpress-develop/src/wp-content/plugins/buddypress/src/bp-core
 /bp-core-avatars.php:179
 /srv/www/wordpress-develop/src/wp-content/plugins/buddypress/src/bp-core
 /bp-core-classes.php:813
 /srv/www/wordpress-develop/src/wp-content/plugins/buddypress/src/bp-core
 /bp-core-classes.php:766
 /srv/www/wordpress-develop/src/wp-content/plugins/buddypress/src/bp-
 friends/bp-friends-classes.php:129
 /srv/www/wordpress-develop/src/wp-content/plugins/buddypress/src/bp-
 friends/bp-friends-classes.php:107
 /srv/www/wordpress-develop/src/wp-content/plugins/buddypress/src/bp-
 friends/bp-friends-cache.php:23
 /srv/www/wordpress-develop/src/wp-includes/plugin.php:470
 /srv/www/wordpress-develop/src/wp-content/plugins/buddypress/src/bp-
 friends/bp-friends-functions.php:71
 /srv/www/wordpress-develop/src/wp-
 content/plugins/buddypress/tests/phpunit/testcases/activity/paul.php:23

 FAILURES!
 Tests: 1, Assertions: 0, Errors: 1.
 vagrant at vvv:~/wp-content/plugins/buddypress$
 }}}

 `$bp->avatar->show_avatars` isn't set. I am not sure if we are calling
 this chain of functions too early, or if our `BP_UnitTestCase`'s
 `clean_up_global_scope()` approach to resetting globals between tests is
 too crappy (it kind of is, and most of that's my fault).

--
Ticket URL: <https://buddypress.trac.wordpress.org/ticket/5727>
BuddyPress Trac <http://buddypress.org/>
BuddyPress Trac


More information about the buddypress-trac mailing list