-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #3 from bedita/feat/unit-tests
Add unit tests
- Loading branch information
Showing
21 changed files
with
2,065 additions
and
57 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
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,146 @@ | ||
name: 'Run tests' | ||
|
||
on: | ||
pull_request: | ||
paths: | ||
- '**/*.php' | ||
- '.github/workflows/*' | ||
push: | ||
paths: | ||
- '**/*.php' | ||
- '.github/workflows/*' | ||
|
||
jobs: | ||
cs: | ||
name: 'Check coding style' | ||
runs-on: 'ubuntu-20.04' | ||
|
||
steps: | ||
- name: 'Checkout current revision' | ||
uses: 'actions/checkout@v2' | ||
|
||
- name: 'Setup PHP' | ||
uses: 'shivammathur/setup-php@v2' | ||
with: | ||
php-version: '7.4' | ||
tools: 'composer' | ||
extensions: 'mbstring, intl' | ||
coverage: 'none' | ||
|
||
- name: 'Discover Composer cache directory' | ||
id: 'cachedir' | ||
run: 'echo "::set-output name=path::$(composer global config cache-dir)"' | ||
|
||
- name: 'Share Composer cache across runs' | ||
uses: 'actions/cache@v2' | ||
with: | ||
path: '${{ steps.cachedir.outputs.path }}' | ||
key: "composer-${{ github.job }}-${{ hashFiles('**/composer.json') }}" | ||
restore-keys: | | ||
composer-${{ github.job }}- | ||
composer- | ||
- name: 'Install dependencies with Composer' | ||
run: 'composer install --prefer-dist --no-interaction' | ||
|
||
- name: 'Run PHP CodeSniffer' | ||
run: 'vendor/bin/phpcs -n' | ||
|
||
stan: | ||
name: 'Static code analyzer' | ||
runs-on: 'ubuntu-20.04' | ||
continue-on-error: true | ||
|
||
steps: | ||
- name: 'Checkout current revision' | ||
uses: 'actions/checkout@v2' | ||
|
||
- name: 'Setup PHP' | ||
uses: 'shivammathur/setup-php@v2' | ||
with: | ||
php-version: '7.4' | ||
tools: 'composer' | ||
extensions: 'mbstring, intl' | ||
coverage: 'none' | ||
|
||
- name: 'Discover Composer cache directory' | ||
id: 'cachedir' | ||
run: 'echo "::set-output name=path::$(composer global config cache-dir)"' | ||
|
||
- name: 'Share Composer cache across runs' | ||
uses: 'actions/cache@v2' | ||
with: | ||
path: '${{ steps.cachedir.outputs.path }}' | ||
key: "composer-${{ github.job }}-${{ hashFiles('**/composer.json') }}" | ||
restore-keys: | | ||
composer-${{ github.job }}- | ||
composer- | ||
- name: 'Install dependencies with Composer' | ||
run: 'composer install --prefer-dist --no-interaction' | ||
|
||
- name: 'Run PHP STAN' | ||
run: 'vendor/bin/phpstan analyse --no-progress --error-format=github' | ||
|
||
unit: | ||
name: 'Run unit tests' | ||
if: "!contains(github.event.commits[0].message, '[skip ci]') && !contains(github.event.commits[0].message, '[ci skip]')" | ||
runs-on: 'ubuntu-20.04' | ||
|
||
strategy: | ||
fail-fast: false | ||
matrix: | ||
php: | ||
- '7.2' | ||
- '7.3' | ||
- '7.4' | ||
|
||
env: | ||
PHP_VERSION: '${{ matrix.php }}' | ||
|
||
steps: | ||
- name: 'Checkout current revision' | ||
uses: 'actions/checkout@v2' | ||
|
||
- name: 'Setup PHP' | ||
uses: 'shivammathur/setup-php@v2' | ||
with: | ||
php-version: '${{ matrix.php }}' | ||
tools: 'composer' | ||
extensions: 'mbstring, intl' | ||
coverage: 'none' # Using `phpdbg` | ||
|
||
- name: 'Discover Composer cache directory' | ||
id: 'cachedir' | ||
run: 'echo "::set-output name=path::$(composer global config cache-dir)"' | ||
|
||
- name: 'Share Composer cache across runs' | ||
uses: 'actions/cache@v2' | ||
with: | ||
path: '${{ steps.cachedir.outputs.path }}' | ||
key: "composer-${{ matrix.php }}-${{ hashFiles('**/composer.json') }}" | ||
restore-keys: | | ||
composer-${{ matrix.php }}- | ||
composer- | ||
- name: 'Install dependencies with Composer' | ||
run: 'composer install --prefer-dist --no-interaction' | ||
|
||
- name: 'Dump Composer autoloader' | ||
run: 'composer dump-autoload --classmap-authoritative --no-cache' | ||
|
||
- name: 'Run PHPUnit' | ||
run: 'phpdbg -qrr vendor/bin/phpunit --coverage-clover=clover.xml' | ||
|
||
- name: 'Export coverage results' | ||
uses: 'codecov/codecov-action@v1' | ||
with: | ||
file: './clover.xml' | ||
env_vars: PHP_VERSION | ||
|
||
- name: 'Archive code coverage results' | ||
uses: 'actions/upload-artifact@v2' | ||
with: | ||
name: 'PHP ${{ matrix.php }}' | ||
path: 'clover.xml' | ||
|
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 |
---|---|---|
@@ -1,2 +1,5 @@ | ||
/composer.lock | ||
/phpcs.xml | ||
/phpstan.neon | ||
/phpunit.xml | ||
/vendor |
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 |
---|---|---|
@@ -1,15 +1,23 @@ | ||
AWS integrations plugin for BEdita 4 | ||
==================================== | ||
# AWS integrations plugin for BEdita 4 | ||
 | ||
