Make WordPress Core


Ignore:
Timestamp:
08/30/2020 01:34:38 AM (4 years ago)
Author:
SergeyBiryukov
Message:

Tests: Move the tests for selected() and checked() to a more appropriate place.

Convert the tests to use data providers.

Props wittich.
Fixes #51166.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/tests/phpunit/tests/admin/includesTemplate.php

    r48880 r48907  
    44 */
    55class Tests_Admin_includesTemplate extends WP_UnitTestCase {
    6 
    7     function test_equal() {
    8         $this->assertEquals( ' selected=\'selected\'', selected( 'foo', 'foo', false ) );
    9         $this->assertEquals( ' checked=\'checked\'', checked( 'foo', 'foo', false ) );
    10 
    11         $this->assertEquals( ' selected=\'selected\'', selected( '1', 1, false ) );
    12         $this->assertEquals( ' checked=\'checked\'', checked( '1', 1, false ) );
    13 
    14         $this->assertEquals( ' selected=\'selected\'', selected( '1', true, false ) );
    15         $this->assertEquals( ' checked=\'checked\'', checked( '1', true, false ) );
    16 
    17         $this->assertEquals( ' selected=\'selected\'', selected( 1, 1, false ) );
    18         $this->assertEquals( ' checked=\'checked\'', checked( 1, 1, false ) );
    19 
    20         $this->assertEquals( ' selected=\'selected\'', selected( 1, true, false ) );
    21         $this->assertEquals( ' checked=\'checked\'', checked( 1, true, false ) );
    22 
    23         $this->assertEquals( ' selected=\'selected\'', selected( true, true, false ) );
    24         $this->assertEquals( ' checked=\'checked\'', checked( true, true, false ) );
    25 
    26         $this->assertEquals( ' selected=\'selected\'', selected( '0', 0, false ) );
    27         $this->assertEquals( ' checked=\'checked\'', checked( '0', 0, false ) );
    28 
    29         $this->assertEquals( ' selected=\'selected\'', selected( 0, 0, false ) );
    30         $this->assertEquals( ' checked=\'checked\'', checked( 0, 0, false ) );
    31 
    32         $this->assertEquals( ' selected=\'selected\'', selected( '', false, false ) );
    33         $this->assertEquals( ' checked=\'checked\'', checked( '', false, false ) );
    34 
    35         $this->assertEquals( ' selected=\'selected\'', selected( false, false, false ) );
    36         $this->assertEquals( ' checked=\'checked\'', checked( false, false, false ) );
    37     }
    38 
    39     function test_notequal() {
    40         $this->assertEquals( '', selected( '0', '', false ) );
    41         $this->assertEquals( '', checked( '0', '', false ) );
    42 
    43         $this->assertEquals( '', selected( 0, '', false ) );
    44         $this->assertEquals( '', checked( 0, '', false ) );
    45 
    46         $this->assertEquals( '', selected( 0, false, false ) );
    47         $this->assertEquals( '', checked( 0, false, false ) );
    48     }
    496
    507    /**
Note: See TracChangeset for help on using the changeset viewer.