Esempio n. 1
0
 public function testSetAndGetVersion()
 {
     $this->assertEquals(null, $this->doc->getVersion());
     $this->doc->setVersion(Document::VERSION_MUST_NOT_EXIST);
     $this->assertEquals(Document::VERSION_MUST_NOT_EXIST, $this->doc->getVersion());
     $this->doc->setVersion(234);
     $this->assertEquals(234, $this->doc->getVersion());
 }
Esempio n. 2
0
 public function testBuildAddXmlWithVersionedDocument()
 {
     $doc = new Document(array('id' => 1));
     $doc->setVersion(Document::VERSION_MUST_NOT_EXIST);
     $command = new AddCommand();
     $command->addDocument($doc);
     $this->assertEquals('<add><doc><field name="id">1</field><field name="_version_">-1</field></doc></add>', $this->builder->buildAddXml($command));
 }