Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Submit feedback
Sign in
Toggle navigation
S
solarium
Project overview
Project overview
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Commits
Open sidebar
common
solarium
Commits
77ee7bcc
Commit
77ee7bcc
authored
Jun 28, 2011
by
Bas de Nooijer
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #31 from shieldo/enforce_null
corrected setField method of read/write documents
parents
bc46d920
954040b4
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
15 additions
and
1 deletion
+15
-1
library/Solarium/Document/ReadWrite.php
library/Solarium/Document/ReadWrite.php
+1
-1
tests/Solarium/Document/ReadWriteTest.php
tests/Solarium/Document/ReadWriteTest.php
+14
-0
No files found.
library/Solarium/Document/ReadWrite.php
View file @
77ee7bcc
...
...
@@ -124,7 +124,7 @@ class Solarium_Document_ReadWrite extends Solarium_Document_ReadOnly
*/
public
function
setField
(
$key
,
$value
,
$boost
=
null
)
{
if
(
$value
==
null
)
{
if
(
$value
==
=
null
)
{
$this
->
removeField
(
$key
);
}
else
{
$this
->
_fields
[
$key
]
=
$value
;
...
...
tests/Solarium/Document/ReadWriteTest.php
View file @
77ee7bcc
...
...
@@ -128,6 +128,20 @@ class Solarium_Document_ReadWriteTest extends PHPUnit_Framework_TestCase
);
}
public
function
testSetFieldWithFalsyValue
()
{
$falsy_value
=
''
;
$this
->
_doc
->
setField
(
'name'
,
$falsy_value
);
$expectedFields
=
$this
->
_fields
;
$expectedFields
[
'name'
]
=
$falsy_value
;
$this
->
assertEquals
(
$expectedFields
,
$this
->
_doc
->
getFields
()
);
}
public
function
testRemoveField
()
{
$this
->
_doc
->
removeField
(
'name'
);
...
...
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