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

Add PHP 8.0 support #117

Merged
merged 6 commits into from
Jan 26, 2021
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
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
.phpunit.result.cache
/clover.xml
/composer.lock
/coveralls-upload.json
Expand Down
20 changes: 11 additions & 9 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,26 +12,28 @@ env:
matrix:
fast_finish: true
include:
- php: 7.1
- php: 7.3
env:
- DEPS=lowest
- php: 7.1
- php: 7.3
env:
- DEPS=latest
- CS_CHECK=true
- TEST_COVERAGE=true
- php: 7.2
- php: 7.4
env:
- DEPS=lowest
- php: 7.2
- php: 7.4
env:
- DEPS=latest
- php: 7.3
- CS_CHECK=true
- TEST_COVERAGE=true
- php: 8.0
env:
- DEPS=latest
- php: 7.4
- DEPS=lowest
- COMPOSER_ARGS="--no-interaction --ignore-platform-reqs"
Ocramius marked this conversation as resolved.
Show resolved Hide resolved
- php: 8.0
env:
- DEPS=latest
- COMPOSER_ARGS="--no-interaction --ignore-platform-reqs"
Ocramius marked this conversation as resolved.
Show resolved Hide resolved

before_install:
- if [[ $TEST_COVERAGE != 'true' ]]; then phpenv config-rm xdebug.ini || return 0 ; fi
Expand Down
6 changes: 3 additions & 3 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@
}
},
"require": {
"php": "^7.1",
"php": "^7.3 || ~8.0.0",
"ext-iconv": "*",
"laminas/laminas-loader": "^2.5",
"laminas/laminas-mime": "^2.5",
Expand All @@ -36,10 +36,10 @@
},
"require-dev": {
"laminas/laminas-coding-standard": "~1.0.0",
"laminas/laminas-config": "^2.6",
"laminas/laminas-config": "^3.4",
"laminas/laminas-crypt": "^2.6 || ^3.0",
"laminas/laminas-servicemanager": "^3.2.1",
"phpunit/phpunit": "^7.5.20"
"phpunit/phpunit": "^9.3"
},
"suggest": {
"laminas/laminas-crypt": "Crammd5 support in SMTP Auth",
Expand Down
10 changes: 5 additions & 5 deletions phpunit.xml.dist
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<phpunit xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:noNamespaceSchemaLocation="./vendor/phpunit/phpunit/phpunit.xsd"
xsi:noNamespaceSchemaLocation="vendor/phpunit/phpunit/phpunit.xsd"
bootstrap="./vendor/autoload.php"
colors="true">
<testsuites>
Expand All @@ -15,11 +15,11 @@
</exclude>
</groups>

<filter>
<whitelist addUncoveredFilesFromWhitelist="true">
<coverage includeUncoveredFiles="true">
<include>
<directory suffix=".php">./src</directory>
</whitelist>
</filter>
</include>
</coverage>

<php>
<ini name="date.timezone" value="UTC"/>
Expand Down
2 changes: 1 addition & 1 deletion test/Header/ContentTransferEncodingTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,7 @@ public function testProvidingParametersIntroducesHeaderFolding(): void
$header->setTransferEncoding('quoted-printable');
$string = $header->toString();

$this->assertContains("Content-Transfer-Encoding: quoted-printable", $string);
$this->assertStringContainsString("Content-Transfer-Encoding: quoted-printable", $string);
}

