Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
Open sidebar
project
drupal
Commits
e6ac9ec5
Commit
e6ac9ec5
authored
Apr 18, 2014
by
Angie Byron
Browse files
Issue
#2244757
by tim.plunkett: Path Admin UI is broken and has no test coverage.
parent
52da1905
Changes
4
Hide whitespace changes
Inline
Side-by-side
core/modules/path/lib/Drupal/path/Controller/PathController.php
View file @
e6ac9ec5
...
...
@@ -15,7 +15,15 @@ class PathController {
/**
* @todo Remove path_admin_overview().
*/
public
function
adminOverview
(
$keys
=
NULL
)
{
public
function
adminOverview
()
{
module_load_include
(
'admin.inc'
,
'path'
);
return
path_admin_overview
();
}
/**
* @todo Remove path_admin_overview().
*/
public
function
adminOverviewFiltered
(
$keys
)
{
module_load_include
(
'admin.inc'
,
'path'
);
return
path_admin_overview
(
$keys
);
}
...
...
core/modules/path/lib/Drupal/path/Tests/PathAdminTest.php
0 → 100644
View file @
e6ac9ec5
<?php
/**
* @file
* Contains \Drupal\path\Tests\PathAdminTest.
*/
namespace
Drupal\path\Tests
;
/**
* Tests the Path admin UI.
*/
class
PathAdminTest
extends
PathTestBase
{
/**
* Modules to enable.
*
* @var array
*/
public
static
$modules
=
array
(
'path'
);
public
static
function
getInfo
()
{
return
array
(
'name'
=>
'Path admin UI'
,
'description'
=>
'Tests the Path admin UI.'
,
'group'
=>
'Path'
,
);
}
function
setUp
()
{
parent
::
setUp
();
// Create test user and login.
$web_user
=
$this
->
drupalCreateUser
(
array
(
'create page content'
,
'edit own page content'
,
'administer url aliases'
,
'create url aliases'
));
$this
->
drupalLogin
(
$web_user
);
}
/**
* Tests the filtering aspect of the Path UI.
*/
public
function
testPathFiltering
()
{
// Create test nodes.
$node1
=
$this
->
drupalCreateNode
();
$node2
=
$this
->
drupalCreateNode
();
// Create aliases.
$alias1
=
$this
->
randomName
(
8
);
$edit
=
array
(
'source'
=>
'node/'
.
$node1
->
id
(),
'alias'
=>
$alias1
,
);
$this
->
drupalPostForm
(
'admin/config/search/path/add'
,
$edit
,
t
(
'Save'
));
$alias2
=
$this
->
randomName
(
8
);
$edit
=
array
(
'source'
=>
'node/'
.
$node2
->
id
(),
'alias'
=>
$alias2
,
);
$this
->
drupalPostForm
(
'admin/config/search/path/add'
,
$edit
,
t
(
'Save'
));
// Filter by the first alias.
$edit
=
array
(
'filter'
=>
$alias1
,
);
$this
->
drupalPostForm
(
NULL
,
$edit
,
t
(
'Filter'
));
$this
->
assertLinkByHref
(
$alias1
);
$this
->
assertNoLinkByHref
(
$alias2
);
// Filter by the second alias.
$edit
=
array
(
'filter'
=>
$alias2
,
);
$this
->
drupalPostForm
(
NULL
,
$edit
,
t
(
'Filter'
));
$this
->
assertNoLinkByHref
(
$alias1
);
$this
->
assertLinkByHref
(
$alias2
);
// Filter by a random string with a different length.
$edit
=
array
(
'filter'
=>
$this
->
randomName
(
10
),
);
$this
->
drupalPostForm
(
NULL
,
$edit
,
t
(
'Filter'
));
$this
->
assertNoLinkByHref
(
$alias1
);
$this
->
assertNoLinkByHref
(
$alias2
);
// Reset the filter.
$edit
=
array
();
$this
->
drupalPostForm
(
NULL
,
$edit
,
t
(
'Reset'
));
$this
->
assertLinkByHref
(
$alias1
);
$this
->
assertLinkByHref
(
$alias2
);
}
}
core/modules/path/path.admin.inc
View file @
e6ac9ec5
...
...
@@ -307,5 +307,5 @@ function path_admin_filter_form_submit_filter($form, &$form_state) {
* @see path_admin_filter_form_submit_filter()
*/
function
path_admin_filter_form_submit_reset
(
$form
,
&
$form_state
)
{
$form_state
[
'redirect'
]
=
'admin/config/search/path
/list
'
;
$form_state
[
'redirect'
]
=
'admin/config/search/path'
;
}
core/modules/path/path.routing.yml
View file @
e6ac9ec5
...
...
@@ -7,11 +7,18 @@ path.delete:
_permission
:
'
administer
url
aliases'
path.admin_overview
:
path
:
'
/admin/config/search/path
/{keys}
'
path
:
'
/admin/config/search/path'
defaults
:
_title
:
'
URL
aliases'
_content
:
'
\Drupal\path\Controller\PathController::adminOverview'
keys
:
NULL
requirements
:
_permission
:
'
administer
url
aliases'
path.admin_overview_filter
:
path
:
'
/admin/config/search/path/list/{keys}'
defaults
:
_title
:
'
URL
aliases'
_content
:
'
\Drupal\path\Controller\PathController::adminOverviewFiltered'
requirements
:
_permission
:
'
administer
url
aliases'
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment