Opened 12 years ago
Closed 12 years ago
#5727 closed defect (bug) (fixed)
Unit Tests: unset globals when using friends_add_friend() in setUp()
| Reported by: |
|
Owned by: |
|
|---|---|---|---|
| Milestone: | 2.1 | Priority: | normal |
| Severity: | normal | Version: | |
| Component: | Build/Test Tools | Keywords: | |
| Cc: |
Description
If you run this unit test https://gist.github.com/paulgibbs/98890701a68202794570, it will produce the following warnings:
vagrant@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@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).
Change History (1)
Note: See
TracTickets for help on using
tickets.
In 8555: