Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
D
drupal
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Locked Files
Custom Issue Tracker
Custom Issue Tracker
Labels
Merge Requests
221
Merge Requests
221
Requirements
Requirements
List
Security & Compliance
Security & Compliance
Dependency List
License Compliance
Analytics
Analytics
Code Review
Insights
Issue
Repository
Value Stream
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Commits
Open sidebar
project
drupal
Commits
2524d8d5
Commit
2524d8d5
authored
Feb 10, 2015
by
alexpott
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Issue
#2421133
by penyaskito: Undefined variables in core/modules/locale/src/StringBase.php
parent
29c7efa1
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
45 additions
and
4 deletions
+45
-4
core/modules/locale/src/StringBase.php
core/modules/locale/src/StringBase.php
+6
-4
core/modules/locale/tests/src/Unit/StringBaseTest.php
core/modules/locale/tests/src/Unit/StringBaseTest.php
+39
-0
No files found.
core/modules/locale/src/StringBase.php
View file @
2524d8d5
...
...
@@ -7,6 +7,8 @@
namespace
Drupal\locale
;
use
Drupal\Component\Utility\String
;
/**
* Defines the locale string base class.
*
...
...
@@ -188,8 +190,8 @@ public function save() {
$storage
->
save
(
$this
);
}
else
{
throw
new
StringStorageException
(
format_string
(
'The string cannot be saved because its not bound to a storage: @string'
,
array
(
'@string'
=>
$
string
->
getString
(),
throw
new
StringStorageException
(
String
::
format
(
'The string cannot be saved because its not bound to a storage: @string'
,
array
(
'@string'
=>
$
this
->
getString
(),
)));
}
return
$this
;
...
...
@@ -204,8 +206,8 @@ public function delete() {
$storage
->
delete
(
$this
);
}
else
{
throw
new
StringStorageException
(
format_string
(
'The string cannot be deleted because its not bound to a storage: @string'
,
array
(
'@string'
=>
$
string
->
getString
(),
throw
new
StringStorageException
(
String
::
format
(
'The string cannot be deleted because its not bound to a storage: @string'
,
array
(
'@string'
=>
$
this
->
getString
(),
)));
}
}
...
...
core/modules/locale/tests/src/Unit/StringBaseTest.php
0 → 100644
View file @
2524d8d5
<?php
/**
* @file
* Contains \Drupal\Tests\locale\Unit\StringBaseTest.
*/
namespace
Drupal\Tests\locale\Unit
;
use
Drupal\locale\SourceString
;
use
Drupal\Tests\UnitTestCase
;
/**
* @coversDefaultClass \Drupal\locale\StringBase
* @group locale
*/
class
StringBaseTest
extends
UnitTestCase
{
/**
* @covers ::save
* @expectedException \Drupal\locale\StringStorageException
* @expectedExceptionMessage The string cannot be saved because its not bound to a storage: test
*/
public
function
testSaveWithoutStorage
()
{
$string
=
new
SourceString
([
'source'
=>
'test'
]);
$string
->
save
();
}
/**
* @covers ::delete
* @expectedException \Drupal\locale\StringStorageException
* @expectedExceptionMessage The string cannot be deleted because its not bound to a storage: test
*/
public
function
testDeleteWithoutStorage
()
{
$string
=
new
SourceString
([
'lid'
=>
1
,
'source'
=>
'test'
]);
$string
->
delete
();
}
}
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