Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Significant Re-Organisation and Modernisation for 5.0 Release #94

Closed
wants to merge 68 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
68 commits
Select commit Hold shift + click to select a range
c7a17ce
Update gitignore with relevant files
gsteel Feb 16, 2022
0a7d317
Add .gitattributes so that development files are excluded from instal…
gsteel Feb 16, 2022
4bd21a1
Move/Rename existing tests
gsteel Feb 16, 2022
b2ffacb
Re-configure phpunit with a valid config for phpunit 9.x
gsteel Feb 16, 2022
bd7109e
Rename unused, example test keys file
gsteel Feb 16, 2022
62981f4
Modernise Composer Setup
gsteel Feb 16, 2022
b5a5e82
Initial configuration for phpcs and psalm
gsteel Feb 16, 2022
5370024
WIP towards cleaning up the client and swapping out Guzzle for any PS…
gsteel Feb 17, 2022
1c86bff
Updates allowed plugins
gsteel Feb 17, 2022
9f326ef
Use Diactoros for testing and unit test the RequestFailure exception
gsteel Feb 17, 2022
2e11a35
Add CI workflows for GitHub
gsteel Feb 17, 2022
47f5f63
Adds required psr interfaces for messages and factories
gsteel Feb 17, 2022
550cf82
Adds /build directory and ignores it for export
gsteel Feb 17, 2022
0e2e45a
Drop composer-unused. Recent versions are too unstable
gsteel Feb 17, 2022
f880cb7
CS Fixes and suppress unsafe instantiation for the time being
gsteel Feb 17, 2022
3eb74f1
Reformat with spaces instead of tabs
gsteel Feb 17, 2022
88d3746
Whitespace in doc blocks
gsteel Feb 17, 2022
e113555
Remove closing PHP tags
gsteel Feb 17, 2022
a2525a3
CS fix class and function braces and whitespace
gsteel Feb 17, 2022
e686ed2
Declare strict_types everywhere
gsteel Feb 17, 2022
25161ef
Low hanging fruit CS Fixes: Doc blocks and whitespace
gsteel Feb 17, 2022
b67d756
Adds types and fixes CS for various value objects and adds unit tests…
gsteel Feb 17, 2022
8750b16
Lowercase true, false and null
gsteel Feb 17, 2022
4f338e0
Use single quotes
gsteel Feb 17, 2022
53c1115
Short array syntax
gsteel Feb 17, 2022
5f2101d
Whitespace fixes
gsteel Feb 17, 2022
228e7e2
Import used functions and classes
gsteel Feb 17, 2022
05775f0
Cleans up dynamic response model and case-insensitive array
gsteel Feb 17, 2022
e314339
Update psalm baseline with fixed errors
gsteel Feb 17, 2022
b611dbc
Finish cleaning up and testing the magic array objects
gsteel Feb 17, 2022
7462358
Allow 'PostmarkException' to be a valid class name
gsteel Feb 17, 2022
348e18c
Kill off usage and deprecate concrete postmark exception
gsteel Feb 17, 2022
8506f5b
Clean up and test the attachment value object
gsteel Feb 17, 2022
47d5fc0
Removes Guzzle from direct dependencies
gsteel Feb 17, 2022
d811291
Unit test basic behaviour of all the webhook accessors
gsteel Feb 17, 2022
6099e07
Delete Circle CI Config
gsteel Feb 17, 2022
c64bf88
Extracts PSR-17/18 discovery integration and unit tests functionality
gsteel Feb 17, 2022
6d375c0
Makes the constructor final in the abstract class and removes the con…
gsteel Feb 17, 2022
e5aa26b
CS fix the stub and add throws annotations to the discovery trait
gsteel Feb 17, 2022
540338d
Move the base client to a subdirectory and add unit test
gsteel Feb 17, 2022
c97d0ed
Add return type hints to all methods
gsteel Feb 17, 2022
f1ae7f5
Introduce headers value object, start splitting up the client behavio…
gsteel Feb 17, 2022
1e38ac7
CS Fixes
gsteel Feb 17, 2022
5d6406f
Finish splitting out the regular client behaviour and update the psal…
gsteel Feb 17, 2022
4bc257d
Reformat Admin Client
gsteel Feb 17, 2022
950bdb7
Initial WIP on unit tests for the client
gsteel Feb 17, 2022
82a4e44
More client tests
gsteel Feb 17, 2022
1baa644
Deletes legacy tests
gsteel Feb 17, 2022
6a68b31
Add failing test - array_filter removes empty non-nulls in `processRe…
gsteel Feb 18, 2022
19deddc
Reorganise Mock Client Based Tests
gsteel Feb 18, 2022
c8e2637
Add tests for inbound message related methods
gsteel Feb 18, 2022
4f00f42
Fix invalid covers annotation
gsteel Feb 18, 2022
4c78bfb
Message Stream related tests
gsteel Feb 18, 2022
99da70e
Add unit tests for outbound related methods
gsteel Feb 18, 2022
9452330
Remove unused use
gsteel Feb 18, 2022
54077d5
Add unit tests for Suppression related methods
gsteel Feb 18, 2022
3f292b8
Add assertions that the last request will be present in the exception
gsteel Feb 18, 2022
1276036
GET and DELETE templates: parameter can be a string or an int
gsteel Feb 18, 2022
93b2ecf
Tighten up and normalise template id type
gsteel Feb 18, 2022
0b20dc6
Template related tests and remove type hints for template model
gsteel Feb 18, 2022
8054c71
Adds tests for webhook related methods
gsteel Feb 18, 2022
564785c
Remove unused use
gsteel Feb 18, 2022
795ff75
Add tests for the admin client
gsteel Feb 18, 2022
55a36b1
Testing Keys json file is no longer required
gsteel Feb 18, 2022
d84b9e7
The original Postmark Exception is now unused
gsteel Feb 18, 2022
5622b11
Remove redundant default value
gsteel Feb 18, 2022
35db908
Add failing test case for CaseInsensitiveArray on 8.1 and make sure t…
gsteel Feb 18, 2022
7efa718
Fix 8.1 incompatibility with ReturnTypeWillChange attribute
gsteel Feb 18, 2022
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
55 changes: 0 additions & 55 deletions .circleci/config.yml

This file was deleted.

11 changes: 11 additions & 0 deletions .gitattributes
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
/.gitattributes export-ignore
/.github/ export-ignore
/.circleci/ export-ignore
/.gitignore export-ignore
/.laminas-ci.json export-ignore
/build export-ignore
/phpcs.xml export-ignore
/phpunit.xml.dist export-ignore
/psalm.xml export-ignore
/psalm-baseline.xml export-ignore
/tests/ export-ignore
10 changes: 10 additions & 0 deletions .github/dependabot.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
version: 2
updates:
- package-ecosystem: "composer"
directory: "/"
schedule:
interval: "daily"
- package-ecosystem: "github-actions"
directory: "/"
schedule:
interval: "daily"
123 changes: 123 additions & 0 deletions .github/workflows/continuous-integration.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,123 @@
name: "Continuous Integration"
on:
push:
branches:
- main
- master
pull_request:

env:
php_extensions: curl,pcov,json
default_php: 7.4
stable_php: 8.1

jobs:

cs-check:
name: CS Checks
runs-on: ubuntu-latest
steps:
- name: "Checkout Code"
uses: actions/checkout@v2

- name: "Setup PHP"
uses: shivammathur/setup-php@v2
with:
php-version: ${{ env.default_php }}
extensions: ${{ env.php_extensions }}
tools: cs2pr

- uses: "ramsey/composer-install@2.1.0"

- name: "Check CS"
run: vendor/bin/phpcs --report=checkstyle -q | cs2pr

psalm:
name: Psalm Static Analysis
runs-on: ubuntu-latest
steps:
- name: "Checkout Code"
uses: actions/checkout@v2

- name: "Setup PHP"
if: hashFiles('psalm.xml') != ''
uses: shivammathur/setup-php@v2
with:
php-version: ${{ env.default_php }}
extensions: ${{ env.php_extensions }}
tools: cs2pr

- uses: "ramsey/composer-install@2.1.0"
if: hashFiles('psalm.xml') != ''

- name: "Psalm"
if: hashFiles('psalm.xml') != ''
run: vendor/bin/psalm --shepherd --stats --output-format=github

run-unit-tests:

name: PHPUnit on ${{ matrix.php-version }}
runs-on: ubuntu-latest

strategy:
fail-fast: false
matrix:
php-version: ['7.4', '8.0', '8.1', '8.2']
include:
- php-version: '8.2'
composer-options: "--ignore-platform-reqs"

steps:
- name: "Checkout Code"
uses: actions/checkout@v2

- name: "Setup PHP"
uses: shivammathur/setup-php@v2
with:
php-version: ${{ matrix.php-version }}
extensions: ${{ env.php_extensions }}
coverage: pcov
ini-values: pcov.enabled=1

- uses: "ramsey/composer-install@2.1.0"
with:
composer-options: "${{ matrix.composer-options }}"

- name: "Run Tests"
run: php ./vendor/bin/phpunit --coverage-clover=coverage.xml

- name: "Upload Coverage to CodeCov"
uses: codecov/codecov-action@v2.1.0
env:
PHP_VERSION: ${{ matrix.php-version }}
with:
token: ${{ secrets.CODECOV_TOKEN }}
file: ./coverage.xml
fail_ci_if_error: false
env_vars: PHP_VERSION

composer-require-checker:
name: "Check for missing dependencies"
runs-on: "ubuntu-latest"

steps:
- name: "Checkout"
uses: actions/checkout@v2

- name: "Install PHP"
uses: shivammathur/setup-php@v2
with:
php-version: ${{ env.stable_php }}
ini-values: memory_limit=-1
extensions: ${{ env.php_extensions }}

- uses: "ramsey/composer-install@2.1.0"

- name: "Set global composer bin-dir"
run: composer global config bin-dir /usr/local/bin

- name: "Install require checker"
run: composer global require -W maglnet/composer-require-checker

- name: "Check"
run: /usr/local/bin/composer-require-checker check
24 changes: 24 additions & 0 deletions .github/workflows/merge-dependabot-upgrades.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
# See https://github.com/ridedott/merge-me-action/
# This workflow automates merges from patches sent by Dependabot, and
# only by dependabot, once the other CI workflows pass
name: Auto-merge Dependabot PRs

on:
workflow_run:
types:
- completed
workflows:
- "Continuous Integration"

jobs:
merge-me:
name: Auto-merge Dependabot PRs
runs-on: ubuntu-latest
steps:
- name: Auto-Merge
if: ${{ github.event.workflow_run.conclusion == 'success' }}
uses: ridedott/merge-me-action@v2.9.110
with:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
MERGE_METHOD: MERGE
PRESET: DEPENDABOT_MINOR
10 changes: 1 addition & 9 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,10 +1,2 @@
.DS_Store
oracle.sqlite
.phpintel
test_keys.json
testing_keys.json
/vendor
/build
docs/_build
*.swp
/composer.lock
phpunit.xml
2 changes: 2 additions & 0 deletions build/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
*
!.gitignore
55 changes: 40 additions & 15 deletions composer.json
Original file line number Diff line number Diff line change
@@ -1,30 +1,55 @@
{
"repositories": [{
"type": "composer",
"url": "https://packagist.org"
}],
"name": "wildbit/postmark-php",
"license": "MIT",
"description": "The officially supported client for Postmark (http://postmarkapp.com)",
"description": "The officially supported client for Postmark (https://postmarkapp.com)",
"config": {
"sort-packages": true,
"platform": {
"php": "7.4"
},
"allow-plugins": {
"dealerdirect/phpcodesniffer-composer-installer": true,
"composer/package-versions-deprecated": true
}
},
"require": {
"php": ">=7.0.0",
"guzzlehttp/guzzle": "^6.0|^7.0"
"php": "~7.4 || ~8.0 || ~8.1",
"ext-json": "*",
"fig/http-message-util": "^1.1",
"php-http/discovery": "^1.14",
"psr/http-client": "^1.0",
"psr/http-factory": "^1.0",
"psr/http-message": "^1.0"
},
"require-dev": {
"phpunit/phpunit": "^6.0.0"
"doctrine/coding-standard": "^9.0",
"laminas/laminas-diactoros": "^2.8",
"php-http/curl-client": "^2.2",
"php-http/mock-client": "^1.5",
"phpunit/phpunit": "^9.5",
"psalm/plugin-phpunit": "^0.16.1",
"squizlabs/php_codesniffer": "^3.6",
"vimeo/psalm": "^4.20"
},
"autoload": {
"psr-0": {
"Postmark\\": "src/"
"psr-4": {
"Postmark\\": "src/Postmark/"
}
},
"autoload-dev": {
"classmap": [
"src/",
"tests/"
]
"psr-4": {
"Postmark\\Tests\\Unit\\": "tests/Unit/"
}
},
"scripts": {
"test": "phpunit"
"check": [
"@cs-check",
"@test"
],
"cs-check": "phpcs",
"cs-fix": "phpcbf",
"static-analysis": "psalm --shepherd --stats",
"test": "phpunit --colors=always",
"test-coverage": "phpunit --colors=always --coverage-clover clover.xml"
}
}