/**
Expand Down
26 changes: 13 additions & 13 deletions test/Header/GenericHeaderTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -92,8 +92,8 @@ public function testCRLFsequencesAreEncodedOnToString($fieldValue): void
$header->setFieldValue($fieldValue);

$serialized = $header->toString();
$this->assertNotContains("\n", $serialized);
$this->assertNotContains("\r", $serialized);
$this->assertStringNotContainsString("\n", $serialized);
$this->assertStringNotContainsString("\r", $serialized);
}

/**
Expand Down Expand Up @@ -196,50 +196,50 @@ public function testChangeEncodingToAsciiNotAllowedWhenHeaderValueContainsUtf8Ch
$subject = new GenericHeader();
$subject->setFieldValue('Accents òàùèéì');

self::assertSame('UTF-8', $subject->getEncoding());
$this->assertSame('UTF-8', $subject->getEncoding());

$subject->setEncoding('ASCII');
self::assertSame('UTF-8', $subject->getEncoding());
$this->assertSame('UTF-8', $subject->getEncoding());
}

public function testChangeEncodingBackToAscii(): void
{
$subject = new GenericHeader('X-Test');
$subject->setFieldValue('test');

self::assertSame('ASCII', $subject->getEncoding());
$this->assertSame('ASCII', $subject->getEncoding());

$subject->setEncoding('UTF-8');
self::assertSame('UTF-8', $subject->getEncoding());
$this->assertSame('UTF-8', $subject->getEncoding());

$subject->setEncoding('ASCII');
self::assertSame('ASCII', $subject->getEncoding());
$this->assertSame('ASCII', $subject->getEncoding());
}

public function testSetNullEncoding(): void
{
$subject = GenericHeader::fromString('X-Test: test');
self::assertSame('ASCII', $subject->getEncoding());
$this->assertSame('ASCII', $subject->getEncoding());

$subject->setEncoding(null);
self::assertSame('ASCII', $subject->getEncoding());
$this->assertSame('ASCII', $subject->getEncoding());
}

public function testSettingFieldValueCanChangeEncoding(): void
{
$subject = GenericHeader::fromString('X-Test: test');
self::assertSame('ASCII', $subject->getEncoding());
$this->assertSame('ASCII', $subject->getEncoding());

$subject->setFieldValue('Accents òàùèéì');
self::assertSame('UTF-8', $subject->getEncoding());
$this->assertSame('UTF-8', $subject->getEncoding());
}

public function testSettingTheSameEncoding(): void
{
$subject = GenericHeader::fromString('X-Test: test');
self::assertSame('ASCII', $subject->getEncoding());
$this->assertSame('ASCII', $subject->getEncoding());

$subject->setEncoding('ASCII');
self::assertSame('ASCII', $subject->getEncoding());
$this->assertSame('ASCII', $subject->getEncoding());
}
}
4 changes: 2 additions & 2 deletions test/Header/MessageIdTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ public function testAutoGeneration(): void
$messageid = new Header\MessageId();
$messageid->setId();

$this->assertContains('@', $messageid->getFieldValue());
$this->assertStringContainsString('@', $messageid->getFieldValue());
}

public function testAutoGenerationWithServerVars(): void
Expand All @@ -46,7 +46,7 @@ public function testAutoGenerationWithServerVars(): void
$messageid = new Header\MessageId();
$messageid->setId();

$this->assertContains('@server-name.test', $messageid->getFieldValue());
$this->assertStringContainsString('@server-name.test', $messageid->getFieldValue());
$_SERVER = $serverBeforeTest;
}

Expand Down
22 changes: 11 additions & 11 deletions test/Header/SubjectTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -135,50 +135,50 @@ public function testChangeEncodingToAsciiNotAllowedWhenSubjectContainsUtf8Charac
$subject = new Header\Subject();
$subject->setSubject('Accents òàùèéì');

self::assertSame('UTF-8', $subject->getEncoding());
$this->assertSame('UTF-8', $subject->getEncoding());

$subject->setEncoding('ASCII');
self::assertSame('UTF-8', $subject->getEncoding());
$this->assertSame('UTF-8', $subject->getEncoding());
}

public function testChangeEncodingBackToAscii(): void
{
$subject = new Header\Subject();
$subject->setSubject('test');

self::assertSame('ASCII', $subject->getEncoding());
$this->assertSame('ASCII', $subject->getEncoding());

$subject->setEncoding('UTF-8');
self::assertSame('UTF-8', $subject->getEncoding());
$this->assertSame('UTF-8', $subject->getEncoding());

$subject->setEncoding('ASCII');
self::assertSame('ASCII', $subject->getEncoding());
$this->assertSame('ASCII', $subject->getEncoding());
}

public function testSetNullEncoding(): void
{
$subject = Header\Subject::fromString('Subject: test');
self::assertSame('ASCII', $subject->getEncoding());
$this->assertSame('ASCII', $subject->getEncoding());

$subject->setEncoding(null);
self::assertSame('ASCII', $subject->getEncoding());
$this->assertSame('ASCII', $subject->getEncoding());
}

public function testSettingSubjectCanChangeEncoding(): void
{
$subject = Header\Subject::fromString('Subject: test');
self::assertSame('ASCII', $subject->getEncoding());
$this->assertSame('ASCII', $subject->getEncoding());

$subject->setSubject('Accents òàùèéì');
self::assertSame('UTF-8', $subject->getEncoding());
$this->assertSame('UTF-8', $subject->getEncoding());
}

public function testSettingTheSameEncoding(): void
{
$subject = Header\Subject::fromString('Subject: test');
self::assertSame('ASCII', $subject->getEncoding());
$this->assertSame('ASCII', $subject->getEncoding());

$subject->setEncoding('ASCII');
self::assertSame('ASCII', $subject->getEncoding());
$this->assertSame('ASCII', $subject->getEncoding());
}
}
8 changes: 4 additions & 4 deletions test/HeadersTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -606,7 +606,7 @@ public function testGetPluginClassLoaderEmitsDeprecationNotice(): void
$this->setDeprecationErrorHandler();
$headers = new Mail\Headers();

$this->expectException(Deprecated::class);
$this->expectDeprecation();
$this->expectExceptionMessage('getPluginClassLoader is deprecated');
$headers->getPluginClassLoader();
}
Expand All @@ -618,9 +618,9 @@ public function testSetPluginClassLoaderEmitsDeprecationNotice(): void
{
$this->setDeprecationErrorHandler();
$headers = new Mail\Headers();
$loader = $this->prophesize(PluginClassLocator::class)->reveal();
$loader = $this->createMock(PluginClassLocator::class);

$this->expectException(Deprecated::class);
$this->expectDeprecation();
$this->expectExceptionMessage('deprecated');
$headers->setPluginClassLoader($loader);
}
Expand All @@ -635,7 +635,7 @@ public function testGetHeaderLocatorReturnsHeaderLocatorInstanceByDefault(): voi
public function testCanInjectAlternateHeaderLocatorInstance(): void
{
$headers = new Mail\Headers();
$locator = $this->prophesize(Mail\Header\HeaderLocatorInterface::class)->reveal();
$locator = $this->createMock(Mail\Header\HeaderLocatorInterface::class);

$headers->setHeaderLocator($locator);
$this->assertSame($locator, $headers->getHeaderLocator());
Expand Down
Loading