[](https://codecov.io/gh/bedita/aws) | ||
|
||
This plugin includes a few useful integrations for BEdita 4, such as: | ||
|
||
- S3 (storage) | ||
- SES (mailer) | ||
- SNS (mailer, for SMS) | ||
|
||
Installation | ||
------------ | ||
## Installation | ||
|
||
Run this command to add this package to your application's dependencies: | ||
|
||
```console | ||
$ composer require bedita/aws | ||
``` | ||
|
||
Then, in your `Application::bootstrap()` method, add: | ||
|
||
```php | ||
$this->addPlugin('BEdita/AWS'); | ||
``` |
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
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,12 @@ | ||
<?xml version="1.0"?> | ||
<ruleset name="App"> | ||
<file>./src</file> | ||
<file>./tests</file> | ||
|
||
<arg name="colors"/> | ||
<arg value="p"/> | ||
|
||
<config name="installed_paths" value="../../cakephp/cakephp-codesniffer"/> | ||
|
||
<rule ref="CakePHP"/> | ||
</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,8 @@ | ||
parameters: | ||
bootstrapFiles: | ||
- tests/bootstrap.php | ||
paths: | ||
- src | ||
- tests | ||
level: 8 | ||
checkMissingIterableValueType: false |
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,41 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
<!-- | ||
~ BEdita, API-first content management framework | ||
~ Copyright 2022 Atlas Srl, Chialab Srl | ||
~ | ||
~ This file is part of BEdita: you can redistribute it and/or modify | ||
~ it under the terms of the GNU Lesser General Public License as published | ||
~ by the Free Software Foundation, either version 3 of the License, or | ||
~ (at your option) any later version. | ||
~ | ||
~ See LICENSE.LGPL or <http://gnu.org/licenses/lgpl-3.0.html> for more details. | ||
--> | ||
|
||
<phpunit colors="true" processIsolation="false" stopOnFailure="false" bootstrap="tests/bootstrap.php"> | ||
<php> | ||
<ini name="memory_limit" value="-1"/> | ||
<ini name="apc.enable_cli" value="1"/> | ||
</php> | ||
|
||
<!-- Add any additional test suites you want to run here --> | ||
<testsuites> | ||
<testsuite name="BEdita/AWS"> | ||
<directory>tests/TestCase/</directory> | ||
</testsuite> | ||
</testsuites> | ||
|
||
<!-- Setup a listener for fixtures --> | ||
<listeners> | ||
<listener class="Cake\TestSuite\Fixture\FixtureInjector"> | ||
<arguments> | ||
<object class="Cake\TestSuite\Fixture\FixtureManager"/> | ||
</arguments> | ||
</listener> | ||
</listeners> | ||
|
||
<filter> | ||
<whitelist> | ||
<directory suffix=".php">src/</directory> | ||
</whitelist> | ||
</filter> | ||
</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
Oops, something went wrong.