Skip to content
This repository has been archived by the owner on Nov 17, 2021. It is now read-only.

Commit

Permalink
feature #906 [master] update to PHPUnit 6 and php7 only (Rotzbua, fab…
Browse files Browse the repository at this point in the history
…pot)

This PR was merged into the 6.0-dev branch.

Discussion
----------

[master] update to PHPUnit 6 and php7 only

### Changes
Update phpunit class names.
Update test for phpunit 6.
Update travis.

### Why?
Swiftmailer do not released a new major since 2013 and it do not seem that there are plans to do so #894.

I think the plan was to refactor and release it as v6. Now php 7 is released which has lot of changes which make it difficult to handle both versions php v5.6 and v7.x.

My suggestion is to drop php 5.x in master completely to avoid this complexity and use the new advantages of php 7.

### Incompatible
Both listeners seems to be not compatible to phpunit 6 yet.
```xml
<listener class="Symfony\Bridge\PhpUnit\SymfonyTestsListener" />
<listener class="Mockery\Adapter\Phpunit\TestListener" />
```

Commits
-------

a6565f6 updated CHANGES
5e23090 fixed docs
2c68166 reverted Mockery upgrade
de66061 fixed risky tests
5488f41 fixed tests for PHPUnit 6
672d333 fixed PHPUnit version
3da41e1 update to PHPUnit 6 and php7 only
  • Loading branch information
fabpot committed May 15, 2017
2 parents 132dd46 + a6565f6 commit 772b15b
Show file tree
Hide file tree
Showing 78 changed files with 122 additions and 127 deletions.
4 changes: 1 addition & 3 deletions .travis.yml
Expand Up @@ -11,12 +11,10 @@ before_script:
- gem install mailcatcher
- mailcatcher --smtp-port 4456

script: ./vendor/bin/simple-phpunit
script: SYMFONY_PHPUNIT_VERSION=6.1 ./vendor/bin/simple-phpunit

matrix:
include:
- php: 5.5
- php: 5.6
- php: 7.0
- php: 7.1
- php: hhvm
Expand Down
2 changes: 1 addition & 1 deletion CHANGES
Expand Up @@ -13,7 +13,7 @@ Changelog
* removed newInstance() methods everywhere
* methods operating on Date header now use DateTimeImmutable object instead of Unix timestamp;
Swift_Mime_Headers_DateHeader::getTimestamp()/setTimestamp() renamed to getDateTime()/setDateTime()
* bumped minimum version to PHP 5.5
* bumped minimum version to PHP 7.0

