예제 #1
0
 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();
 }
예제 #2
0
 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')));
 }