mirror of
https://github.com/gosticks/wordpress-develop.git
synced 2025-10-16 12:05:38 +00:00
WPCS 1.0.0 includes a bunch of new auto-fixers, which drops the number of coding standards issues across WordPress significantly. Prior to running the auto-fixers, there were 15,312 issues detected. With this commit, we now drop to 4,769 issues. This change includes three notable additions: - Multiline function calls must now put each parameter on a new line. - Auto-formatting files is now part of the `grunt precommit` script. - Auto-fixable coding standards issues will now cause Travis failures. Fixes #44600. git-svn-id: https://develop.svn.wordpress.org/trunk@43571 602fd350-edb4-49c9-b593-d223f7449a82
44 lines
1018 B
PHP
44 lines
1018 B
PHP
<?php
|
|
|
|
/**
|
|
* @group rewrite
|
|
*/
|
|
class Tests_Rewrite_Permastructs extends WP_UnitTestCase {
|
|
|
|
public function setUp() {
|
|
parent::setUp();
|
|
|
|
$this->set_permalink_structure( '/%postname%/' );
|
|
}
|
|
|
|
public function test_add_permastruct() {
|
|
global $wp_rewrite;
|
|
|
|
add_permastruct( 'foo', 'bar/%foo%' );
|
|
$this->assertEqualSetsWithIndex(
|
|
array(
|
|
'with_front' => true,
|
|
'ep_mask' => EP_NONE,
|
|
'paged' => true,
|
|
'feed' => true,
|
|
'walk_dirs' => true,
|
|
'endpoints' => true,
|
|
'forcomments' => false,
|
|
'struct' => '/bar/%foo%',
|
|
),
|
|
$wp_rewrite->extra_permastructs['foo']
|
|
);
|
|
}
|
|
|
|
public function test_remove_permastruct() {
|
|
global $wp_rewrite;
|
|
|
|
add_permastruct( 'foo', 'bar/%foo%' );
|
|
$this->assertInternalType( 'array', $wp_rewrite->extra_permastructs['foo'] );
|
|
$this->assertSame( '/bar/%foo%', $wp_rewrite->extra_permastructs['foo']['struct'] );
|
|
|
|
remove_permastruct( 'foo' );
|
|
$this->assertFalse( isset( $wp_rewrite->extra_permastructs['foo'] ) );
|
|
}
|
|
}
|