mirror of
https://github.com/buddypress/buddypress.git
synced 2026-07-24 21:16:56 +08:00
Using these polyfills let us use PHPUnit v9.x for our tests and add PHP 8.1 to our testing matrix. Some additional edits to our PHP unit tests suite were needed: - Stop using PHPunit deprecated functions. - Rename some `BP_UnitTestCase` methods to use Yoast's polyfills. - Edit the PHP Unit test GH action and also run this action on pull requests. - Update some composer dependencies, remove the one about `phpunit/phpunit:^7.5` and add a new composer script to use PHPUnit v9.x. Props renatonascalves, rafiahmedd Closes https://github.com/buddypress/buddypress/pull/13 Fixes #8649 git-svn-id: https://buddypress.svn.wordpress.org/trunk@13314 cdf35c40-ae34-48e0-9cc9-0c9da1808c22
40 lines
1.3 KiB
PHP
40 lines
1.3 KiB
PHP
<?php
|
|
/**
|
|
* @group settings
|
|
* @group routing
|
|
*/
|
|
class BP_Tests_Routing_Settings extends BP_UnitTestCase {
|
|
protected $old_current_user = 0;
|
|
|
|
public function set_up() {
|
|
parent::set_up();
|
|
|
|
$this->old_current_user = get_current_user_id();
|
|
$this->set_current_user( self::factory()->user->create( array( 'role' => 'subscriber' ) ) );
|
|
}
|
|
|
|
public function tear_down() {
|
|
parent::tear_down();
|
|
$this->set_current_user( $this->old_current_user );
|
|
}
|
|
|
|
function test_member_settings() {
|
|
$this->go_to( bp_core_get_user_domain( bp_loggedin_user_id() ) . bp_get_settings_slug() );
|
|
$this->assertTrue( bp_is_user_settings_general() );
|
|
}
|
|
|
|
function test_member_settings_notifications() {
|
|
$this->go_to( bp_core_get_user_domain( bp_loggedin_user_id() ) . bp_get_settings_slug() . '/notifications' );
|
|
$this->assertTrue( bp_is_user_settings_notifications() );
|
|
}
|
|
|
|
// @todo How best to test this?
|
|
/*function bp_is_user_settings_account_capbilities() {
|
|
$this->go_to( bp_core_get_user_domain( bp_loggedin_user_id() ) . bp_get_settings_slug() . '/capabilities' );
|
|
}*/
|
|
|
|
function bp_is_user_settings_account_delete() {
|
|
$this->go_to( bp_core_get_user_domain( bp_loggedin_user_id() ) . bp_get_settings_slug() . '/delete-account' );
|
|
$this->assertTrue( bp_is_user_settings_account_delete() );
|
|
}
|
|
}
|