Changeset 48907
- Timestamp:
- 08/30/2020 01:34:38 AM (4 years ago)
- Location:
- trunk/tests/phpunit/tests
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/tests/phpunit/tests/admin/includesTemplate.php
r48880 r48907 4 4 */ 5 5 class 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 }49 6 50 7 /** -
trunk/tests/phpunit/tests/general/template.php
r48878 r48907 691 691 get_template_part( 'template', 'part', array( 'foo' => 'baz' ) ); 692 692 } 693 694 /** 695 * @ticket 9862 696 * @dataProvider data_selected_and_checked_with_equal_values 697 */ 698 function test_selected_and_checked_with_equal_values( $selected, $current ) { 699 $this->assertEquals( " selected='selected'", selected( $selected, $current, false ) ); 700 $this->assertEquals( " checked='checked'", checked( $selected, $current, false ) ); 701 } 702 703 function data_selected_and_checked_with_equal_values() { 704 return array( 705 array( 'foo', 'foo' ), 706 array( '1', 1 ), 707 array( '1', true ), 708 array( 1, 1 ), 709 array( 1, true ), 710 array( true, true ), 711 array( '0', 0 ), 712 array( 0, 0 ), 713 array( '', false ), 714 array( false, false ), 715 ); 716 } 717 718 /** 719 * @ticket 9862 720 * @dataProvider data_selected_and_checked_with_non_equal_values 721 */ 722 function test_selected_and_checked_with_non_equal_values( $selected, $current ) { 723 $this->assertEquals( '', selected( $selected, $current, false ) ); 724 $this->assertEquals( '', checked( $selected, $current, false ) ); 725 } 726 727 function data_selected_and_checked_with_non_equal_values() { 728 return array( 729 array( '0', '' ), 730 array( 0, '' ), 731 array( 0, false ), 732 ); 733 } 693 734 }
Note: See TracChangeset
for help on using the changeset viewer.