mirror of
https://github.com/opencloud-eu/opencloud.git
synced 2025-12-23 22:29:59 -05:00
[skip-ci] format PHP code same as in owncloud/core
This commit is contained in:
3
.gitignore
vendored
3
.gitignore
vendored
@@ -29,6 +29,9 @@ vendor
|
||||
vendor-bin/**/vendor
|
||||
vendor-bin/**/composer.lock
|
||||
|
||||
# API acceptance tests - auto-generated files
|
||||
.php-cs-fixer.cache
|
||||
|
||||
# drone CI is in .drone.star, do not let someone accidentally commit a local .drone.yml
|
||||
.drone.yml
|
||||
|
||||
|
||||
16
.php-cs-fixer.dist.php
Normal file
16
.php-cs-fixer.dist.php
Normal file
@@ -0,0 +1,16 @@
|
||||
<?php
|
||||
|
||||
$dirToParse = 'tests/acceptance/';
|
||||
$dirIterator = new DirectoryIterator(__DIR__ . '/' . $dirToParse);
|
||||
|
||||
$excludeDirs = [
|
||||
'node_modules'
|
||||
];
|
||||
|
||||
$finder = PhpCsFixer\Finder::create()
|
||||
->exclude($excludeDirs)
|
||||
->in(__DIR__);
|
||||
|
||||
$config = new OC\CodingStandard\Config();
|
||||
$config->setFinder($finder);
|
||||
return $config;
|
||||
32
Makefile
32
Makefile
@@ -32,6 +32,12 @@ OCIS_MODULES = \
|
||||
web \
|
||||
webdav
|
||||
|
||||
# bin file definitions
|
||||
PHP_CS_FIXER=php -d zend.enable_gc=0 vendor-bin/owncloud-codestyle/vendor/bin/php-cs-fixer
|
||||
PHP_CODESNIFFER=vendor-bin/php_codesniffer/vendor/bin/phpcs
|
||||
PHAN=php -d zend.enable_gc=0 vendor-bin/phan/vendor/bin/phan
|
||||
PHPSTAN=php -d zend.enable_gc=0 vendor-bin/phpstan/vendor/bin/phpstan
|
||||
|
||||
ifneq (, $(shell which go 2> /dev/null)) # suppress `command not found warnings` for non go targets in CI
|
||||
include .bingo/Variables.mk
|
||||
endif
|
||||
@@ -64,6 +70,10 @@ help:
|
||||
@echo -e "\tsee ./tests/acceptance/docker/Makefile"
|
||||
@echo -e "\tor run ${YELLOW}make -C tests/acceptance/docker help${RESET}"
|
||||
@echo
|
||||
@echo -e "${GREEN}Tools for developing tests:\n${RESET}"
|
||||
@echo -e "\tmake test-php-style\t\t${BLUE}run PHP code style checks${RESET}"
|
||||
@echo -e "\tmake test-php-style-fix\t\t${BLUE}run PHP code style checks and fix any issues found${RESET}"
|
||||
@echo
|
||||
|
||||
.PHONY: clean-tests
|
||||
clean-tests:
|
||||
@@ -194,3 +204,25 @@ l10n-write:
|
||||
.PHONY: ci-format
|
||||
ci-format: $(BUILDIFIER)
|
||||
$(BUILDIFIER) --mode=fix .drone.star
|
||||
|
||||
.PHONY: test-php-style
|
||||
test-php-style: vendor-bin/owncloud-codestyle/vendor vendor-bin/php_codesniffer/vendor
|
||||
$(PHP_CS_FIXER) fix -v --diff --allow-risky yes --dry-run
|
||||
$(PHP_CODESNIFFER) --cache --runtime-set ignore_warnings_on_exit --standard=phpcs.xml tests/acceptance
|
||||
|
||||
.PHONY: test-php-style-fix
|
||||
test-php-style-fix: vendor-bin/owncloud-codestyle/vendor
|
||||
$(PHP_CS_FIXER) fix -v --diff --allow-risky yes
|
||||
|
||||
|
||||
vendor-bin/owncloud-codestyle/vendor: vendor/bamarni/composer-bin-plugin vendor-bin/owncloud-codestyle/composer.lock
|
||||
composer bin owncloud-codestyle install --no-progress
|
||||
|
||||
vendor-bin/owncloud-codestyle/composer.lock: vendor-bin/owncloud-codestyle/composer.json
|
||||
@echo owncloud-codestyle composer.lock is not up to date.
|
||||
|
||||
vendor-bin/php_codesniffer/vendor: vendor/bamarni/composer-bin-plugin vendor-bin/php_codesniffer/composer.lock
|
||||
composer bin php_codesniffer install --no-progress
|
||||
|
||||
vendor-bin/php_codesniffer/composer.lock: vendor-bin/php_codesniffer/composer.json
|
||||
@echo php_codesniffer composer.lock is not up to date.
|
||||
|
||||
@@ -2,22 +2,21 @@
|
||||
|
||||
# reference: https://doc.owncloud.com/server/admin_manual/configuration/user/oidc/
|
||||
|
||||
function getOIDCConfigFromEnv()
|
||||
{
|
||||
$config = [
|
||||
'openid-connect' => [
|
||||
'provider-url' => getenv('IDP_OIDC_ISSUER'),
|
||||
'client-id' => 'oc10',
|
||||
'client-secret' => getenv('IDP_OIDC_CLIENT_SECRET'),
|
||||
'loginButtonName' => 'OpenId Connect',
|
||||
'search-attribute' => 'preferred_username',
|
||||
'mode' => 'userid',
|
||||
'autoRedirectOnLoginPage' => true,
|
||||
'insecure' => true,
|
||||
'post_logout_redirect_uri' => 'https://' . getenv('CLOUD_DOMAIN'),
|
||||
],
|
||||
];
|
||||
return $config;
|
||||
function getOIDCConfigFromEnv() {
|
||||
$config = [
|
||||
'openid-connect' => [
|
||||
'provider-url' => getenv('IDP_OIDC_ISSUER'),
|
||||
'client-id' => 'oc10',
|
||||
'client-secret' => getenv('IDP_OIDC_CLIENT_SECRET'),
|
||||
'loginButtonName' => 'OpenId Connect',
|
||||
'search-attribute' => 'preferred_username',
|
||||
'mode' => 'userid',
|
||||
'autoRedirectOnLoginPage' => true,
|
||||
'insecure' => true,
|
||||
'post_logout_redirect_uri' => 'https://' . getenv('CLOUD_DOMAIN'),
|
||||
],
|
||||
];
|
||||
return $config;
|
||||
}
|
||||
|
||||
$CONFIG = getOIDCConfigFromEnv();
|
||||
|
||||
@@ -2,14 +2,13 @@
|
||||
|
||||
# reference: https://owncloud.dev/clients/web/deployments/oc10-app/
|
||||
|
||||
function getWebConfigFromEnv()
|
||||
{
|
||||
$config = [
|
||||
'web.baseUrl' => 'https://' . getenv('CLOUD_DOMAIN') . '/index.php/apps/web',
|
||||
'web.rewriteLinks' => getenv('OWNCLOUD_WEB_REWRITE_LINKS') == 'true',
|
||||
function getWebConfigFromEnv() {
|
||||
$config = [
|
||||
'web.baseUrl' => 'https://' . getenv('CLOUD_DOMAIN') . '/index.php/apps/web',
|
||||
'web.rewriteLinks' => getenv('OWNCLOUD_WEB_REWRITE_LINKS') == 'true',
|
||||
|
||||
];
|
||||
return $config;
|
||||
];
|
||||
return $config;
|
||||
}
|
||||
|
||||
$CONFIG = getWebConfigFromEnv();
|
||||
|
||||
80
phpcs.xml
Normal file
80
phpcs.xml
Normal file
@@ -0,0 +1,80 @@
|
||||
<?xml version="1.0"?>
|
||||
<ruleset name="ownCloud Standard">
|
||||
<description>ownCloud coding standard</description>
|
||||
<arg name="colors" />
|
||||
<arg value="sp" />
|
||||
|
||||
<exclude-pattern>*/vendor/*</exclude-pattern>
|
||||
<exclude-pattern>*/3rdparty/*</exclude-pattern>
|
||||
|
||||
<!-- make sure we use tabs for indent and not spaces -->
|
||||
<arg name="tab-width" value="4" />
|
||||
<rule ref="Generic.WhiteSpace.DisallowSpaceIndent" />
|
||||
<rule ref="Generic.WhiteSpace.ScopeIndent">
|
||||
<properties>
|
||||
<property name="indent" value="4" />
|
||||
<property name="tabIndent" value="true" />
|
||||
</properties>
|
||||
<exclude name="Generic.WhiteSpace.DisallowTabIndent.TabsUsed" />
|
||||
<exclude name="Generic.WhiteSpace.DisallowTabIndent.NonIndentTabsUsed" />
|
||||
</rule>
|
||||
|
||||
<rule ref="Generic.Files.LineLength">
|
||||
<exclude name="Generic.Files.LineLength.TooLong" />
|
||||
</rule>
|
||||
|
||||
<rule ref="PEAR">
|
||||
<exclude name="Generic.Commenting.DocComment.ShortNotCapital" />
|
||||
<exclude name="Generic.Commenting.DocComment.SpacingAfter" />
|
||||
<exclude name="Generic.Commenting.DocComment.MissingShort" />
|
||||
<exclude name="Generic.Commenting.DocComment.TagValueIndent" />
|
||||
<exclude name="Generic.Commenting.DocComment.ParamNotFirst" />
|
||||
<exclude name="PEAR.Commenting.FileComment.IncompleteCopyright" />
|
||||
<exclude name="PEAR.Commenting.FileComment.IncompleteLicense" />
|
||||
<exclude name="PEAR.Commenting.FileComment.MissingVersion" />
|
||||
<exclude name="PEAR.Commenting.FileComment.MissingCategoryTag" />
|
||||
<exclude name="PEAR.Commenting.FileComment.MissingPackageTag" />
|
||||
<exclude name="PEAR.Commenting.FileComment.MissingLicenseTag" />
|
||||
<exclude name="PEAR.Commenting.FileComment.MissingLinkTag" />
|
||||
<exclude name="PEAR.Commenting.ClassComment.MissingCategoryTag" />
|
||||
<exclude name="PEAR.Commenting.ClassComment.MissingPackageTag" />
|
||||
<exclude name="PEAR.Commenting.ClassComment.MissingAuthorTag" />
|
||||
<exclude name="PEAR.Commenting.ClassComment.MissingLicenseTag" />
|
||||
<exclude name="PEAR.Commenting.ClassComment.MissingLinkTag" />
|
||||
<exclude name="PEAR.Commenting.FunctionComment.MissingParamComment" />
|
||||
<exclude name="PEAR.Commenting.FunctionComment.SpacingAfterParamType" />
|
||||
<exclude name="PEAR.Commenting.FunctionComment.SpacingAfterParamName" />
|
||||
<exclude
|
||||
name="PEAR.NamingConventions.ValidVariableName.PrivateNoUnderscore" />
|
||||
<exclude
|
||||
name="PEAR.NamingConventions.ValidFunctionName.PrivateNoUnderscore" />
|
||||
<exclude name="PEAR.WhiteSpace.ScopeIndent.IncorrectExact" />
|
||||
<exclude name="PEAR.Functions.FunctionDeclaration.BraceOnSameLine" />
|
||||
<exclude name="PEAR.Classes.ClassDeclaration.OpenBraceNewLine" />
|
||||
</rule>
|
||||
<rule ref="Zend.Files.ClosingTag"/>
|
||||
<rule ref="Squiz.WhiteSpace.OperatorSpacing.NoSpaceBefore" />
|
||||
<rule ref="Squiz.WhiteSpace.OperatorSpacing.NoSpaceAfter" />
|
||||
<rule ref="Squiz.Commenting.DocCommentAlignment" />
|
||||
<rule ref="Generic.WhiteSpace.ScopeIndent" />
|
||||
<rule ref="Squiz.Strings.ConcatenationSpacing">
|
||||
<properties>
|
||||
<property name="spacing" value="1" />
|
||||
<property name="ignoreNewlines" value="true" />
|
||||
</properties>
|
||||
</rule>
|
||||
<rule ref="PSR2.ControlStructures.SwitchDeclaration.BreakIndent">
|
||||
<exclude
|
||||
name="PSR2.ControlStructures.SwitchDeclaration.SpaceBeforeColonDEFAULT" />
|
||||
<exclude
|
||||
name="PSR2.ControlStructures.SwitchDeclaration.SpaceBeforeColonCASE" />
|
||||
</rule>
|
||||
<rule ref="Generic.Functions.OpeningFunctionBraceKernighanRitchie" />
|
||||
<rule ref="Generic.Classes.OpeningBraceSameLine" />
|
||||
|
||||
<!-- storage wrapper uses php function names to wrap them -->
|
||||
<rule ref="PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps">
|
||||
<exclude-pattern>*/lib/storagewrapper.php</exclude-pattern>
|
||||
</rule>
|
||||
|
||||
</ruleset>
|
||||
@@ -1,4 +1,24 @@
|
||||
<?php
|
||||
/**
|
||||
* ownCloud
|
||||
*
|
||||
* @author Phil Davis <phil@jankaritech.com>
|
||||
* @copyright Copyright (c) 2020 Phil Davis phil@jankaritech.com
|
||||
*
|
||||
* This code is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Affero General Public License,
|
||||
* as published by the Free Software Foundation;
|
||||
* either version 3 of the License, or any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU Affero General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Affero General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>
|
||||
*
|
||||
*/
|
||||
|
||||
use Behat\Behat\Context\Context;
|
||||
use Behat\Behat\Hook\Scope\BeforeScenarioScope;
|
||||
@@ -11,30 +31,29 @@ require_once 'bootstrap.php';
|
||||
* Context for Reva specific steps
|
||||
*/
|
||||
class RevaContext implements Context {
|
||||
/**
|
||||
* @var FeatureContext
|
||||
*/
|
||||
private $featureContext;
|
||||
|
||||
/**
|
||||
* @var FeatureContext
|
||||
*/
|
||||
private $featureContext;
|
||||
|
||||
/**
|
||||
* @BeforeScenario
|
||||
*
|
||||
* @param BeforeScenarioScope $scope
|
||||
*
|
||||
* @return void
|
||||
* @throws Exception
|
||||
*/
|
||||
public function setUpScenario(BeforeScenarioScope $scope): void {
|
||||
// Get the environment
|
||||
$environment = $scope->getEnvironment();
|
||||
// Get all the contexts you need in this context
|
||||
$this->featureContext = $environment->getContext('FeatureContext');
|
||||
SetupHelper::init(
|
||||
$this->featureContext->getAdminUsername(),
|
||||
$this->featureContext->getAdminPassword(),
|
||||
$this->featureContext->getBaseUrl(),
|
||||
$this->featureContext->getOcPath()
|
||||
);
|
||||
}
|
||||
/**
|
||||
* @BeforeScenario
|
||||
*
|
||||
* @param BeforeScenarioScope $scope
|
||||
*
|
||||
* @return void
|
||||
* @throws Exception
|
||||
*/
|
||||
public function setUpScenario(BeforeScenarioScope $scope): void {
|
||||
// Get the environment
|
||||
$environment = $scope->getEnvironment();
|
||||
// Get all the contexts you need in this context
|
||||
$this->featureContext = $environment->getContext('FeatureContext');
|
||||
SetupHelper::init(
|
||||
$this->featureContext->getAdminUsername(),
|
||||
$this->featureContext->getAdminPassword(),
|
||||
$this->featureContext->getBaseUrl(),
|
||||
$this->featureContext->getOcPath()
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -1,14 +1,37 @@
|
||||
<?php
|
||||
/**
|
||||
* ownCloud
|
||||
*
|
||||
* @author Phil Davis <phil@jankaritech.com>
|
||||
* @copyright Copyright (c) 2020 Phil Davis phil@jankaritech.com
|
||||
*
|
||||
* This code is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Affero General Public License,
|
||||
* as published by the Free Software Foundation;
|
||||
* either version 3 of the License, or any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU Affero General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Affero General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>
|
||||
*
|
||||
*/
|
||||
|
||||
$pathToCore = \getenv('PATH_TO_CORE');
|
||||
if ($pathToCore === false) {
|
||||
$pathToCore = "../core";
|
||||
$pathToCore = "../core";
|
||||
}
|
||||
|
||||
require_once $pathToCore . '/tests/acceptance/features/bootstrap/bootstrap.php';
|
||||
|
||||
$classLoader = new \Composer\Autoload\ClassLoader();
|
||||
$classLoader->addPsr4(
|
||||
"", $pathToCore . "/tests/acceptance/features/bootstrap", true
|
||||
"",
|
||||
$pathToCore . "/tests/acceptance/features/bootstrap",
|
||||
true
|
||||
);
|
||||
|
||||
$classLoader->register();
|
||||
|
||||
@@ -17,6 +17,7 @@
|
||||
"guzzlehttp/guzzle": "^7.4",
|
||||
"phpunit/phpunit": "^9.5",
|
||||
"laminas/laminas-ldap": "^2.10",
|
||||
"ankitpokhrel/tus-php": "^2.1"
|
||||
"ankitpokhrel/tus-php": "^2.1",
|
||||
"wapmorgan/unified-archive": "^1.1.3"
|
||||
}
|
||||
}
|
||||
|
||||
5
vendor-bin/owncloud-codestyle/composer.json
Normal file
5
vendor-bin/owncloud-codestyle/composer.json
Normal file
@@ -0,0 +1,5 @@
|
||||
{
|
||||
"require": {
|
||||
"owncloud/coding-standard": "^3.0"
|
||||
}
|
||||
}
|
||||
8
vendor-bin/php_codesniffer/composer.json
Normal file
8
vendor-bin/php_codesniffer/composer.json
Normal file
@@ -0,0 +1,8 @@
|
||||
{
|
||||
"require": {
|
||||
"squizlabs/php_codesniffer": "^3.5"
|
||||
},
|
||||
"conflict": {
|
||||
"squizlabs/php_codesniffer": "3.5.1"
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user