Skip to content

Commit

Permalink
Upgrade to PHP 8.1 (#14)
Browse files Browse the repository at this point in the history
* Updated PHP requirements to >= 8.0

* Updated Codeception to ^5

* Enabled `SecureSocketCest::sendSMTPMessageOverSecureSocket` since it is functional, but added a stopgap in case SSL is not configured correctly since the actual error message is garbled

* Rewrote the development guidelines

* Removed Travis and added Github Actions
  • Loading branch information
vortrixs authored Aug 24, 2022
1 parent 2333b01 commit 92f2ce0
Show file tree
Hide file tree
Showing 25 changed files with 497 additions and 3,051 deletions.
34 changes: 34 additions & 0 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
name: Codeception tests

on: [push]

jobs:
build:
name: ${{matrix.operating-system}}, PHP ${{ matrix.php }}

runs-on: ${{ matrix.operating-system }}

strategy:
matrix:
operating-system: [ ubuntu-latest, ubuntu-20.04 ]
php: [ '8.0', '8.1' ]

steps:
- uses: actions/checkout@master

- name: Setup PHP
uses: nanasess/setup-php@master
with:
php-version: ${{ matrix.php }}

- name: Install dependencies
run: composer install

- name: Start smtp-sink
run: |
sudo apt-get update -qq
sudo apt-get install -y -qq postfix
smtp-sink -d "%d.%H.%M.%S" localhost:2500 1000 &
- name: Run tests
run: php vendor/bin/codecept run
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,5 @@
/tests/_output
/tests/_support/_generated
/tests/*.suite.yml
/codeception.yml
!/tests/unit.suite.yml
composer.lock
2 changes: 0 additions & 2 deletions .scrutinizer.yml

This file was deleted.

11 changes: 3 additions & 8 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -1,9 +1,8 @@
language: php

php:
- 7.1
- 7.2
- 7.3
- 8.0
- 8.1

before_script:
- 'composer update --prefer-source'
Expand All @@ -13,8 +12,4 @@ before_install:
- sudo apt-get install -y -qq postfix
- smtp-sink -d "%d.%H.%M.%S" localhost:2500 1000 &

script: if [ $(phpenv version-name) = "7.0" ]; then vendor/bin/codecept run --coverage-xml; else vendor/bin/codecept run; fi

after_script:
- if [ $(phpenv version-name) = "7.0" ]; then wget https://scrutinizer-ci.com/ocular.phar; fi
- if [ $(phpenv version-name) = "7.0" ]; then php ocular.phar code-coverage:upload --format=php-clover tests/_output/coverage.xml; fi
script: vendor/bin/codecept run
12 changes: 7 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
kodus/mail
==========

[![PHP Version](https://img.shields.io/badge/php-7.1%2B-blue.svg)](https://packagist.org/packages/kodus/mail)
[![PHP Version](https://img.shields.io/badge/php-8.0%2B-blue.svg)](https://packagist.org/packages/kodus/mail)
[![Build Status](https://travis-ci.org/kodus/mail.svg?branch=master)](https://travis-ci.org/kodus/mail)
[![Code Coverage](https://scrutinizer-ci.com/g/kodus/mail/badges/coverage.png?b=master)](https://scrutinizer-ci.com/g/kodus/mail/?branch=master)
[![Scrutinizer Code Quality](https://scrutinizer-ci.com/g/kodus/mail/badges/quality-score.png?b=master)](https://scrutinizer-ci.com/g/kodus/mail/?branch=master)
Expand Down Expand Up @@ -119,15 +119,17 @@ a fake mail-service for testing and development, enabling you to see Messages th

To run the integration tests, you will need to set up a local SMTP server for testing.

On Windows, try [Papercut](https://papercut.codeplex.com/) or [SMTP4Dev](http://smtp4dev.codeplex.com/).
To make sure `SecureSocketCest` passes your SMTP server also needs to have TLS support with a SSL certificate.

On Linux, you will likely just have to set up an actual, local SMTP daemon. (see `.travis.yml` for an
example of installing and starting `smtp-sink` which comes with `postfix`.)
It is recommended to use [smtp4dev](https://github.com/rnwood/smtp4dev) since it has cross-platform support and can generate its own self-signed SSL certificate.

When configuring smtp4dev make sure to set `TlsMode` to `StartTls`, this ensures that TLS is only used when the client asks for it, setting it to `ImplicitTls` will likely make all non-TLS tests fail.

When starting the smtp4dev server it should tell you where the generated certificate is stored, you'll need to add this to your systems trusted CA store.

You may need to copy `integration.suite.dist.yml` to `integration.suite.yml` to customize the
SMTP host-name, port-number, etc.


<a name="objectives"></a>
## Objectives

Expand Down
4 changes: 1 addition & 3 deletions codeception.dist.yml → codeception.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,13 +5,11 @@ coverage:
- src/*
paths:
tests: tests
log: tests/_output
output: tests/_output
data: tests/_data
support: tests/_support
envs: tests/_envs
settings:
bootstrap: _bootstrap.php
colors: false
memory_limit: 1024M
extensions:
enabled:
Expand Down
5 changes: 3 additions & 2 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,11 +12,12 @@
"minimum-stability": "dev",
"prefer-stable": true,
"require": {
"php": ">= 7.1",
"php": ">= 8.0",
"psr/log": "^1"
},
"require-dev": {
"codeception/codeception": "^2"
"codeception/codeception": "^5",
"codeception/module-asserts": "^3.0"
},
"autoload": {
"psr-4": {
Expand Down
Loading

0 comments on commit 92f2ce0

Please sign in to comment.