public function testIndex() { $id = 11111; $data = ['id' => $id, 'name' => 'The Guardians of the Galaxy', 'year' => 2015]; // Make sure the document doesn't exist. if ($this->documentsManager->exists('movies', 'movies', $id)) { $this->documentsManager->delete('movies', 'movies', $id); } $this->documentsManager->index('movies', 'movies', $data); $this->assertTrue($this->documentsManager->exists('movies', 'movies', $id)); $this->assertEquals($data, $this->documentsManager->get('movies', 'movies', $id)['_source']); }
public function testWithPrefixedIndex() { $id = 12345; $data = ['id' => $id, 'name' => 'Harry Potter and the wizards']; // Make sure the document doesn't exist. if ($this->documentsManager->exists('books', 'books', $id)) { $this->documentsManager->delete('books', 'books', $id); } $this->documentsManager->index('books', 'books', $data); $this->assertTrue($this->documentsManager->exists('books', 'books', $id)); $this->assertEquals($data, $this->documentsManager->get('books', 'books', $id)['_source']); }