public function testInnoDBConvert() { $result = $this->countMyIsamTables(); $this->assertEquals(1, $result); $this->repair->run(); $result = $this->countMyIsamTables(); $this->assertEquals(0, $result); }
private function renameMimeTypes($currentMimeTypes, $fixedMimeTypes) { $this->addEntries($currentMimeTypes); $this->repair->run(); // force mimetype reload $this->mimetypeLoader->reset(); $this->checkEntries($fixedMimeTypes); }
private function renameMimeTypes($currentMimeTypes, $fixedMimeTypes) { $this->addEntries($currentMimeTypes); $this->repair->run(); // force mimetype reload self::invokePrivate($this->mimetypeLoader, 'loadMimetypes'); $this->checkEntries($fixedMimeTypes); }
private function renameMimeTypes($currentMimeTypes, $fixedMimeTypes) { $this->addEntries($currentMimeTypes); $this->repair->run(); // force mimetype reload DummyFileCache::clearCachedMimeTypes(); $this->storage->getCache()->loadMimeTypes(); $this->checkEntries($fixedMimeTypes); }
/** * Test remove shares where the parent share does not exist anymore */ public function testSharesNonExistingParent() { $qb = $this->connection->getQueryBuilder(); $shareValues = ['share_type' => $qb->expr()->literal(Constants::SHARE_TYPE_USER), 'share_with' => $qb->expr()->literal('recipientuser1'), 'uid_owner' => $qb->expr()->literal('user1'), 'item_type' => $qb->expr()->literal('folder'), 'item_source' => $qb->expr()->literal(123), 'item_target' => $qb->expr()->literal('/123'), 'file_source' => $qb->expr()->literal(123), 'file_target' => $qb->expr()->literal('/test'), 'permissions' => $qb->expr()->literal(1), 'stime' => $qb->expr()->literal(time()), 'expiration' => $qb->expr()->literal('2015-09-25 00:00:00')]; // valid share $qb = $this->connection->getQueryBuilder(); $qb->insert('share')->values($shareValues)->execute(); $parent = $this->getLastShareId(); // share with existing parent $qb = $this->connection->getQueryBuilder(); $qb->insert('share')->values(array_merge($shareValues, ['parent' => $qb->expr()->literal($parent)]))->execute(); $validChild = $this->getLastShareId(); // share with non-existing parent $qb = $this->connection->getQueryBuilder(); $qb->insert('share')->values(array_merge($shareValues, ['parent' => $qb->expr()->literal($parent + 100)]))->execute(); $invalidChild = $this->getLastShareId(); $query = $this->connection->getQueryBuilder(); $result = $query->select('id')->from('share')->orderBy('id', 'ASC')->execute(); $rows = $result->fetchAll(); $this->assertEquals([['id' => $parent], ['id' => $validChild], ['id' => $invalidChild]], $rows); $result->closeCursor(); $this->repair->run(); $query = $this->connection->getQueryBuilder(); $result = $query->select('id')->from('share')->orderBy('id', 'ASC')->execute(); $rows = $result->fetchAll(); $this->assertEquals([['id' => $parent], ['id' => $validChild]], $rows); $result->closeCursor(); }
/** * Test that nothing happens and no error happens when all mimetypes are * already correct and no old ones exist.. */ public function testDoNothingWhenOnlyNewFiles() { $this->addEntries(array(array('test.doc', 'application/msword'), array('test.docx', 'application/vnd.openxmlformats-officedocument.wordprocessingml.document'), array('test.xls', 'application/vnd.ms-excel'), array('test.xlsx', 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet'), array('test.ppt', 'application/vnd.ms-powerpoint'), array('test.pptx', 'application/vnd.openxmlformats-officedocument.presentationml.presentation'))); $this->repair->run(); // force mimetype reload DummyFileCache::clearCachedMimeTypes(); $this->storage->getCache()->loadMimeTypes(); $this->checkEntries(array(array('test.doc', 'application/msword'), array('test.docx', 'application/vnd.openxmlformats-officedocument.wordprocessingml.document'), array('test.xls', 'application/vnd.ms-excel'), array('test.xlsx', 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet'), array('test.ppt', 'application/vnd.ms-powerpoint'), array('test.pptx', 'application/vnd.openxmlformats-officedocument.presentationml.presentation'))); }
/** * Test remove expiration date for non-link shares */ public function testRemoveExpirationDateForNonLinkShares() { // user share with bogus expiration date $qb = $this->connection->getQueryBuilder(); $qb->insert('share')->values(['share_type' => $qb->expr()->literal(Constants::SHARE_TYPE_USER), 'share_with' => $qb->expr()->literal('recipientuser1'), 'uid_owner' => $qb->expr()->literal('user1'), 'item_type' => $qb->expr()->literal('folder'), 'item_source' => $qb->expr()->literal(123), 'item_target' => $qb->expr()->literal('/123'), 'file_source' => $qb->expr()->literal(123), 'file_target' => $qb->expr()->literal('/test'), 'permissions' => $qb->expr()->literal(1), 'stime' => $qb->expr()->literal(time()), 'expiration' => $qb->expr()->literal('2015-09-25 00:00:00')])->execute(); // select because lastInsertId does not work with OCI $results = $this->connection->getQueryBuilder()->select('id')->from('share')->execute()->fetchAll(); $bogusShareId = $results[0]['id']; // link share with expiration date $qb = $this->connection->getQueryBuilder(); $qb->insert('share')->values(['share_type' => $qb->expr()->literal(Constants::SHARE_TYPE_LINK), 'uid_owner' => $qb->expr()->literal('user1'), 'item_type' => $qb->expr()->literal('folder'), 'item_source' => $qb->expr()->literal(123), 'item_target' => $qb->expr()->literal('/123'), 'file_source' => $qb->expr()->literal(123), 'file_target' => $qb->expr()->literal('/test'), 'permissions' => $qb->expr()->literal(1), 'stime' => $qb->expr()->literal(time()), 'expiration' => $qb->expr()->literal('2015-09-25 00:00:00'), 'token' => $qb->expr()->literal('abcdefg')])->execute(); $this->repair->run(); $results = $this->connection->getQueryBuilder()->select('*')->from('share')->orderBy('share_type', 'ASC')->execute()->fetchAll(); $this->assertCount(2, $results); $userShare = $results[0]; $linkShare = $results[1]; $this->assertEquals($bogusShareId, $userShare['id'], 'sanity check'); $this->assertNull($userShare['expiration'], 'bogus expiration date was removed'); $this->assertNotNull($linkShare['expiration'], 'valid link share expiration date still there'); }