Signed-off-by: Julius Härtl <jus@bitgrid.net>
This commit is contained in:
Julius Härtl 2022-05-20 14:43:43 +02:00
Родитель a546de06b4
Коммит 9bb9661795
Не найден ключ, соответствующий данной подписи
Идентификатор ключа GPG: 4C614C6ED2CDE6DF
48 изменённых файлов: 221 добавлений и 295 удалений

Просмотреть файл

@ -15,7 +15,6 @@ use OCA\Richdocuments\AppInfo\Application;
use \OCP\IConfig;
class AppConfig {
public const FEDERATION_USE_TRUSTED_DOMAINS = 'federation_use_trusted_domains';
public const SYSTEM_GS_TRUSTED_HOSTS = 'gs.trustedHosts';
@ -30,9 +29,9 @@ class AppConfig {
'token_ttl' => 36000, // 10 hours
];
const WATERMARK_APP_NAMESPACE = 'files';
public const WATERMARK_APP_NAMESPACE = 'files';
const APP_SETTING_TYPES = [
public const APP_SETTING_TYPES = [
'watermark_allGroupsList' => 'array',
'watermark_allTagsList' => 'array',
'watermark_linkTagsList' => 'array'
@ -124,5 +123,4 @@ class AppConfig {
public function isTrustedDomainAllowedForFederation(): bool {
return $this->config->getAppValue(Application::APPNAME, self::FEDERATION_USE_TRUSTED_DOMAINS, 'no') === 'yes';
}
}

Просмотреть файл

@ -25,9 +25,7 @@
namespace OCA\Richdocuments\AppInfo;
use OC\EventDispatcher\SymfonyAdapter;
use OC\Files\Type\Detection;
use OC\Security\CSP\ContentSecurityPolicy;
use OCA\Files_Sharing\Listener\LoadAdditionalListener;
use OCA\Richdocuments\AppConfig;
use OCA\Richdocuments\Capabilities;
use OCA\Richdocuments\Middleware\WOPIMiddleware;
@ -57,7 +55,6 @@ use OCP\IL10N;
use OCP\IPreview;
class Application extends App implements IBootstrap {
public const APPNAME = 'richdocuments';
public function __construct(array $urlParams = array()) {
@ -261,8 +258,9 @@ class Application extends App implements IBootstrap {
// Supported only on Linux OS, and x86_64 & ARM64 platforms
$supportedArchs = array('x86_64', 'aarch64');
$osFamily = PHP_VERSION_ID >= 70200 ? PHP_OS_FAMILY : PHP_OS;
if ($osFamily !== 'Linux' || !in_array(php_uname('m'), $supportedArchs))
if ($osFamily !== 'Linux' || !in_array(php_uname('m'), $supportedArchs)) {
return;
}
$CODEAppID = (php_uname('m') === 'x86_64') ? 'richdocumentscode' : 'richdocumentscode_arm64';

Просмотреть файл

@ -51,11 +51,9 @@ class Cleanup extends TimedJob {
// Expired WOPI access tokens
$this->cleanUpWopiTokens();
}
private function cleanUpWopiTokens()
{
private function cleanUpWopiTokens() {
$tokenIds = $this->wopiMapper->getExpiredTokenIds(1000);
$query = $this->db->getQueryBuilder();
$query->delete('richdocuments_wopi')

Просмотреть файл

@ -28,8 +28,7 @@ use OCP\Capabilities\ICapability;
use OCP\IL10N;
class Capabilities implements ICapability {
const MIMETYPES = [
public const MIMETYPES = [
'application/vnd.oasis.opendocument.text',
'application/vnd.oasis.opendocument.spreadsheet',
'application/vnd.oasis.opendocument.graphics',
@ -68,7 +67,7 @@ class Capabilities implements ICapability {
'text/csv'
];
const MIMETYPES_OPTIONAL = [
public const MIMETYPES_OPTIONAL = [
'image/svg+xml',
'application/pdf',
'text/plain',

Просмотреть файл

@ -26,11 +26,9 @@ namespace OCA\RichDocuments\Command;
use OCA\Richdocuments\AppConfig;
use OCA\Richdocuments\Service\CapabilitiesService;
use OCA\Richdocuments\TemplateManager;
use OCA\Richdocuments\WOPI\DiscoveryManager;
use OCA\Richdocuments\WOPI\Parser;
use Symfony\Component\Console\Command\Command;
use Symfony\Component\Console\Input\InputArgument;
use Symfony\Component\Console\Input\InputInterface;
use Symfony\Component\Console\Output\OutputInterface;
@ -85,5 +83,4 @@ class ActivateConfig extends Command {
return 1;
}
}
}

Просмотреть файл

@ -26,7 +26,6 @@ namespace OCA\RichDocuments\Command;
use OCA\Richdocuments\TemplateManager;
use Symfony\Component\Console\Command\Command;
use Symfony\Component\Console\Input\InputArgument;
use Symfony\Component\Console\Input\InputInterface;
use Symfony\Component\Console\Output\OutputInterface;
@ -58,5 +57,4 @@ class UpdateEmptyTemplates extends Command {
return 1;
}
}
}

Просмотреть файл

@ -140,7 +140,6 @@ class DirectViewController extends Controller {
}
$relativePath = '/new.odt';
} else {
try {
$item = $folder->getById($direct->getFileid())[0];
@ -190,7 +189,6 @@ class DirectViewController extends Controller {
$this->logger->logException($e);
return $this->renderErrorPage('Failed to open the requested file.');
}
}
public function showPublicShare(Direct $direct) {
@ -250,7 +248,6 @@ class DirectViewController extends Controller {
}
return new TemplateResponse('core', '403', [], 'guest');
}
private function renderErrorPage($message) {

Просмотреть файл

@ -40,7 +40,6 @@ use Psr\Log\LoggerInterface;
use Throwable;
class DocumentAPIController extends \OCP\AppFramework\OCSController {
private $rootFolder;
private $shareManager;
private $templateManager;

Просмотреть файл

@ -27,7 +27,6 @@ use OCP\Files\NotFoundException;
use OCP\Files\NotPermittedException;
use \OCP\IRequest;
use \OCP\IConfig;
use \OCP\IL10N;
use \OCP\ILogger;
use \OCP\AppFramework\Http\ContentSecurityPolicy;
use \OCP\AppFramework\Http\FeaturePolicy;
@ -221,8 +220,7 @@ class DocumentController extends Controller {
];
$encryptionManager = \OC::$server->getEncryptionManager();
if ($encryptionManager->isEnabled())
{
if ($encryptionManager->isEnabled()) {
// Update the current file to be accessible with system public shared key
$owner = $item->getOwner()->getUID();
$absPath = '/' . $owner . '/' . $item->getInternalPath();

Просмотреть файл

@ -25,7 +25,6 @@ namespace OCA\Richdocuments\Controller;
use OCA\Richdocuments\Exceptions\ExpiredTokenException;
use OCA\Richdocuments\Exceptions\UnknownTokenException;
use OCP\AppFramework\Db\DoesNotExistException;
use OCP\AppFramework\Db\TokenExpiredException;
use OCP\AppFramework\OCS\OCSNotFoundException;
use OCP\AppFramework\OCSController;
use OCA\Richdocuments\Db\WopiMapper;
@ -159,5 +158,4 @@ class FederationController extends OCSController {
throw new OCSNotFoundException();
}
}
}

Просмотреть файл

@ -31,7 +31,6 @@ use OCA\Richdocuments\Exceptions\UnknownTokenException;
use OCA\Richdocuments\Service\FederationService;
use OCA\Richdocuments\TemplateManager;
use OCA\Richdocuments\TokenManager;
use OCP\AppFramework\Db\DoesNotExistException;
use OCP\AppFramework\Http;
use OCP\AppFramework\Http\DataResponse;
use OCP\AppFramework\OCS\OCSBadRequestException;

Просмотреть файл

@ -11,7 +11,6 @@
namespace OCA\Richdocuments\Controller;
use Exception;
use OCA\Richdocuments\Service\CapabilitiesService;
use OCA\Richdocuments\Service\DemoService;
use OCA\Richdocuments\Service\FontService;
@ -304,7 +303,6 @@ class SettingsController extends Controller{
];
return new JSONResponse($response);
}
/**

Просмотреть файл

@ -1,4 +1,5 @@
<?php
declare(strict_types=1);
/**
* @copyright Copyright (c) 2018 John Molakvoæ <skjnldsv@protonmail.com>
@ -96,7 +97,6 @@ class TemplatesController extends Controller {
$a = false,
$forceIcon = true,
$mode = 'fill') {
if ($fileId === '' || $x === 0 || $y === 0) {
return new DataResponse([], Http::STATUS_BAD_REQUEST);
}
@ -200,7 +200,6 @@ class TemplatesController extends Controller {
bool $a = false,
bool $forceIcon = true,
string $mode = IPreview::MODE_FILL): Http\Response {
if (!($node instanceof Node) || (!$forceIcon && !$this->preview->isAvailable($node))) {
return new DataResponse([], Http::STATUS_NOT_FOUND);
}

Просмотреть файл

@ -98,9 +98,9 @@ class WopiController extends Controller {
private ILockManager $lockManager;
// Signifies LOOL that document has been changed externally in this storage
const LOOL_STATUS_DOC_CHANGED = 1010;
public const LOOL_STATUS_DOC_CHANGED = 1010;
const WOPI_AVATAR_SIZE = 32;
public const WOPI_AVATAR_SIZE = 32;
/**
* @param string $appName
@ -172,7 +172,6 @@ class WopiController extends Controller {
*/
public function checkFileInfo($fileId, $access_token) {
try {
list($fileId, , $version) = Helper::parseFileId($fileId);
$wopi = $this->wopiMapper->getWopiForToken($access_token);
@ -428,8 +427,7 @@ class WopiController extends Controller {
} else {
$response = new StreamResponse($info->fopen('rb'));
}
}
else {
} else {
if ($file->getSize() === 0) {
$response = new Http\Response();
} else {
@ -505,11 +503,9 @@ class WopiController extends Controller {
if ($suggested[0] === '.') {
$path = dirname($file->getPath()) . '/New File' . $suggested;
}
else if ($suggested[0] !== '/') {
} elseif ($suggested[0] !== '/') {
$path = dirname($file->getPath()) . '/' . $suggested;
}
else {
} else {
$path = $userFolder->getPath() . $suggested;
}
@ -654,11 +650,9 @@ class WopiController extends Controller {
if (strpos($suggested, '.') === 0) {
$path = dirname($file->getPath()) . '/New File' . $suggested;
}
else if (strpos($suggested, '/') !== 0) {
} elseif (strpos($suggested, '/') !== 0) {
$path = dirname($file->getPath()) . '/' . $suggested;
}
else {
} else {
$path = $userFolder->getPath() . $suggested;
}

Просмотреть файл

@ -31,7 +31,7 @@ use OCP\Security\ISecureRandom;
class AssetMapper extends Mapper {
/** @var int Limetime of a token is 10 minutes */
const tokenLifeTime = 600;
public const tokenLifeTime = 600;
/** @var ISecureRandom */
private $random;

Просмотреть файл

@ -28,12 +28,11 @@ use OCP\AppFramework\Db\Mapper;
use OCP\AppFramework\Utility\ITimeFactory;
use OCP\IDBConnection;
use OCP\Security\ISecureRandom;
use PhpParser\Node\Scalar\MagicConst\Dir;
class DirectMapper extends Mapper {
/** @var int Limetime of a token is 10 minutes */
const tokenLifeTime = 600;
public const tokenLifeTime = 600;
/** @var ISecureRandom */
protected $random;

Просмотреть файл

@ -66,27 +66,27 @@ class Wopi extends Entity implements \JsonSerializable {
/**
* WOPI token to open a file as a user on the current instance
*/
const TOKEN_TYPE_USER = 0;
public const TOKEN_TYPE_USER = 0;
/**
* WOPI token to open a file as a guest on the current instance
*/
const TOKEN_TYPE_GUEST = 1;
public const TOKEN_TYPE_GUEST = 1;
/**
* WOPI token to open a file as a user from a federated instance
*/
const TOKEN_TYPE_REMOTE_USER = 2;
public const TOKEN_TYPE_REMOTE_USER = 2;
/**
* WOPI token to open a file as a guest from a federated instance
*/
const TOKEN_TYPE_REMOTE_GUEST = 3;
public const TOKEN_TYPE_REMOTE_GUEST = 3;
/*
* Temporary token that is used to share the initiator details to the source instance
*/
const TOKEN_TYPE_INITIATOR = 4;
public const TOKEN_TYPE_INITIATOR = 4;
/** @var string */
protected $ownerUid;

Просмотреть файл

@ -139,7 +139,6 @@ class WopiMapper extends Mapper {
* @throws ExpiredTokenException
*/
public function getWopiForToken($token) {
$qb = $this->db->getQueryBuilder();
$qb->select('*')
->from('richdocuments_wopi')

Просмотреть файл

@ -2,7 +2,6 @@
namespace OCA\Richdocuments\Events;
use OCP\Files\Node;
use Symfony\Component\EventDispatcher\Event;
@ -42,5 +41,4 @@ class BeforeFederationRedirectEvent extends Event {
public function getRedirectUrl() {
return $this->redirectUrl;
}
}

Просмотреть файл

@ -22,4 +22,5 @@
*/
namespace OCA\Richdocuments\Exceptions;
class ExpiredTokenException extends \Exception {}
class ExpiredTokenException extends \Exception {
}

Просмотреть файл

@ -22,4 +22,5 @@
*/
namespace OCA\Richdocuments\Exceptions;
class UnknownTokenException extends \Exception {}
class UnknownTokenException extends \Exception {
}

Просмотреть файл

@ -61,12 +61,12 @@ class Helper {
* WOPI helper function to convert to ISO 8601 round-trip format.
* @param integer $time Must be seconds since unix epoch
*/
public static function toISO8601($time)
{
public static function toISO8601($time) {
// TODO: Be more precise and don't ignore milli, micro seconds ?
$datetime = DateTime::createFromFormat('U', $time, new DateTimeZone('UTC'));
if ($datetime)
if ($datetime) {
return $datetime->format('Y-m-d\TH:i:s.u\Z');
}
return false;
}
@ -88,5 +88,4 @@ class Helper {
}
return $_COOKIE['guestUser'];
}
}

Просмотреть файл

@ -26,7 +26,6 @@ declare(strict_types=1);
namespace OCA\Richdocuments\Listener;
use OCA\Richdocuments\TemplateManager;
use OCP\EventDispatcher\Event;
use OCP\EventDispatcher\IEventListener;

Просмотреть файл

@ -185,5 +185,4 @@ class Version2060Date20200302131958 extends SimpleMigrationStep {
}
return $schema;
}
}

Просмотреть файл

@ -9,8 +9,7 @@ use OCP\DB\ISchemaWrapper;
use OCP\Migration\IOutput;
use OCP\Migration\SimpleMigrationStep;
class Version2060Date20200302132145 extends SimpleMigrationStep
{
class Version2060Date20200302132145 extends SimpleMigrationStep {
/**
* @param IOutput $output
@ -18,8 +17,7 @@ class Version2060Date20200302132145 extends SimpleMigrationStep
* @param array $options
* @return null|ISchemaWrapper
*/
public function changeSchema(IOutput $output, Closure $schemaClosure, array $options)
{
public function changeSchema(IOutput $output, Closure $schemaClosure, array $options) {
/** @var ISchemaWrapper $schema */
$schema = $schemaClosure();
@ -33,5 +31,4 @@ class Version2060Date20200302132145 extends SimpleMigrationStep
return $schema;
}
}

Просмотреть файл

@ -66,7 +66,6 @@ class Version30704Date20200626072306 extends SimpleMigrationStep {
'notnull' => false,
'default' => '',
]);
}
if (!$table->hasColumn('remote_server_token')) {
$table->addColumn('remote_server_token', 'string', [

Просмотреть файл

@ -10,7 +10,6 @@ use OCP\Migration\IOutput;
use OCP\Migration\SimpleMigrationStep;
class Version30709Date20201111104147 extends SimpleMigrationStep {
public function changeSchema(IOutput $output, Closure $schemaClosure, array $options) {
/** @var ISchemaWrapper $schema */
$schema = $schemaClosure();

Просмотреть файл

@ -10,7 +10,6 @@ use OCP\Migration\IOutput;
use OCP\Migration\SimpleMigrationStep;
class Version30717Date20210310164901 extends SimpleMigrationStep {
public function changeSchema(IOutput $output, Closure $schemaClosure, array $options): ?ISchemaWrapper {
/** @var ISchemaWrapper $schema */
$schema = $schemaClosure();
@ -51,5 +50,4 @@ class Version30717Date20210310164901 extends SimpleMigrationStep {
return $schema;
}
}

Просмотреть файл

@ -21,8 +21,6 @@
*/
namespace OCA\Richdocuments\Preview;
use GuzzleHttp\Psr7\LimitStream;
use function GuzzleHttp\Psr7\stream_for;
use OC\Preview\Provider;
use OCA\Richdocuments\Capabilities;
use OCP\Http\Client\IClientService;
@ -107,7 +105,5 @@ abstract class Office extends Provider {
return $image;
}
return false;
}
}

Просмотреть файл

@ -131,16 +131,15 @@ class CapabilitiesService {
if (!is_array($capabilities)) {
$capabilities = [];
}
} catch (\Exception $e) {
$capabilities = [];
}
$this->capabilities = $capabilities;
$ttl = 3600;
if (count($capabilities) === 0)
if (count($capabilities) === 0) {
$ttl = 60;
}
$this->cache->set('capabilities', $capabilities, $ttl);
}

Просмотреть файл

@ -58,5 +58,4 @@ class DemoService {
$this->cache->set('richdocuments-demo', json_encode($servers));
return $servers;
}
}

Просмотреть файл

@ -23,7 +23,6 @@
namespace OCA\Richdocuments\Service;
use OCA\Federation\TrustedServers;
use OCA\Files_Sharing\External\Storage as SharingExternalStorage;
use OCA\Richdocuments\AppConfig;
@ -71,7 +70,8 @@ class FederationService {
$this->urlGenerator = $urlGenerator;
try {
$this->trustedServers = \OC::$server->query(\OCA\Federation\TrustedServers::class);
} catch (QueryException $e) {}
} catch (QueryException $e) {
}
}
/**

Просмотреть файл

@ -23,7 +23,6 @@
namespace OCA\Richdocuments\Service;
use OCA\Richdocuments\AppInfo\Application;
use OCP\Files\IAppData;
use OCP\Files\NotFoundException;

Просмотреть файл

@ -23,12 +23,10 @@
namespace OCA\Richdocuments\Service;
use OCP\IUserManager;
use OCP\IUserSession;
class UserScopeService {
public function __construct(IUserSession $userSession, IUserManager $userManager) {
$this->userSession = $userSession;
$this->userManager = $userManager;

Просмотреть файл

@ -111,5 +111,4 @@ class Admin implements ISettings {
public function getPriority() {
return 0;
}
}

Просмотреть файл

@ -26,14 +26,12 @@ declare(strict_types=1);
namespace OCA\Richdocuments\Template;
use OCA\Richdocuments\TemplateManager;
use OCP\Files\File;
use OCP\Files\NotFoundException;
use OCP\Files\Template\ICustomTemplateProvider;
use OCP\Files\Template\ITemplateManager;
use OCP\Files\Template\Template;
use OCP\Files\Template\TemplateFileCreator;
use OCP\IURLGenerator;
class CollaboraTemplateProvider implements ICustomTemplateProvider {

Просмотреть файл

@ -1,4 +1,5 @@
<?php
declare(strict_types = 1);
/**
* @copyright Copyright (c) 2018 John Molakvoæ <skjnldsv@protonmail.com>
@ -66,41 +67,41 @@ class TemplateManager {
private $logger;
/** Accepted templates mime types */
const MIMES_DOCUMENTS = [
public const MIMES_DOCUMENTS = [
'application/vnd.oasis.opendocument.text-template',
'application/vnd.openxmlformats-officedocument.wordprocessingml.template',
'application/msword'
];
const MIMES_SHEETS = [
public const MIMES_SHEETS = [
'application/vnd.oasis.opendocument.spreadsheet-template',
'application/vnd.openxmlformats-officedocument.spreadsheetml.template',
'application/vnd.ms-excel'
];
const MIMES_PRESENTATIONS = [
public const MIMES_PRESENTATIONS = [
'application/vnd.oasis.opendocument.presentation-template',
'application/vnd.openxmlformats-officedocument.presentationml.template',
'application/vnd.ms-powerpoint'
];
const MIMES_DRAWINGS = [
public const MIMES_DRAWINGS = [
'application/vnd.oasis.opendocument.graphics-template',
];
/** @var array Template mime types match */
static public $tplTypes = [
public static $tplTypes = [
'document' => self::MIMES_DOCUMENTS,
'spreadsheet' => self::MIMES_SHEETS,
'presentation' => self::MIMES_PRESENTATIONS,
'drawing' => self::MIMES_DRAWINGS,
];
const TYPE_EXTENTION = [
public const TYPE_EXTENTION = [
'document' => 'odt',
'spreadsheet' => 'ods',
'presentation' => 'odp',
'drawing' => 'odg',
];
const TYPE_EXTENSION_OOXML = [
public const TYPE_EXTENSION_OOXML = [
'document' => 'docx',
'spreadsheet' => 'xlsx',
'presentation' => 'pptx',

Просмотреть файл

@ -21,18 +21,14 @@
namespace OCA\Richdocuments;
use InvalidArgumentException;
use OC\Files\Filesystem;
use OCA\Richdocuments\Db\Direct;
use OCA\Richdocuments\Db\WopiMapper;
use OCA\Richdocuments\Db\Wopi;
use OCA\Richdocuments\Service\CapabilitiesService;
use OCA\Richdocuments\WOPI\Parser;
use OCP\AppFramework\Db\DoesNotExistException;
use OCP\AppFramework\Http\DataResponse;
use OCP\Constants;
use OCP\Files\File;
use OCP\Files\ForbiddenException;
use OCP\Files\IRootFolder;
use OCP\Files\Node;
use OCP\IGroupManager;
@ -41,7 +37,6 @@ use OCP\IUserManager;
use OCP\Share\Exceptions\ShareNotFound;
use OCP\Share\IManager;
use OCP\IL10N;
use OCP\Share\IShare;
use OCP\Util;
class TokenManager {
@ -176,7 +171,6 @@ class TokenManager {
}
}
}
}
/** @var File $file */
$file = $rootFolder->getById($fileId)[0];
@ -335,5 +329,4 @@ class TokenManager {
$wopi->setGuestDisplayname($this->prepareGuestName($guestName));
$this->wopiMapper->update($wopi);
}
}

Просмотреть файл

@ -77,8 +77,9 @@ class DiscoveryManager {
$options['verify'] = false;
}
if ($this->isProxyStarting($wopiDiscovery))
if ($this->isProxyStarting($wopiDiscovery)) {
$options['timeout'] = 180;
}
try {
return $client->get($wopiDiscovery, $options);
@ -98,10 +99,11 @@ class DiscoveryManager {
private function isProxyStarting($url) {
$usesProxy = false;
$proxyPos = strrpos($url, 'proxy.php');
if ($proxyPos === false)
if ($proxyPos === false) {
$usesProxy = false;
else
} else {
$usesProxy = true;
}
if ($usesProxy === true) {
$statusUrl = substr($url, 0, $proxyPos);

Просмотреть файл

@ -57,7 +57,5 @@ class Parser {
}
throw new \Exception('Could not find urlsrc in WOPI');
}
}

Просмотреть файл

@ -212,5 +212,4 @@ class DirectContext implements Context {
}
$this->serverContext->sendOCSRequest('POST', 'apps/richdocuments/api/v1/share', $data, $options);
}
}

Просмотреть файл

@ -74,5 +74,4 @@ class FederationContext implements Context {
$table
);
}
}

Просмотреть файл

@ -1,4 +1,5 @@
<?php
require __DIR__ . '/../../vendor/autoload.php';
use Behat\Behat\Context\Context;
@ -9,8 +10,7 @@ use JuliusHaertl\NextcloudBehat\Context\ServerContext;
use JuliusHaertl\NextcloudBehat\Context\SharingContext;
use PHPUnit\Framework\Assert;
class RichDocumentsContext implements Context
{
class RichDocumentsContext implements Context {
/** @var ServerContext */
private $serverContext;
@ -41,8 +41,7 @@ class RichDocumentsContext implements Context
/**
* @When User :user opens :file
*/
public function userOpens($user, $file)
{
public function userOpens($user, $file) {
$this->serverContext->usingWebAsUser($user);
$davClient = $this->filesContext->getSabreClient($user);
$path = $this->filesContext->makeSabrePath($user, $file);
@ -78,24 +77,21 @@ class RichDocumentsContext implements Context
/**
* @Then a guest opens the share link
*/
public function aGuestOpensTheShareLink()
{
public function aGuestOpensTheShareLink() {
$this->aGuestOpensTheShareLinkAs();
}
/**
* @Then a guest opens the share link as :guestName
*/
public function aGuestOpensTheShareLinkAs($guestName = null)
{
public function aGuestOpensTheShareLinkAs($guestName = null) {
$this->openTheShareLink(null, $guestName);
}
/**
* @Then the user opens the share link
*/
public function aUserOpensTheShareLink()
{
public function aUserOpensTheShareLink() {
$this->openTheShareLink($this->serverContext->getAuth()[0], null);
}

Просмотреть файл

@ -48,8 +48,7 @@ class WopiContext implements Context {
private $wopiToken;
private $checkFileInfoResult;
public function __construct()
{
public function __construct() {
$this->downloadedFile = tempnam(sys_get_temp_dir(), 'downloadedFile');
}
@ -91,8 +90,7 @@ class WopiContext implements Context {
/**
* @Then /^Collabora saved the file with the content of "([^"]*)"$/
*/
public function collaboraPuts($source)
{
public function collaboraPuts($source) {
$file = Utils::streamFor(fopen($source, 'r'));
$client = new Client();
$options = [
@ -133,8 +131,7 @@ class WopiContext implements Context {
/**
* @Then /^checkFileInfo "([^"]*)" is "([^"]*)"$/
*/
public function checkfileinfoIs($key, $value)
{
public function checkfileinfoIs($key, $value) {
\PHPUnit\Framework\Assert::assertEquals($value, $this->checkFileInfoResult[$key]);
}
@ -142,32 +139,28 @@ class WopiContext implements Context {
/**
* @Then /^checkFileInfo "([^"]*)" matches "([^"]*)"$/
*/
public function checkfileinfoMatches($key, $regex)
{
public function checkfileinfoMatches($key, $regex) {
\PHPUnit\Framework\Assert::assertRegExp($regex, $this->checkFileInfoResult[$key]);
}
/**
* @Then /^checkFileInfo "([^"]*)" is true$/
*/
public function checkfileinfoIsTrue($key)
{
public function checkfileinfoIsTrue($key) {
\PHPUnit\Framework\Assert::assertTrue($this->checkFileInfoResult[$key]);
}
/**
* @Then /^checkFileInfo "([^"]*)" is false$/
*/
public function checkfileinfoIsFalse($key)
{
public function checkfileinfoIsFalse($key) {
\PHPUnit\Framework\Assert::assertFalse($this->checkFileInfoResult[$key]);
}
/**
* @Then /^checkFileInfo "([^"]*)" is not set/
*/
public function checkfileinfoIsNotSet($key)
{
public function checkfileinfoIsNotSet($key) {
\PHPUnit\Framework\Assert::assertArrayNotHasKey($key, $this->checkFileInfoResult);
}
@ -293,5 +286,4 @@ class WopiContext implements Context {
$this->response = $e->getResponse();
}
}
}