Skip to:
Content

bbPress.org

Changeset 7353


Ignore:
Timestamp:
11/14/2025 07:39:41 PM (3 months ago)
Author:
johnjamesjacoby
Message:

Tools - Build: Upgrade Composer, npm, and add wp-env for PHPUnit.

This commit modernizes the dev environment, bringing it up-to-speed with BuddyPress and others.

Props sirlouen.

In trunk, for 2.7.

Fixes #3610.

Location:
trunk
Files:
1 added
11 edited

Legend:

Unmodified
Added
Removed
  • trunk/.gitignore

    r7164 r7353  
    1515/phpunit.xml
    1616/pnpm-lock.yaml
     17.phpunit.result.cache
    1718
    1819# Output directory.
  • trunk/composer.json

    r7352 r7353  
    1919        "lint": [
    2020            "@php ./vendor/squizlabs/php_codesniffer/bin/phpcs"
    21         ]
     21        ],
     22        "test": [
     23            "@php ./vendor/bin/phpunit -c phpunit.xml.dist"
     24        ],
     25        "phpunit": [
     26            "@test"
     27        ]
     28    },
     29    "config": {
     30        "allow-plugins": {
     31            "composer/installers": true,
     32            "dealerdirect/phpcodesniffer-composer-installer": true
     33        }
    2234    }
    2335}
  • trunk/package.json

    r7283 r7353  
    3131        "@wordpress/browserslist-config": "~2.1.3",
    3232        "@wordpress/stylelint-config": "~22.4.0",
     33        "@wordpress/env": "^10.8.0",
    3334        "autoprefixer": "~8.2.0",
    3435        "browserslist": "~4.23.2",
     
    4950        "grunt-rtlcss": "~2.0.2",
    5051        "grunt-sass": "~3.1.0",
    51         "grunt-stylelint": "~0.8.0",
     52        "grunt-stylelint": "~0.18",
    5253        "grunt-terser": "~2.0.0",
    5354        "grunt-wp-i18n": "~1.0.3",
     55        "grunt-composer": "~0.4.5",
    5456        "matchdep": "~2.0.0",
    5557        "node-sass": "~9.0.0",
     
    5759        "postcss-markdown": "~1.2.0",
    5860        "postcss-scss": "~1.0.2",
    59         "stylelint": "~15.11.0",
    60         "stylelint-scss": "~6.4.1",
     61        "stylelint": "~14",
     62        "stylelint-scss": "~5",
    6163        "terser": "~5.31.3"
     64    },
     65    "scripts": {
     66        "wp-env": "wp-env",
     67        "test-php": "npm run wp-env run cli -- --env-cwd=wp-content/plugins/bbPress composer test"
    6268    }
    6369}
  • trunk/phpunit.xml.dist

    r7042 r7353  
    88    >
    99    <testsuites>
    10         <testsuite>
     10        <testsuite name="bbPress Test Suite">
    1111            <directory suffix=".php">tests/phpunit/testcases/</directory>
    1212        </testsuite>
     
    2828        <!-- </listener>-->
    2929    <!-- </listeners>-->
    30     <filter>
    31         <whitelist processUncoveredFilesFromWhitelist="true">
    32             <directory suffix=".php">src</directory>
    33         </whitelist>
    34     </filter>
     30    <coverage>
     31        <include>
     32            <directory suffix=".php">./src</directory>
     33        </include>
     34        <exclude>
     35            <directory suffix=".php">./tests</directory>
     36            <directory suffix=".php">./vendor</directory>
     37        </exclude>
     38    </coverage>
    3539</phpunit>
  • trunk/tests/phpunit/includes/testcase.php

    r6573 r7353  
    88     * Fake WP mail globals, to avoid errors
    99     */
    10     public static function setUpBeforeClass() {
     10    public static function setUpBeforeClass(): void {
    1111        add_filter( 'wp_mail',      array( 'BBP_UnitTestCase', 'setUp_wp_mail'    ) );
    1212        add_filter( 'wp_mail_from', array( 'BBP_UnitTestCase', 'tearDown_wp_mail' ) );
    1313    }
    1414
    15     public function setUp() {
     15    public function setUp(): void {
    1616        parent::setUp();
    1717
     
    3131    }
    3232
    33     public function tearDown() {
     33    public function tearDown(): void {
    3434        global $wpdb;
    3535
     
    5757    }
    5858
    59     function assertPreConditions() {
     59    function assertPreConditions(): void {
    6060        parent::assertPreConditions();
    6161    }
  • trunk/tests/phpunit/testcases/admin/tools.php

    r6848 r7353  
    88class BBP_Tests_Admin_Tools extends BBP_UnitTestCase {
    99    protected $old_current_user = 0;
    10 
    11     public function setUp() {
     10    protected $keymaster_id;
     11
     12    public function setUp(): void {
    1213        parent::setUp();
    1314        $this->old_current_user = get_current_user_id();
     
    2324    }
    2425
    25     public function tearDown() {
     26    public function tearDown(): void {
    2627        parent::tearDown();
    2728        $this->set_current_user( $this->old_current_user );
  • trunk/tests/phpunit/testcases/common/functions.php

    r7302 r7353  
    99class BBP_Tests_Common_Functions extends BBP_UnitTestCase {
    1010
     11    protected $old_current_user;
     12    protected $moderator_id;
     13    protected $keymaster_id;
     14
    1115    /**
    1216     * @covers ::bbp_number_format
  • trunk/tests/phpunit/testcases/common/verify-nonce.php

    r6013 r7353  
    1111    private $request_uri = '';
    1212
    13     public function setUp() {
     13    public function setUp(): void {
    1414        parent::setUp();
    1515
     
    2727    }
    2828
    29     public function tearDown() {
     29    public function tearDown(): void {
    3030            $_SERVER['HTTP_HOST'] = $this->http_host;
    3131
  • trunk/tests/phpunit/testcases/replies/template/status.php

    r5784 r7353  
    1010class BBP_Tests_Repliess_Template_Status extends BBP_UnitTestCase {
    1111    protected $old_current_user = 0;
    12 
    13     public function setUp() {
     12    protected $keymaster_id;
     13
     14    public function setUp(): void {
    1415        parent::setUp();
    1516        $this->old_current_user = get_current_user_id();
     
    1920    }
    2021
    21     public function tearDown() {
     22    public function tearDown(): void {
    2223        parent::tearDown();
    2324        $this->set_current_user( $this->old_current_user );
  • trunk/tests/phpunit/testcases/topics/functions/topic.php

    r7235 r7353  
    1010class BBP_Tests_Topics_Functions_Topic extends BBP_UnitTestCase {
    1111
     12    protected $old_current_user;
     13    protected $keymaster_id;
     14
    1215    /**
    1316     * @group canonical
  • trunk/tests/phpunit/testcases/users/template/user.php

    r6868 r7353  
    99class BBP_Tests_Users_Template_User extends BBP_UnitTestCase {
    1010
     11    protected $keymaster_userdata;
     12    protected $keymaster_id;
    1113    protected $old_current_user = 0;
    1214
    13     public function setUp() {
     15    public function setUp(): void {
    1416        parent::setUp();
    1517        $this->old_current_user = get_current_user_id();
     
    2022    }
    2123
    22     public function tearDown() {
     24    public function tearDown(): void {
    2325        parent::tearDown();
    2426        $this->set_current_user( $this->old_current_user );
     
    3840
    3941        // Output.
    40         $this->expectOutputString( $formatted_value );
    41         bbp_user_id( $this->keymaster_id );
     42        $this->expectOutputRegex( '/' . preg_quote($formatted_value, '/') . '/' );
     43        bbp_user_id( $this->keymaster_id );
    4244    }
    4345
Note: See TracChangeset for help on using the changeset viewer.