Skip to:
Content

BuddyPress.org


Ignore:
Timestamp:
08/13/2022 08:58:51 AM (21 months ago)
Author:
imath
Message:

Fully enjoy Yoast’s PHPUnit polyfills

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

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/tests/phpunit/testcases/core/class-bp-button.php

    r11737 r13314  
    187187        ) );
    188188
    189         $this->assertInternalType( 'int', strpos( $b->contents, '<section ' ) );
    190         $this->assertInternalType( 'int', strpos( $b->contents, 'class="section-class ' ) );
    191         $this->assertInternalType( 'int', strpos( $b->contents, 'id="section-id"' ) );
    192         $this->assertInternalType( 'int', strpos( $b->contents, 'data-parent="foo"' ) );
    193         $this->assertInternalType( 'int', strpos( $b->contents, '<button ' ) );
    194         $this->assertInternalType( 'int', strpos( $b->contents, 'autofocus="autofocus"' ) );
    195         $this->assertInternalType( 'int', strpos( $b->contents, 'type="submit"' ) );
    196         $this->assertInternalType( 'int', strpos( $b->contents, 'name="my-button"' ) );
     189        $this->assertIsInt( strpos( $b->contents, '<section ' ) );
     190        $this->assertIsInt( strpos( $b->contents, 'class="section-class ' ) );
     191        $this->assertIsInt( strpos( $b->contents, 'id="section-id"' ) );
     192        $this->assertIsInt( strpos( $b->contents, 'data-parent="foo"' ) );
     193        $this->assertIsInt( strpos( $b->contents, '<button ' ) );
     194        $this->assertIsInt( strpos( $b->contents, 'autofocus="autofocus"' ) );
     195        $this->assertIsInt( strpos( $b->contents, 'type="submit"' ) );
     196        $this->assertIsInt( strpos( $b->contents, 'name="my-button"' ) );
    197197    }
    198198
     
    216216        ) );
    217217
    218         $this->assertInternalType( 'int', strpos( $b->contents, '<section ' ) );
    219         $this->assertInternalType( 'int', strpos( $b->contents, 'class="section-class ' ) );
    220         $this->assertInternalType( 'int', strpos( $b->contents, 'id="section-id"' ) );
    221         $this->assertInternalType( 'int', strpos( $b->contents, 'href="http://example.com"' ) );
    222         $this->assertInternalType( 'int', strpos( $b->contents, 'class="link-class"' ) );
    223         $this->assertInternalType( 'int', strpos( $b->contents, 'id="link-id"' ) );
    224         $this->assertInternalType( 'int', strpos( $b->contents, 'rel="nofollow"' ) );
    225         $this->assertInternalType( 'int', strpos( $b->contents, 'title="link-title"' ) );
     218        $this->assertIsInt( strpos( $b->contents, '<section ' ) );
     219        $this->assertIsInt( strpos( $b->contents, 'class="section-class ' ) );
     220        $this->assertIsInt( strpos( $b->contents, 'id="section-id"' ) );
     221        $this->assertIsInt( strpos( $b->contents, 'href="http://example.com"' ) );
     222        $this->assertIsInt( strpos( $b->contents, 'class="link-class"' ) );
     223        $this->assertIsInt( strpos( $b->contents, 'id="link-id"' ) );
     224        $this->assertIsInt( strpos( $b->contents, 'rel="nofollow"' ) );
     225        $this->assertIsInt( strpos( $b->contents, 'title="link-title"' ) );
    226226    }
    227227
     
    242242        ) );
    243243
    244         $this->assertInternalType( 'int', strpos( $b->contents, '<button class="new-class"' ) );
     244        $this->assertIsInt( strpos( $b->contents, '<button class="new-class"' ) );
    245245    }
    246246
Note: See TracChangeset for help on using the changeset viewer.