-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add code to access remote
Case
entity
- Loading branch information
Dominic Tubach
committed
Jul 26, 2024
1 parent
20cbde1
commit 0abf1ae
Showing
21 changed files
with
732 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
name: PHP_CodeSniffer - civiremote_case | ||
|
||
on: | ||
pull_request: | ||
paths: | ||
- 'modules/civiremote_case/src/**.php' | ||
- modules/civiremote_case/composer.json | ||
- modules/civiremote_case/phpcs.xml.dist | ||
|
||
jobs: | ||
phpcs: | ||
runs-on: ubuntu-latest | ||
name: PHP_CodeSniffer | ||
defaults: | ||
run: | ||
working-directory: modules/civiremote_case | ||
|
||
steps: | ||
- uses: actions/checkout@v3 | ||
|
||
- name: Setup PHP | ||
uses: shivammathur/setup-php@v2 | ||
with: | ||
php-version: 8.3 | ||
coverage: none | ||
tools: cs2pr | ||
env: | ||
fail-fast: true | ||
|
||
- name: Get composer cache directory | ||
id: composer-cache | ||
run: echo "dir=$(composer config cache-files-dir)" >> $GITHUB_OUTPUT | ||
|
||
- name: Cache dependencies | ||
uses: actions/cache@v3 | ||
with: | ||
path: ${{ steps.composer-cache.outputs.dir }} | ||
key: ${{ runner.os }}-composer-${{ hashFiles('modules/civiremote_case/composer.json') }} | ||
restore-keys: ${{ runner.os }}-composer- | ||
|
||
- name: Install dependencies | ||
run: composer update --no-progress --prefer-dist | ||
|
||
- name: Run PHP_CodeSniffer | ||
run: composer phpcs -- -q --report=checkstyle | cs2pr |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,55 @@ | ||
name: PHPStan - civiremote_case | ||
|
||
on: | ||
pull_request: | ||
paths: | ||
- 'modules/civiremote_case/src/**.php' | ||
- modules/civiremote_case/composer.json | ||
- modules/civiremote_case/tools/phpstan/composer.json | ||
- modules/civiremote_case/ci/composer.json | ||
- modules/civiremote_case/phpstan.ci.neon | ||
- modules/civiremote_case/phpstan.neon.dist | ||
- 'modules/civiremote_entity/src/**.php' | ||
|
||
jobs: | ||
phpstan: | ||
runs-on: ubuntu-latest | ||
strategy: | ||
matrix: | ||
php-versions: ['8.1', '8.3'] | ||
prefer: ['prefer-stable', 'prefer-lowest'] | ||
name: PHPStan with PHP ${{ matrix.php-versions }} ${{ matrix.prefer }} | ||
defaults: | ||
run: | ||
working-directory: modules/civiremote_case | ||
|
||
steps: | ||
- uses: actions/checkout@v3 | ||
|
||
- name: Setup PHP | ||
uses: shivammathur/setup-php@v2 | ||
with: | ||
php-version: ${{ matrix.php-versions }} | ||
coverage: none | ||
env: | ||
fail-fast: true | ||
|
||
- name: Get composer cache directory | ||
id: composer-cache | ||
run: echo "dir=$(composer config cache-files-dir)" >> $GITHUB_OUTPUT | ||
|
||
- name: Cache dependencies | ||
uses: actions/cache@v3 | ||
with: | ||
path: ${{ steps.composer-cache.outputs.dir }} | ||
key: ${{ runner.os }}-composer-${{ matrix.prefer }}-${{ hashFiles('modules/civiremote_case/**/composer.json') }} | ||
restore-keys: ${{ runner.os }}-composer-${{ matrix.prefer }}- | ||
|
||
- name: Install dependencies | ||
run: | | ||
composer update --no-progress --prefer-dist --${{ matrix.prefer }} --optimize-autoloader && | ||
composer composer-phpstan -- update --no-progress --prefer-dist --optimize-autoloader && | ||
composer --working-dir=ci update --no-progress --prefer-dist --${{ matrix.prefer }} --optimize-autoloader | ||
- name: Run PHPStan | ||
run: composer phpstan -- analyse -c phpstan.ci.neon |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
The dependencies specified in composer.json of this directory are required to | ||
run phpstan in CI. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
{ | ||
"minimum-stability": "dev", | ||
"prefer-stable": true, | ||
"config": { | ||
"sort-packages": true | ||
}, | ||
"repositories": [ | ||
{ | ||
"type": "vcs", | ||
"url": "https://github.com/systopia/drupal-json_forms.git" | ||
}, | ||
{ | ||
"type": "composer", | ||
"url": "https://packages.drupal.org/8" | ||
} | ||
], | ||
"require": { | ||
"drupal/core": "^10", | ||
"drupal/json_forms": "~0.1" | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
name: CiviRemote Case | ||
type: module | ||
description: 'CiviRemote Case' | ||
package: CiviCRM | ||
core_version_requirement: ^10 | ||
dependencies: | ||
- civiremote_entity | ||
|
||
project: civiremote | ||
version: 1.1.x-dev |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
civiremote_case.create_form: | ||
path: '/civiremote/case/add/{profile}' | ||
defaults: | ||
_controller: 'Drupal\civiremote_case\Controller\CaseCreateController::form' | ||
options: | ||
no_cache: TRUE | ||
parameters: | ||
profile: | ||
type: string | ||
requirements: | ||
_user_is_logged_in: 'TRUE' | ||
|
||
civiremote_case.update_form: | ||
path: '/civiremote/case/{id}/update/{profile}' | ||
defaults: | ||
_controller: 'Drupal\civiremote_case\Controller\CaseUpdateController::form' | ||
options: | ||
no_cache: TRUE | ||
parameters: | ||
id: | ||
type: int | ||
profile: | ||
type: string | ||
requirements: | ||
_user_is_logged_in: 'TRUE' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
services: | ||
_defaults: | ||
autowire: true | ||
public: false # Controller classes and services directly fetched from container need to be public | ||
|
||
Drupal\civiremote_case\Api\CaseApi: | ||
class: Drupal\civiremote_case\Api\CaseApi | ||
|
||
Drupal\civiremote_case\Controller\CaseCreateController: | ||
class: Drupal\civiremote_case\Controller\CaseCreateController | ||
public: true | ||
|
||
Drupal\civiremote_case\Controller\CaseUpdateController: | ||
class: Drupal\civiremote_case\Controller\CaseUpdateController | ||
public: true | ||
|
||
Drupal\civiremote_case\Form\RequestHandler\CaseCreateFormRequestHandler: | ||
class: Drupal\civiremote_case\Form\RequestHandler\CaseCreateFormRequestHandler | ||
public: true | ||
|
||
Drupal\civiremote_case\Form\RequestHandler\CaseUpdateFormRequestHandler: | ||
class: Drupal\civiremote_case\Form\RequestHandler\CaseUpdateFormRequestHandler | ||
public: true |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,69 @@ | ||
{ | ||
"name": "custom/civiremote_case", | ||
"description": "Drupal frontend to access CiviCRM Remote Case.", | ||
"type": "drupal-custom-module", | ||
"license": "AGPL-3.0-only", | ||
"authors": [ | ||
{ | ||
"name": "SYSTOPIA GmbH", | ||
"email": "[email protected]" | ||
} | ||
], | ||
"autoload": { | ||
"psr-4": { | ||
"Drupal\\civiremote_case\\": "src/" | ||
} | ||
}, | ||
"autoload-dev": { | ||
"psr-4": { | ||
"Drupal\\Tests\\civiremote_case\\": "tests/src/" | ||
} | ||
}, | ||
"minimum-stability": "dev", | ||
"prefer-stable": true, | ||
"config": { | ||
"sort-packages": true, | ||
"allow-plugins": { | ||
"dealerdirect/phpcodesniffer-composer-installer": true, | ||
"phpstan/extension-installer": true, | ||
"php-http/discovery": false | ||
} | ||
}, | ||
"repositories": [ | ||
{ | ||
"type": "composer", | ||
"url": "https://packages.drupal.org/8" | ||
} | ||
], | ||
"require": { | ||
"php": "^8.1" | ||
}, | ||
"require-dev": { | ||
"drupal/core-dev": "^10" | ||
}, | ||
"scripts": { | ||
"composer-phpstan": [ | ||
"@composer --working-dir=tools/phpstan" | ||
], | ||
"composer-tools": [ | ||
"@composer-phpstan" | ||
], | ||
"phpcs": [ | ||
"@php vendor/bin/phpcs" | ||
], | ||
"phpcbf": [ | ||
"@php vendor/bin/phpcbf" | ||
], | ||
"phpstan": [ | ||
"@php tools/phpstan/vendor/bin/phpstan" | ||
], | ||
"phpunit": [ | ||
"@php vendor/bin/phpunit --coverage-text" | ||
], | ||
"test": [ | ||
"@phpcs", | ||
"@phpstan", | ||
"@phpunit" | ||
] | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,80 @@ | ||
<?xml version="1.0"?> | ||
<ruleset xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" name="CiviCRM - PHPStan" | ||
xsi:noNamespaceSchemaLocation="vendor/squizlabs/php_codesniffer/phpcs.xsd"> | ||
|
||
<file>src</file> | ||
|
||
<arg name="extensions" value="php"/> | ||
<arg name="cache" value=".phpcs.cache"/> | ||
<arg name="colors"/> | ||
<arg value="sp"/> | ||
|
||
<!-- Exit with code 0 if warnings, but no error occurred --> | ||
<config name="ignore_warnings_on_exit" value="true"/> | ||
|
||
<rule ref="vendor/drupal/coder/coder_sniffer/Drupal"> | ||
<!-- Don't enforce phpdoc type hint because it (might) only duplicate a PHP type hint --> | ||
<exclude name="Drupal.Commenting.FunctionComment.MissingParamComment"/> | ||
<exclude name="Drupal.Commenting.FunctionComment.MissingReturnComment"/> | ||
|
||
<!-- Don't enforce comments --> | ||
<exclude name="Drupal.Commenting.VariableComment.Missing"/> | ||
<exclude name="Drupal.Commenting.ClassComment.Missing"/> | ||
<exclude name="Drupal.Commenting.FunctionComment.Missing"/> | ||
<exclude name="Drupal.Commenting.DocComment.MissingShort"/> | ||
|
||
<!-- Allow "/** @phpstan-var ... */" --> | ||
<exclude name="Drupal.Commenting.InlineComment.DocBlock"/> | ||
|
||
<!-- False positive with license header --> | ||
<exclude name="Drupal.Commenting.FileComment.NamespaceNoFileDoc"/> | ||
</rule> | ||
|
||
<rule ref="vendor/drupal/coder/coder_sniffer/DrupalPractice"/> | ||
|
||
<rule ref="Generic.Arrays.DisallowLongArraySyntax"/> | ||
<rule ref="Generic.CodeAnalysis.EmptyStatement"> | ||
<exclude name="Generic.CodeAnalysis.EmptyStatement.DetectedCatch"/> | ||
</rule> | ||
<rule ref="Generic.CodeAnalysis.ForLoopWithTestFunctionCall"/> | ||
<rule ref="Generic.Files.OneClassPerFile"/> | ||
<rule ref="Generic.Files.OneInterfacePerFile"/> | ||
<rule ref="Generic.Files.OneObjectStructurePerFile"/> | ||
<rule ref="Generic.Files.OneTraitPerFile"/> | ||
<rule ref="Generic.Formatting.DisallowMultipleStatements"/> | ||
<rule ref="Generic.Metrics.CyclomaticComplexity"/> | ||
<rule ref="Generic.Metrics.NestingLevel"/> | ||
<rule ref="Generic.NamingConventions.AbstractClassNamePrefix"/> | ||
<rule ref="Generic.NamingConventions.InterfaceNameSuffix"/> | ||
<rule ref="Generic.NamingConventions.TraitNameSuffix"/> | ||
<rule ref="Generic.PHP.RequireStrictTypes"/> | ||
<rule ref="PSR1.Files.SideEffects"/> | ||
<rule ref="PSR12.Classes.ClassInstantiation"/> | ||
<rule ref="PSR12.Properties.ConstantVisibility"/> | ||
<rule ref="Squiz.PHP.CommentedOutCode"/> | ||
<rule ref="Squiz.PHP.GlobalKeyword"/> | ||
<rule ref="Squiz.Strings.DoubleQuoteUsage"> | ||
<exclude name="Squiz.Strings.DoubleQuoteUsage.ContainsVar"/> | ||
</rule> | ||
|
||
<!-- Lines can be 120 chars long, but never show errors --> | ||
<rule ref="Generic.Files.LineLength"> | ||
<properties> | ||
<property name="lineLimit" value="120"/> | ||
<property name="absoluteLineLimit" value="0"/> | ||
</properties> | ||
</rule> | ||
|
||
<!-- Ban some functions --> | ||
<rule ref="Generic.PHP.ForbiddenFunctions"> | ||
<properties> | ||
<property name="forbiddenFunctions" type="array"> | ||
<element key="sizeof" value="count"/> | ||
<element key="delete" value="unset"/> | ||
<element key="print" value="echo"/> | ||
<element key="is_null" value="null"/> | ||
<element key="create_function" value="null"/> | ||
</property> | ||
</properties> | ||
</rule> | ||
</ruleset> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
includes: | ||
- phpstan.neon.dist | ||
|
||
parameters: | ||
bootstrapFiles: | ||
- ci/vendor/autoload.php |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
parameters: | ||
paths: | ||
- src | ||
bootstrapFiles: | ||
- vendor/autoload.php | ||
scanDirectories: | ||
- ../civiremote_entity/src | ||
level: 9 | ||
checkTooWideReturnTypesInProtectedAndPublicMethods: true | ||
checkUninitializedProperties: true | ||
checkMissingCallableSignature: true | ||
treatPhpDocTypesAsCertain: false | ||
exceptions: | ||
check: | ||
missingCheckedExceptionInThrows: true | ||
tooWideThrowType: true | ||
checkedExceptionClasses: | ||
- \Assert\AssertionFailedException | ||
implicitThrows: false | ||
ignoreErrors: | ||
# Note paths are prefixed with ""*/" to work with inspections in PHPStorm because of: | ||
# https://youtrack.jetbrains.com/issue/WI-63891/PHPStan-ignoreErrors-configuration-isnt-working-with-inspections | ||
# Happens in classes implementing ContainerInjectionInterface::create() | ||
- '/ constructor expects [^\s]+, object(\|null)? given.$/' | ||
|
||
tmpDir: .phpstan |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
# Copy this file to phpstan.neon and replace {VENDOR_DIR} with the vendor | ||
# directory of your Drupal project. | ||
|
||
includes: | ||
- phpstan.neon.dist | ||
|
||
parameters: | ||
bootstrapFiles: | ||
- {VENDOR_DIR}/autoload.php |
Oops, something went wrong.