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

[Part 1] Modernise package and tests #91

Merged
merged 9 commits into from
Apr 24, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 10 additions & 0 deletions .github/PULL_REQUEST_TEMPLATE.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
## Description
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Shamelessly stolen from the monoliths repo.

<!-- Add anything here which you think will help reviewers and/or testers figure out the purpose of your PR or how it should work. -->

## Screenshots
<!-- Adding screenshots of your PR helps demonstrate what changes you've made. -->

## Testing Notes
<!-- What does someone who's testing this need to know about your PR? How will they know it's working? What areas might be risky or require special attention? Can you point to documentation on how someone might go about testing this PR? -->

## Deployment Notes
14 changes: 10 additions & 4 deletions .github/workflows/php.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,12 @@
name: PHP Composer

on: [push, pull_request]
on:
push:
branches:
- main

pull_request:
types: [ opened, synchronize, reopened ]
Comment on lines +3 to +9
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We were running the CI on push and PR, which didn't make much sense.


jobs:
build:
Expand All @@ -12,7 +18,7 @@ jobs:

- uses: shivammathur/[email protected]
with:
php-version: '7.3'
php-version: '8.2'

- name: Validate composer.json and composer.lock
run: composer validate --strict
Expand All @@ -27,13 +33,13 @@ jobs:
${{ runner.os }}-php-

- name: Install dependencies
run: composer install --prefer-dist --no-progress --no-suggest
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This options deprecated

run: composer install --prefer-dist --no-progress

# Add a test script to composer.json, for instance: "test": "vendor/bin/phpunit"
# Docs: https://getcomposer.org/doc/articles/scripts.md

- name: Run test suite
run: composer run-script test
run: composer test
env: # Set the secrets as environment variables
EMARSYS_API_USERNAME: ${{ secrets.EMARSYS_API_USERNAME }}
EMARSYS_API_SECRET: ${{ secrets.EMARSYS_API_SECRET }}
Comment on lines 43 to 45
Copy link
Author

@ryanmab ryanmab Apr 24, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'd prefer our integration tests didn't use Emarsys directly (I didn't realise it did until now).

Not on my agenda for today, but will probably change it to a mock server of some sort.

1 change: 0 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
/vendor/
/composer.lock
.idea/
composer.phar

Expand Down
2 changes: 1 addition & 1 deletion CODEOWNERS
Original file line number Diff line number Diff line change
@@ -1 +1 @@
* @mention-me/integrations
* @mention-me/partnerships
23 changes: 17 additions & 6 deletions composer.json
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
{
"name": "mention-me/emarsys",
"description": "Emarsys RestFull API client",
"description": "Emarsys API client",
"require": {
"php": ">=7.3",
"php": "^8.2",
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Given tests are passing, and we're running this in a PHP 8.2 env (the platform) I think we're fine.

"psr/http-client": "^1.0.1",
"ext-json": "*"
},
Expand All @@ -12,9 +12,21 @@
"guzzlehttp/guzzle": "^7.0.1",
"http-interop/http-factory-guzzle": "^1.0.0"
},
"minimum-stability": "stable",
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Bumped to stable - makes me feel much better.

"config": {
"allow-plugins": {
"php-http/discovery": true
}
},
"autoload": {
"psr-0": {
"Snowcap\\Emarsys": "src/"
"psr-4": {
"Snowcap\\Emarsys\\": "src/"
}
},
"autoload-dev": {
"psr-4": {
"Snowcap\\Emarsys\\Tests\\Unit\\": "tests/Unit/Suites/",
"Snowcap\\Emarsys\\Tests\\Integration\\": "tests/Integration/Suites/"
}
},
Copy link
Author

@ryanmab ryanmab Apr 24, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

PHPStorm was unhappy with the namespaces. This should fix them. I moved us to PSR-4, which is why the src directory is now root instead of src/Snowcap/Emarsys/

"scripts": {
Expand All @@ -30,6 +42,5 @@
"name": "Alex Oanea",
"email": "[email protected]"
}
],
"minimum-stability": "dev"
]
}
Loading