addObject() public méthode

public addObject ( $object, Document $doc = null ) : Response
$object
$doc Document
Résultat Response
Exemple #1
0
 /**
  * @group functional
  */
 public function testAddObject()
 {
     $index = $this->_createIndex();
     $type = new Type($index, 'user');
     $type->setSerializer('get_object_vars');
     $userObject = new \stdClass();
     $userObject->username = '******';
     $userObject->test = array('2', '3', '5');
     $type->addObject($userObject);
     $index->refresh();
     $resultSet = $type->search('hans');
     $this->assertEquals(1, $resultSet->count());
     // Test if source is returned
     $result = $resultSet->current();
     $data = $result->getData();
     $this->assertEquals('hans', $data['username']);
 }