/**
  * @test
  */
 public function removingObjectTriggersIndexRemoval()
 {
     $testEntity = $this->createAndPersistTestEntity();
     $identifier = $this->persistenceManager->getIdentifierByObject($testEntity);
     $initialDocument = $this->testClient->findIndex('flow3_elasticsearch_functionaltests_twitter')->findType('tweet')->findDocumentById($identifier);
     $this->assertInstanceOf('Flowpack\\ElasticSearch\\Domain\\Model\\Document', $initialDocument);
     $persistedTestEntity = $this->testEntityRepository->findByIdentifier($identifier);
     $this->testEntityRepository->remove($persistedTestEntity);
     $this->persistenceManager->persistAll();
     $this->persistenceManager->clearState();
     $foundDocument = $this->testClient->findIndex('flow3_elasticsearch_functionaltests_twitter')->findType('tweet')->findDocumentById($identifier);
     $this->assertNull($foundDocument);
 }