Commit 8db8dacc authored by Bas de Nooijer's avatar Bas de Nooijer

testcases for #188

parent 747a3ea7
...@@ -203,6 +203,21 @@ class DocumentTest extends \PHPUnit_Framework_TestCase ...@@ -203,6 +203,21 @@ class DocumentTest extends \PHPUnit_Framework_TestCase
); );
} }
public function testRemoveFieldBySettingNullValueWithModifier()
{
$this->doc->setKey('key', 123);
$this->doc->setField('name', null, null, Document::MODIFIER_SET);
$expectedFields = $this->fields;
$expectedFields['key'] = 123;
$expectedFields['name'] = null;
$this->assertEquals(
$expectedFields,
$this->doc->getFields()
);
}
public function testRemoveFieldBySettingToNull() public function testRemoveFieldBySettingToNull()
{ {
$this->doc->setField('name', NULL); $this->doc->setField('name', NULL);
......
...@@ -219,6 +219,21 @@ class RequestBuilderTest extends \PHPUnit_Framework_TestCase ...@@ -219,6 +219,21 @@ class RequestBuilderTest extends \PHPUnit_Framework_TestCase
); );
} }
public function testBuildAddXmlWithFieldModifierAndNullValue()
{
$doc = new Document();
$doc->setKey('employeeId','05991');
$doc->addField('skills', null, null, Document::MODIFIER_SET);
$command = new AddCommand();
$command->addDocument($doc);
$this->assertEquals(
'<add><doc><field name="employeeId">05991</field><field name="skills" update="set" null="true"></field></doc></add>',
$this->builder->buildAddXml($command)
);
}
public function testBuildDeleteXml() public function testBuildDeleteXml()
{ {
$command = new DeleteCommand; $command = new DeleteCommand;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment