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

Commit

Permalink
Enhancement: Update phpunit/phpunit
Browse files Browse the repository at this point in the history
  • Loading branch information
localheinz committed May 23, 2017
1 parent 52d6e73 commit 14533a5
Show file tree
Hide file tree
Showing 4 changed files with 40 additions and 25 deletions.
2 changes: 1 addition & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
},
"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

0 comments on commit 14533a5

Please sign in to comment.