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

PHP 8.0 support 🚀 #4

Merged
merged 9 commits into from
Dec 3, 2020
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
14 changes: 4 additions & 10 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -1,11 +1,10 @@
language: php

php:
- 5.5.9
- 5.5
- 5.6
- 7.0
- hhvm
- 7.2
- 7.3
- 7.4
- 8.0snapshot

env:
matrix:
Expand All @@ -18,8 +17,3 @@ before_script:

script:
- vendor/bin/phpunit
- if [ "$TRAVIS_PHP_VERSION" == "5.5.9" ] || [ "$TRAVIS_PHP_VERSION" == "5.5" ] || [ "$TRAVIS_PHP_VERSION" == "5.6" ]; then vendor/bin/phpunit --coverage-clover build/logs/clover.xml; fi

after_script:
- if [ "$TRAVIS_PHP_VERSION" == "5.5.9" ] || [ "$TRAVIS_PHP_VERSION" == "5.5" ] || [ "$TRAVIS_PHP_VERSION" == "5.6" ]; then wget https://scrutinizer-ci.com/ocular.phar; fi
- if [ "$TRAVIS_PHP_VERSION" == "5.5.9" ] || [ "$TRAVIS_PHP_VERSION" == "5.5" ] || [ "$TRAVIS_PHP_VERSION" == "5.6" ]; then php ocular.phar code-coverage:upload --format=php-clover build/logs/clover.xml; fi
9 changes: 5 additions & 4 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -19,13 +19,14 @@
"Tylercd100\\Monolog\\Tests\\": "tests/"
}
},
"minimum-stability": "stable",
"minimum-stability": "dev",
"prefer-stable": true,
"require": {
"php": "^5.4|^7.0",
"monolog/monolog": "^1.11"
"php": "^7.2|^8.0",
"monolog/monolog": "^2.0"
},
"require-dev": {
"phpunit/phpunit": "^4.0|^5.0"
"phpunit/phpunit": "^8.2.3|^9.0"
},
"authors": [
{
Expand Down
2 changes: 1 addition & 1 deletion src/Handler/MailgunHandler.php
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ public function __construct($to, $subject, $from, $token, $domain, $level = Logg
/**
* {@inheritdoc}
*/
protected function send($content, array $records)
protected function send(string $content, array $records): void
{
$auth = base64_encode("api:".$this->token);

Expand Down
14 changes: 7 additions & 7 deletions tests/MailgunHandlerTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,21 +11,21 @@ class MailgunHandlerTest extends TestCase
public function testItCanBeInstantiated()
{
$handler = $this->createHandler("to@test.com", "Test subject", "from@test.com", "Token", "test.com");
$this->assertTrue(true); // Previous line doesn't thrown an exception
}

public function testItThrowsExceptionWithUnsupportedVersion()
{
$this->setExpectedException(Exception::class);
$handler = $this->createHandler("to@test.com", "Test subject", "from@test.com", "Token", "test.com", 100, true, 'api.mailgun.net', 'v0');
$this->expectException(Exception::class);
$handler = $this->createHandler("to@test.com", "Test subject", "from@test.com", "Token", "test.com", 100, true, 'api.mailgun.net', 'v0');
}

private function createHandler($to = "to@test.com",$subject = "Test subject",$from = "from@test.com",$token = "Token",$domain = "test.com", $level = Logger::CRITICAL, $bubble = true, $host = 'api.mailgun.net', $version = 'v3')
{
$constructorArgs = array($to, $subject, $from, $token, $domain, $level, $bubble, $host, $version);
$this->handler = $this->getMock(
'\Tylercd100\Monolog\Handler\MailgunHandler',
array(),
$constructorArgs
);
$this->handler = $this->getMockBuilder(MailgunHandler::class)
->setMethods([])
->setConstructorArgs($constructorArgs)
->getMock();
}
}
3 changes: 2 additions & 1 deletion tests/TestCase.php
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,9 @@
namespace Tylercd100\Monolog\Tests;

use Monolog\Logger;
use PHPUnit\Framework\TestCase as PHPUnitTestCase;

class TestCase extends \PHPUnit_Framework_TestCase
class TestCase extends PHPUnitTestCase
{
/**
* @return array Record
Expand Down