mirrored from git://develop.git.wordpress.org/
-
Notifications
You must be signed in to change notification settings - Fork 2.7k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
62546 do not add duplicate css classes
- Loading branch information
Showing
2 changed files
with
49 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
<?php | ||
|
||
/** | ||
* @group menu | ||
*/ | ||
class Tests_Menu_Functions extends WP_UnitTestCase { | ||
/** | ||
* @dataProvider data_add_cssclass | ||
* | ||
* @covers add_cssclass | ||
*/ | ||
public function test_add_cssclass( $input, $expected ) { | ||
$this->assertSame( $expected, add_cssclass( 'menu-top-first', $input ) ); | ||
} | ||
|
||
public function data_add_cssclass() { | ||
return array( | ||
'class should not be added one' => array( | ||
Check warning on line 18 in tests/phpunit/tests/menu/menu-functions.php GitHub Actions / PHP coding standards / Run coding standards checks
|
||
'input' => 'menu-top menu-top-first menu-icon-dashboard', | ||
'expected' => 'menu-top menu-top-first menu-icon-dashboard', | ||
), | ||
'class should not be added two' => array( | ||
Check warning on line 22 in tests/phpunit/tests/menu/menu-functions.php GitHub Actions / PHP coding standards / Run coding standards checks
|
||
'input' => 'menu-top menu-top-first', | ||
'expected' => 'menu-top menu-top-first', | ||
), | ||
'class should not be added three' => array( | ||
'input' => 'menu-top-first', | ||
'expected' => 'menu-top-first', | ||
), | ||
'class should not be added four' => array( | ||
Check warning on line 30 in tests/phpunit/tests/menu/menu-functions.php GitHub Actions / PHP coding standards / Run coding standards checks
|
||
'input' => 'menu-top-first menu-icon-dashboard', | ||
'expected' => 'menu-top-first menu-icon-dashboard', | ||
), | ||
'class should be added one' => array( | ||
Check warning on line 34 in tests/phpunit/tests/menu/menu-functions.php GitHub Actions / PHP coding standards / Run coding standards checks
|
||
'input' => 'menu-top menu-top-first-foo menu-icon-dashboard', | ||
'expected' => 'menu-top menu-top-first-foo menu-icon-dashboard menu-top-first', | ||
), | ||
'class should be added two' => array( | ||
Check warning on line 38 in tests/phpunit/tests/menu/menu-functions.php GitHub Actions / PHP coding standards / Run coding standards checks
|
||
'input' => 'menu-top foo-menu-top-first menu-icon-dashboard', | ||
'expected' => 'menu-top foo-menu-top-first menu-icon-dashboard menu-top-first', | ||
), | ||
); | ||
} | ||
} |