Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
Open sidebar
project
drupal
Commits
cc9f6173
Commit
cc9f6173
authored
Nov 05, 2013
by
Dries
Browse files
Issue
#2120059
by jhedstrom: Cleanup temporary t() functions in phpunit tests.
parent
3d3f63dd
Changes
4
Hide whitespace changes
Inline
Side-by-side
core/lib/Drupal/Core/Entity/EntityListController.php
View file @
cc9f6173
...
...
@@ -121,7 +121,7 @@ public function getOperations(EntityInterface $entity) {
$operations
=
array
();
if
(
$entity
->
access
(
'update'
))
{
$operations
[
'edit'
]
=
array
(
'title'
=>
t
(
'Edit'
),
'title'
=>
$this
->
t
(
'Edit'
),
'href'
=>
$uri
[
'path'
]
.
'/edit'
,
'options'
=>
$uri
[
'options'
],
'weight'
=>
10
,
...
...
@@ -129,7 +129,7 @@ public function getOperations(EntityInterface $entity) {
}
if
(
$entity
->
access
(
'delete'
))
{
$operations
[
'delete'
]
=
array
(
'title'
=>
t
(
'Delete'
),
'title'
=>
$this
->
t
(
'Delete'
),
'href'
=>
$uri
[
'path'
]
.
'/delete'
,
'options'
=>
$uri
[
'options'
],
'weight'
=>
100
,
...
...
@@ -148,7 +148,7 @@ public function getOperations(EntityInterface $entity) {
* @see \Drupal\Core\Entity\EntityListController::render()
*/
public
function
buildHeader
()
{
$row
[
'operations'
]
=
t
(
'Operations'
);
$row
[
'operations'
]
=
$this
->
t
(
'Operations'
);
return
$row
;
}
...
...
@@ -203,7 +203,7 @@ public function render() {
'#theme'
=>
'table'
,
'#header'
=>
$this
->
buildHeader
(),
'#rows'
=>
array
(),
'#empty'
=>
t
(
'There is no @label yet.'
,
array
(
'@label'
=>
$this
->
entityInfo
[
'label'
])),
'#empty'
=>
$this
->
t
(
'There is no @label yet.'
,
array
(
'@label'
=>
$this
->
entityInfo
[
'label'
])),
);
foreach
(
$this
->
load
()
as
$entity
)
{
if
(
$row
=
$this
->
buildRow
(
$entity
))
{
...
...
core/modules/views/tests/Drupal/views/Tests/Plugin/Block/ViewsBlockTest.php
View file @
cc9f6173
...
...
@@ -150,13 +150,7 @@ public function testBuildFailed() {
}
// @todo Remove this once https://drupal.org/node/2018411 is in.
namespace
{
if
(
!
function_exists
(
't'
))
{
function
t
(
$string
)
{
return
$string
;
}
}
// @todo replace views_add_contextual_links()
if
(
!
function_exists
(
'views_add_contextual_links'
))
{
function
views_add_contextual_links
()
{
...
...
core/modules/views_ui/lib/Drupal/views_ui/ViewListController.php
View file @
cc9f6173
...
...
@@ -104,7 +104,7 @@ public function buildRow(EntityInterface $view) {
'path'
=>
implode
(
', '
,
$this
->
getDisplayPaths
(
$view
)),
'operations'
=>
$row
[
'operations'
],
),
'title'
=>
t
(
'Machine name: @name'
,
array
(
'@name'
=>
$view
->
id
())),
'title'
=>
$this
->
t
(
'Machine name: @name'
,
array
(
'@name'
=>
$view
->
id
())),
'class'
=>
array
(
$view
->
status
()
?
'views-ui-list-enabled'
:
'views-ui-list-disabled'
),
);
}
...
...
@@ -115,23 +115,23 @@ public function buildRow(EntityInterface $view) {
public
function
buildHeader
()
{
return
array
(
'view_name'
=>
array
(
'data'
=>
t
(
'View name'
),
'data'
=>
$this
->
t
(
'View name'
),
'class'
=>
array
(
'views-ui-name'
),
),
'description'
=>
array
(
'data'
=>
t
(
'Description'
),
'data'
=>
$this
->
t
(
'Description'
),
'class'
=>
array
(
'views-ui-description'
),
),
'tag'
=>
array
(
'data'
=>
t
(
'Tag'
),
'data'
=>
$this
->
t
(
'Tag'
),
'class'
=>
array
(
'views-ui-tag'
),
),
'path'
=>
array
(
'data'
=>
t
(
'Path'
),
'data'
=>
$this
->
t
(
'Path'
),
'class'
=>
array
(
'views-ui-path'
),
),
'operations'
=>
array
(
'data'
=>
t
(
'Operations'
),
'data'
=>
$this
->
t
(
'Operations'
),
'class'
=>
array
(
'views-ui-operations'
),
),
);
...
...
@@ -145,7 +145,7 @@ public function getOperations(EntityInterface $entity) {
$uri
=
$entity
->
uri
();
$operations
[
'clone'
]
=
array
(
'title'
=>
t
(
'Clone'
),
'title'
=>
$this
->
t
(
'Clone'
),
'href'
=>
$uri
[
'path'
]
.
'/clone'
,
'options'
=>
$uri
[
'options'
],
'weight'
=>
15
,
...
...
@@ -210,8 +210,8 @@ public function render() {
),
);
$list
[
'enabled'
][
'heading'
][
'#markup'
]
=
'<h2>'
.
t
(
'Enabled'
)
.
'</h2>'
;
$list
[
'disabled'
][
'heading'
][
'#markup'
]
=
'<h2>'
.
t
(
'Disabled'
)
.
'</h2>'
;
$list
[
'enabled'
][
'heading'
][
'#markup'
]
=
'<h2>'
.
$this
->
t
(
'Enabled'
)
.
'</h2>'
;
$list
[
'disabled'
][
'heading'
][
'#markup'
]
=
'<h2>'
.
$this
->
t
(
'Disabled'
)
.
'</h2>'
;
foreach
(
array
(
'enabled'
,
'disabled'
)
as
$status
)
{
$list
[
$status
][
'#type'
]
=
'container'
;
$list
[
$status
][
'#attributes'
]
=
array
(
'class'
=>
array
(
'views-list-section'
,
$status
));
...
...
@@ -229,8 +229,8 @@ public function render() {
}
// @todo Use a placeholder for the entity label if this is abstracted to
// other entity types.
$list
[
'enabled'
][
'table'
][
'#empty'
]
=
t
(
'There are no enabled views.'
);
$list
[
'disabled'
][
'table'
][
'#empty'
]
=
t
(
'There are no disabled views.'
);
$list
[
'enabled'
][
'table'
][
'#empty'
]
=
$this
->
t
(
'There are no enabled views.'
);
$list
[
'disabled'
][
'table'
][
'#empty'
]
=
$this
->
t
(
'There are no disabled views.'
);
return
$list
;
}
...
...
core/modules/views_ui/tests/Drupal/views_ui/Tests/ViewListControllerTest.php
View file @
cc9f6173
...
...
@@ -5,8 +5,7 @@
* Contains \Drupal\views_ui\Tests\ViewListControllerTest
*/
namespace
Drupal\views_ui\Tests
{
namespace
Drupal\views_ui\Tests
;
use
Drupal\Core\DependencyInjection\ContainerBuilder
;
use
Drupal\Tests\UnitTestCase
;
...
...
@@ -118,6 +117,7 @@ public function testBuildRowEntityList() {
$executable_factory
=
new
ViewExecutableFactory
();
$container
->
set
(
'views.executable'
,
$executable_factory
);
$container
->
set
(
'plugin.manager.views.display'
,
$display_manager
);
$container
->
set
(
'string_translation'
,
$this
->
getStringTranslationStub
());
\
Drupal
::
setContainer
(
$container
);
$module_handler
=
$this
->
getMockBuilder
(
'Drupal\Core\Extension\ModuleHandler'
)
...
...
@@ -140,14 +140,3 @@ public function testBuildRowEntityList() {
}
}
}
// @todo Remove this once t() is converted to a service.
namespace
{
if
(
!
function_exists
(
't'
))
{
function
t
(
$string
)
{
return
$string
;
}
}
}
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a 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