示例#1
0
 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 testBuildAddXmlWithDateTime()
 {
     $command = new AddCommand();
     $command->addDocument(new Document(array('id' => 1, 'datetime' => new \DateTime('2013-01-15 14:41:58'))));
     $this->assertEquals('<add><doc><field name="id">1</field><field name="datetime">2013-01-15T14:41:58Z</field></doc></add>', $this->builder->buildAddXml($command, $this->query));
 }