Skip to content
This repository was archived by the owner on Jan 30, 2020. It is now read-only.

Enhancement: Raise minimum PHP version to PHP 7.1 #39

Merged
merged 2 commits into from
Apr 25, 2018
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
18 changes: 0 additions & 18 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,24 +23,6 @@ env:

matrix:
include:
- php: 5.5
env:
- CS_CHECK=true
- php: 5.5
env:
- ZEND_SERVICEMANAGER_VERSION="^2.7.5"
- php: 5.6
env:
- TEST_COVERAGE=true
- DEPLOY_DOCS="$(if [[ $TRAVIS_BRANCH == 'master' && $TRAVIS_PULL_REQUEST == 'false' ]]; then echo -n 'true' ; else echo -n 'false' ; fi)"
- PATH="$HOME/.local/bin:$PATH"
- php: 5.6
env:
- ZEND_SERVICEMANAGER_VERSION="^2.7.5"
- php: 7.0
- php: 7.0
env:
- ZEND_SERVICEMANAGER_VERSION="^2.7.5"
- php: 7.1
- php: 7.1
env:
Expand Down
4 changes: 2 additions & 2 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -16,12 +16,12 @@
}
},
"require": {
"php": "^5.5 || ^7.0",
"php": "^7.1",
"zendframework/zend-stdlib": "^2.7 || ^3.0"
},
"require-dev": {
"fabpot/php-cs-fixer": "1.7.*",
"phpunit/phpunit": "~4.0",
"phpunit/phpunit": "^6.1.4",
"zendframework/zend-coding-standard": "~1.0.0",
"zendframework/zend-filter": "^2.6.1",
"zendframework/zend-i18n": "^2.6",
Expand Down
10 changes: 7 additions & 3 deletions test/ClassFileLocatorTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@

namespace ZendTest\File;

use PHPUnit\Framework;
use Zend\File\ClassFileLocator;
use Zend\File\Exception;
use Zend\File\PhpClassFile;
Expand All @@ -18,18 +19,21 @@
*
* @group Zend_File
*/
class ClassFileLocatorTest extends \PHPUnit_Framework_TestCase
class ClassFileLocatorTest extends Framework\TestCase
{
public function testConstructorThrowsInvalidArgumentExceptionForInvalidStringDirectory()
{
$this->setExpectedException(Exception\InvalidArgumentException::class);
$this->expectException(Exception\InvalidArgumentException::class);

$locator = new ClassFileLocator('__foo__');
}

public function testConstructorThrowsInvalidArgumentExceptionForNonDirectoryIteratorArgument()
{
$iterator = new \ArrayIterator([]);
$this->setExpectedException(Exception\InvalidArgumentException::class);

$this->expectException(Exception\InvalidArgumentException::class);

$locator = new ClassFileLocator($iterator);
}

Expand Down
44 changes: 26 additions & 18 deletions test/Transfer/Adapter/AbstractTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
namespace ZendTest\File\Transfer\Adapter;

use Interop\Container\ContainerInterface;
use PHPUnit\Framework;
use stdClass;
use Zend\File;
use Zend\Filter;
Expand All @@ -21,7 +22,7 @@
*
* @group Zend_File
*/
class AbstractTest extends \PHPUnit_Framework_TestCase
class AbstractTest extends Framework\TestCase
{
/**
* Sets up the fixture, for example, open a network connection.
Expand Down Expand Up @@ -75,10 +76,9 @@ public function testAdapterShouldAllowAddingValidatorViaPluginManager()

public function testAdapterhShouldRaiseExceptionWhenAddingInvalidValidatorType()
{
$this->setExpectedException(
File\Transfer\Exception\InvalidArgumentException::class,
'Invalid validator provided to addValidator'
);
$this->expectException(File\Transfer\Exception\InvalidArgumentException::class);
$this->expectExceptionMessage('Invalid validator provided to addValidator');

$this->adapter->addValidator(new Filter\BaseName);
}

Expand Down Expand Up @@ -272,10 +272,9 @@ public function testAdapterShouldAllowAddingFilterViaPluginManager()

public function testAdapterhShouldRaiseExceptionWhenAddingInvalidFilterType()
{
$this->setExpectedException(
File\Transfer\Exception\InvalidArgumentException::class,
'Invalid filter specified'
);
$this->expectException(File\Transfer\Exception\InvalidArgumentException::class);
$this->expectExceptionMessage('Invalid filter specified');

$this->adapter->addFilter(new stdClass());
}

Expand Down Expand Up @@ -463,10 +462,9 @@ public function testGetAdditionalFileInfosForSingleFile()

public function testGetAdditionalFileInfosForUnknownFile()
{
$this->setExpectedException(
File\Transfer\Exception\RuntimeException::class,
'The file transfer adapter can not find "unknown"'
);
$this->expectException(File\Transfer\Exception\RuntimeException::class);
$this->expectExceptionMessage('The file transfer adapter can not find "unknown"');

$files = $this->adapter->getFileInfo('unknown');
}

Expand Down Expand Up @@ -508,7 +506,9 @@ public function testAdapterShouldAllowRetrievingAllFileNamesWithoutPath()

public function testExceptionForUnknownHashValue()
{
$this->setExpectedException(File\Transfer\Exception\InvalidArgumentException::class, 'Unknown hash algorithm');
$this->expectException(File\Transfer\Exception\InvalidArgumentException::class);
$this->expectExceptionMessage('Unknown hash algorithm');

$this->adapter->getHash('foo', 'unknown_hash');
}

Expand Down Expand Up @@ -541,7 +541,9 @@ public function testTemporaryDirectoryAccessDetection()

public function testFileSizeButNoFileFound()
{
$this->setExpectedException(File\Transfer\Exception\InvalidArgumentException::class, 'does not exist');
$this->expectException(File\Transfer\Exception\InvalidArgumentException::class);
$this->expectExceptionMessage('does not exist');

$this->assertEquals(10, $this->adapter->getFileSize());
}

Expand All @@ -566,7 +568,9 @@ public function testFileSizeByTmpName()

public function testMimeTypeButNoFileFound()
{
$this->setExpectedException(File\Transfer\Exception\InvalidArgumentException::class, 'does not exist');
$this->expectException(File\Transfer\Exception\InvalidArgumentException::class);
$this->expectExceptionMessage('does not exist');

$this->assertEquals('image/jpeg', $this->adapter->getMimeType());
}

Expand All @@ -593,7 +597,9 @@ public function testSetOwnErrorMessage()
$message = $this->adapter->getMessages();
$this->assertContains('Zu wenige', $message);

$this->setExpectedException(File\Transfer\Exception\InvalidArgumentException::class, 'does not exist');
$this->expectException(File\Transfer\Exception\InvalidArgumentException::class);
$this->expectExceptionMessage('does not exist');

$this->assertEquals('image/jpeg', $this->adapter->getMimeType());
}

Expand All @@ -603,7 +609,9 @@ public function testTransferDestinationAtNonExistingElement()
$this->adapter->setDestination($directory, 'nonexisting');
$this->assertEquals($directory, $this->adapter->getDestination('nonexisting'));

$this->setExpectedException(File\Transfer\Exception\InvalidArgumentException::class, 'not find');
$this->expectException(File\Transfer\Exception\InvalidArgumentException::class);
$this->expectExceptionMessage('not find');

$this->assertInternalType('string', $this->adapter->getDestination('reallynonexisting'));
}

Expand Down
9 changes: 6 additions & 3 deletions test/Transfer/Adapter/HttpTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@

namespace ZendTest\File\Transfer\Adapter;

use PHPUnit\Framework;
use Zend\File\Transfer\Adapter;
use Zend\File\Transfer\Exception\BadMethodCallException;
use Zend\File\Transfer\Exception\RuntimeException;
Expand All @@ -20,7 +21,7 @@
*
* @group Zend_File
*/
class HttpTest extends \PHPUnit_Framework_TestCase
class HttpTest extends Framework\TestCase
{
/**
* Sets up the fixture, for example, open a network connection.
Expand Down Expand Up @@ -71,13 +72,15 @@ public function testAutoSetUploadValidator()

public function testSendingFiles()
{
$this->setExpectedException(BadMethodCallException::class, 'not implemented');
$this->expectException(BadMethodCallException::class, 'not implemented');

$this->adapter->send();
}

public function testFileIsSent()
{
$this->setExpectedException(BadMethodCallException::class, 'not implemented');
$this->expectException(BadMethodCallException::class, 'not implemented');

$this->adapter->isSent();
}

Expand Down