5.4.8 (2017-XX-XX)
------------------
Expand Down
5 changes: 3 additions & 2 deletions composer.json
Expand Up @@ -15,8 +15,9 @@
}
],
"require": {
"php": ">=5.5.0",
"egulias/email-validator": "~2.0"
"php": ">=7.0.0",
"egulias/email-validator": "~2.0",
"dkarlovi/symfony-flex-docker": "^0.1"
},
"require-dev": {
"mockery/mockery": "~0.9.1",
Expand Down
13 changes: 1 addition & 12 deletions doc/overview.rst
Expand Up @@ -18,18 +18,7 @@ the long run if you at least read between the lines here.
System Requirements
-------------------

The basic requirements to operate Swift Mailer are extremely minimal and
easily achieved. Historically, Swift Mailer has supported both PHP 4 and PHP 5
by following a parallel development workflow. Now in it's fourth major
version, and Swift Mailer operates on servers running PHP 5.5 or higher.

The library aims to work with as many PHP 5 projects as possible:

* PHP 5.5 or higher, with the SPL extension (standard)

* Limited network access to connect to remote SMTP servers

* 8 MB or more memory limit (Swift Mailer uses around 2 MB)
Swift Mailer operates on servers running PHP 7.0 or higher.

Component Breakdown
-------------------
Expand Down
1 change: 0 additions & 1 deletion phpunit.xml.dist
Expand Up @@ -34,6 +34,5 @@

<listeners>
<listener class="Symfony\Bridge\PhpUnit\SymfonyTestsListener" />
<listener class="Mockery\Adapter\Phpunit\TestListener" />
</listeners>
</phpunit>
4 changes: 2 additions & 2 deletions tests/IdenticalBinaryConstraint.php
Expand Up @@ -5,7 +5,7 @@
*
* @author Chris Corbyn
*/
class IdenticalBinaryConstraint extends \PHPUnit_Framework_Constraint
class IdenticalBinaryConstraint extends \PHPUnit\Framework\Constraint\Constraint
{
protected $value;

Expand Down Expand Up @@ -37,7 +37,7 @@ public function matches($other)
*/
public function toString()
{
return 'indentical binary';
return 'identical binary';
}

/**
Expand Down
8 changes: 6 additions & 2 deletions tests/SwiftMailerTestCase.php
@@ -1,19 +1,23 @@
<?php

use Mockery\Adapter\Phpunit\MockeryPHPUnitIntegration;

/**
* A base test case with some custom expectations.
*
* @author Rouven Weßling
*/
class SwiftMailerTestCase extends \PHPUnit_Framework_TestCase
class SwiftMailerTestCase extends \PHPUnit\Framework\TestCase
{
use MockeryPHPUnitIntegration;

public static function regExp($pattern)
{
if (!is_string($pattern)) {
throw PHPUnit_Util_InvalidArgumentHelper::factory(1, 'string');
}

return new PHPUnit_Framework_Constraint_PCREMatch($pattern);
return new \PHPUnit\Framework\Constraint\RegularExpression($pattern);
}

public function assertIdenticalBinary($expected, $actual, $message = '')
Expand Down
@@ -1,6 +1,6 @@
<?php

class Swift_ByteStream_FileByteStreamAcceptanceTest extends \PHPUnit_Framework_TestCase
class Swift_ByteStream_FileByteStreamAcceptanceTest extends \PHPUnit\Framework\TestCase
{
private $_testFile;

Expand Down
@@ -1,6 +1,6 @@
<?php

class Swift_CharacterReaderFactory_SimpleCharacterReaderFactoryAcceptanceTest extends \PHPUnit_Framework_TestCase
class Swift_CharacterReaderFactory_SimpleCharacterReaderFactoryAcceptanceTest extends \PHPUnit\Framework\TestCase
{
private $factory;
private $prefix = 'Swift_CharacterReader_';
Expand Down
4 changes: 3 additions & 1 deletion tests/acceptance/Swift/DependencyContainerAcceptanceTest.php
Expand Up @@ -4,7 +4,7 @@

//This is more of a "cross your fingers and hope it works" test!

class Swift_DependencyContainerAcceptanceTest extends \PHPUnit_Framework_TestCase
class Swift_DependencyContainerAcceptanceTest extends PHPUnit\Framework\TestCase
{
public function testNoLookupsFail()
{
Expand All @@ -16,5 +16,7 @@ public function testNoLookupsFail()
$this->fail($e->getMessage());
}
}
// previous loop would fail if there is an issue
$this->addToAssertionCount(1);
}
}
@@ -1,6 +1,6 @@
<?php

class Swift_Encoder_Base64EncoderAcceptanceTest extends \PHPUnit_Framework_TestCase
class Swift_Encoder_Base64EncoderAcceptanceTest extends \PHPUnit\Framework\TestCase
{
private $samplesDir;
private $encoder;
Expand Down
2 changes: 1 addition & 1 deletion tests/acceptance/Swift/Encoder/QpEncoderAcceptanceTest.php
@@ -1,6 +1,6 @@
<?php

class Swift_Encoder_QpEncoderAcceptanceTest extends \PHPUnit_Framework_TestCase
class Swift_Encoder_QpEncoderAcceptanceTest extends \PHPUnit\Framework\TestCase
{
private $samplesDir;
private $factory;
Expand Down
@@ -1,6 +1,6 @@
<?php

class Swift_Encoder_Rfc2231EncoderAcceptanceTest extends \PHPUnit_Framework_TestCase
class Swift_Encoder_Rfc2231EncoderAcceptanceTest extends \PHPUnit\Framework\TestCase
{
private $samplesDir;
private $factory;
Expand Down
@@ -1,6 +1,6 @@
<?php

class Swift_KeyCache_ArrayKeyCacheAcceptanceTest extends \PHPUnit_Framework_TestCase
class Swift_KeyCache_ArrayKeyCacheAcceptanceTest extends \PHPUnit\Framework\TestCase
{
private $cache;
private $key1 = 'key1';
Expand Down
@@ -1,6 +1,6 @@
<?php

class Swift_KeyCache_DiskKeyCacheAcceptanceTest extends \PHPUnit_Framework_TestCase
class Swift_KeyCache_DiskKeyCacheAcceptanceTest extends \PHPUnit\Framework\TestCase
{
private $cache;
private $key1;
Expand Down
2 changes: 1 addition & 1 deletion tests/acceptance/Swift/Mime/AttachmentAcceptanceTest.php
Expand Up @@ -2,7 +2,7 @@

use Egulias\EmailValidator\EmailValidator;

class Swift_Mime_AttachmentAcceptanceTest extends \PHPUnit_Framework_TestCase
class Swift_Mime_AttachmentAcceptanceTest extends \PHPUnit\Framework\TestCase
{
private $contentEncoder;
private $cache;
Expand Down
@@ -1,6 +1,6 @@
<?php

class Swift_Mime_ContentEncoder_Base64ContentEncoderAcceptanceTest extends \PHPUnit_Framework_TestCase
class Swift_Mime_ContentEncoder_Base64ContentEncoderAcceptanceTest extends \PHPUnit\Framework\TestCase
{
private $samplesDir;
private $encoder;
Expand Down
@@ -1,6 +1,6 @@
<?php

class Swift_Mime_ContentEncoder_NativeQpContentEncoderAcceptanceTest extends \PHPUnit_Framework_TestCase
class Swift_Mime_ContentEncoder_NativeQpContentEncoderAcceptanceTest extends \PHPUnit\Framework\TestCase
{
protected $_samplesDir;

Expand Down
@@ -1,6 +1,6 @@
<?php

class Swift_Mime_ContentEncoder_PlainContentEncoderAcceptanceTest extends \PHPUnit_Framework_TestCase
class Swift_Mime_ContentEncoder_PlainContentEncoderAcceptanceTest extends \PHPUnit\Framework\TestCase
{
private $samplesDir;
private $encoder;
Expand Down
@@ -1,6 +1,6 @@
<?php

class Swift_Mime_ContentEncoder_QpContentEncoderAcceptanceTest extends \PHPUnit_Framework_TestCase
class Swift_Mime_ContentEncoder_QpContentEncoderAcceptanceTest extends \PHPUnit\Framework\TestCase
{
private $samplesDir;
private $factory;
Expand Down
2 changes: 1 addition & 1 deletion tests/acceptance/Swift/Mime/EmbeddedFileAcceptanceTest.php
Expand Up @@ -2,7 +2,7 @@

use Egulias\EmailValidator\EmailValidator;

class Swift_Mime_EmbeddedFileAcceptanceTest extends \PHPUnit_Framework_TestCase
class Swift_Mime_EmbeddedFileAcceptanceTest extends \PHPUnit\Framework\TestCase
{
private $contentEncoder;
private $cache;
Expand Down
@@ -1,6 +1,6 @@
<?php

class Swift_Mime_HeaderEncoder_Base64HeaderEncoderAcceptanceTest extends \PHPUnit_Framework_TestCase
class Swift_Mime_HeaderEncoder_Base64HeaderEncoderAcceptanceTest extends \PHPUnit\Framework\TestCase
{
private $encoder;

Expand Down
2 changes: 1 addition & 1 deletion tests/acceptance/Swift/Mime/MimePartAcceptanceTest.php
Expand Up @@ -2,7 +2,7 @@

use Egulias\EmailValidator\EmailValidator;

class Swift_Mime_MimePartAcceptanceTest extends \PHPUnit_Framework_TestCase
class Swift_Mime_MimePartAcceptanceTest extends \PHPUnit\Framework\TestCase
{
private $contentEncoder;
private $cache;
Expand Down
@@ -1,6 +1,6 @@
<?php

class Swift_Mime_SimpleMessageAcceptanceTest extends \PHPUnit_Framework_TestCase
class Swift_Mime_SimpleMessageAcceptanceTest extends \PHPUnit\Framework\TestCase
{
protected function setUp()
{
Expand Down
@@ -1,6 +1,6 @@
<?php

abstract class Swift_Transport_StreamBuffer_AbstractStreamBufferAcceptanceTest extends \PHPUnit_Framework_TestCase
abstract class Swift_Transport_StreamBuffer_AbstractStreamBufferAcceptanceTest extends \PHPUnit\Framework\TestCase
{
protected $buffer;

Expand Down
@@ -1,6 +1,6 @@
<?php

class Swift_Transport_StreamBuffer_SocketTimeoutTest extends \PHPUnit_Framework_TestCase
class Swift_Transport_StreamBuffer_SocketTimeoutTest extends \PHPUnit\Framework\TestCase
{
protected $buffer;
protected $server;
Expand Down
2 changes: 1 addition & 1 deletion tests/bug/Swift/Bug111Test.php
@@ -1,6 +1,6 @@
<?php

class Swift_Bug111Test extends \PHPUnit_Framework_TestCase
class Swift_Bug111Test extends \PHPUnit\Framework\TestCase
{
public function testUnstructuredHeaderSlashesShouldNotBeEscaped()
{
Expand Down
2 changes: 1 addition & 1 deletion tests/bug/Swift/Bug118Test.php
@@ -1,6 +1,6 @@
<?php

class Swift_Bug118Test extends \PHPUnit_Framework_TestCase
class Swift_Bug118Test extends \PHPUnit\Framework\TestCase
{
private $message;

Expand Down
2 changes: 1 addition & 1 deletion tests/bug/Swift/Bug206Test.php
Expand Up @@ -2,7 +2,7 @@

use Egulias\EmailValidator\EmailValidator;

class Swift_Bug206Test extends \PHPUnit_Framework_TestCase
class Swift_Bug206Test extends \PHPUnit\Framework\TestCase
{
private $factory;

Expand Down
8 changes: 6 additions & 2 deletions tests/bug/Swift/Bug274Test.php
@@ -1,11 +1,14 @@
<?php

class Swift_Bug274Test extends \PHPUnit_Framework_TestCase
class Swift_Bug274Test extends \PHPUnit\Framework\TestCase
{
/**
* @expectedException \Swift_IoException
* @expectedMessageException The path cannot be empty
*/
public function testEmptyFileNameAsAttachment()
{
$message = new Swift_Message();
$this->setExpectedException('Swift_IoException', 'The path cannot be empty');
$message->attach(Swift_Attachment::fromPath(''));
}

Expand All @@ -17,5 +20,6 @@ public function testNonEmptyFileNameAsAttachment()
} catch (Exception $e) {
$this->fail('Path should not be empty');
}
$this->addToAssertionCount(1);
}
}
2 changes: 1 addition & 1 deletion tests/bug/Swift/Bug34Test.php
@@ -1,6 +1,6 @@
<?php

class Swift_Bug34Test extends \PHPUnit_Framework_TestCase
class Swift_Bug34Test extends \PHPUnit\Framework\TestCase
{
protected function setUp()
{
Expand Down
2 changes: 1 addition & 1 deletion tests/bug/Swift/Bug35Test.php
@@ -1,6 +1,6 @@
<?php

class Swift_Bug35Test extends \PHPUnit_Framework_TestCase
class Swift_Bug35Test extends \PHPUnit\Framework\TestCase
{
protected function setUp()
{
Expand Down
2 changes: 1 addition & 1 deletion tests/bug/Swift/Bug38Test.php
@@ -1,6 +1,6 @@
<?php

class Swift_Bug38Test extends \PHPUnit_Framework_TestCase
class Swift_Bug38Test extends \PHPUnit\Framework\TestCase
{
private $attFile;
private $attFileName;
Expand Down
2 changes: 1 addition & 1 deletion tests/bug/Swift/Bug650Test.php
Expand Up @@ -2,7 +2,7 @@

use Egulias\EmailValidator\EmailValidator;

class Swift_Bug650Test extends \PHPUnit_Framework_TestCase
class Swift_Bug650Test extends \PHPUnit\Framework\TestCase
{
/**
* @dataProvider encodingDataProvider
Expand Down
2 changes: 1 addition & 1 deletion tests/bug/Swift/Bug71Test.php
@@ -1,6 +1,6 @@
<?php

class Swift_Bug71Test extends \PHPUnit_Framework_TestCase
class Swift_Bug71Test extends \PHPUnit\Framework\TestCase
{
private $message;

Expand Down
2 changes: 1 addition & 1 deletion tests/bug/Swift/Bug76Test.php
@@ -1,6 +1,6 @@
<?php

class Swift_Bug76Test extends \PHPUnit_Framework_TestCase
class Swift_Bug76Test extends \PHPUnit\Framework\TestCase
{
private $inputFile;
private $outputFile;
Expand Down
@@ -1,6 +1,6 @@
<?php

class Swift_FileByteStreamConsecutiveReadCalls extends \PHPUnit_Framework_TestCase
class Swift_FileByteStreamConsecutiveReadCalls extends \PHPUnit\Framework\TestCase
{
/**
* @test
Expand Down
2 changes: 1 addition & 1 deletion tests/unit/Swift/ByteStream/ArrayByteStreamTest.php
@@ -1,6 +1,6 @@
<?php

class Swift_ByteStream_ArrayByteStreamTest extends \PHPUnit_Framework_TestCase
class Swift_ByteStream_ArrayByteStreamTest extends \PHPUnit\Framework\TestCase
{
public function testReadingSingleBytesFromBaseInput()
{
Expand Down
@@ -1,6 +1,6 @@
<?php

class Swift_CharacterReader_GenericFixedWidthReaderTest extends \PHPUnit_Framework_TestCase
class Swift_CharacterReader_GenericFixedWidthReaderTest extends \PHPUnit\Framework\TestCase
{
public function testInitialByteSizeMatchesWidth()
{
Expand Down
2 changes: 1 addition & 1 deletion tests/unit/Swift/CharacterReader/UsAsciiReaderTest.php
@@ -1,6 +1,6 @@
<?php

class Swift_CharacterReader_UsAsciiReaderTest extends \PHPUnit_Framework_TestCase
class Swift_CharacterReader_UsAsciiReaderTest extends \PHPUnit\Framework\TestCase
{
/*
Expand Down

0 comments on commit 772b15b

Please sign in to comment.