Make WordPress Core


Ignore:
Timestamp:
07/13/2021 10:43:42 AM (5 years ago)
Author:
SergeyBiryukov
Message:

Tests: Clean up skipping conditions and requirements for various tests.

This improves the consistency of test skipping and ensures that:

  • The @requires annotations use the right condition and format, and are on the right level (class vs. function).
  • Inline conditions with a markTestSkipped() call are only used when annotations cannot be used.
  • All markTestSkipped() calls contain a verbose explanation of why the test is being skipped.

Props jrf, hellofromTonya.
Fixes #53009.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/tests/phpunit/tests/compat.php

    r48996 r51415  
    243243         *
    244244         * @ticket 43583
     245         *
     246         * @requires extension intl
    245247         */
    246248        function test_is_countable_ResourceBundle() {
    247                 if ( ! class_exists( 'ResourceBundle' ) ) {
    248                         $this->markTestSkipped( 'The intl extension is not loaded. ResourceBundle not tested for is_countable().' );
    249                 }
    250 
    251249                $this->assertTrue( is_countable( new ResourceBundle( 'en', null ) ) );
    252250        }
     
    256254         *
    257255         * @ticket 43583
     256         *
     257         * @requires extension simplexml
    258258         */
    259259        function test_is_countable_SimpleXMLElement() {
    260                 if ( ! class_exists( 'SimpleXMLElement' ) ) {
    261                         $this->markTestSkipped( 'The xml extension is not loaded. SimpleXMLElement not tested for is_countable().' );
    262                 }
    263 
    264260                $this->assertTrue( is_countable( new SimpleXMLElement( '<xml><tag>1</tag><tag>2</tag></xml>' ) ) );
    265261        }
Note: See TracChangeset for help on using the changeset viewer.