public function setUp() { parent::setUp(); $this->userSession->setUser(null); \OC_Util::tearDownFS(); $job = new IndexJob(); $job->run(array('user' => 'test')); $this->userSession->setUser(null); \OC_Util::tearDownFS(); }
function testIndexJob() { // preparation $app = new Application(); $container = $app->getContainer(); $this->userSession->setUser(null); \OC_Util::tearDownFS(); $job = new IndexJob(); $job->run(array('user' => 'test')); // get an index /** @var Index $index */ $index = $container->query('Index'); // search for it /** @var QueryHit[] $hits */ $hits = $index->find('foo'); // get the document from the query hit $foundDoc = $hits[0]->getDocument(); $this->assertSame('document.txt', basename($foundDoc->getFieldValue('path'))); }