Commit 62ac192a authored by Guillaume Perréal's avatar Guillaume Perréal Committed by Guillaume Perréal
Browse files

Mise à jour de PHPunit en version 7.

parent 826daa26
...@@ -48,7 +48,7 @@ ...@@ -48,7 +48,7 @@
"xenolope/quahog": "^2.1" "xenolope/quahog": "^2.1"
}, },
"require-dev": { "require-dev": {
"phpunit/phpunit": "^4.8" "phpunit/phpunit": "^7"
}, },
"config": { "config": {
"sort-packages": true "sort-packages": true
......
...@@ -7,12 +7,12 @@ ...@@ -7,12 +7,12 @@
namespace Irstea\FileUploadBundle\Tests\Entity; namespace Irstea\FileUploadBundle\Tests\Entity;
use Irstea\FileUploadBundle\Entity\UploadedFile; use Irstea\FileUploadBundle\Entity\UploadedFile;
use PHPUnit_Framework_TestCase; use PHPUnit\Framework\TestCase;
/** /**
* Generated by PHPUnit_SkeletonGenerator on 2015-01-26 at 10:27:46. * Generated by PHPUnit_SkeletonGenerator on 2015-01-26 at 10:27:46.
*/ */
class UploadedFileTest extends PHPUnit_Framework_TestCase class UploadedFileTest extends TestCase
{ {
/** /**
* @var UploadedFile * @var UploadedFile
......
...@@ -9,13 +9,13 @@ namespace Irstea\FileUploadBundle\Tests\Form\DataTranformer; ...@@ -9,13 +9,13 @@ namespace Irstea\FileUploadBundle\Tests\Form\DataTranformer;
use Irstea\FileUploadBundle\Form\DataTranformer\UploadedFileTransformer; use Irstea\FileUploadBundle\Form\DataTranformer\UploadedFileTransformer;
use Irstea\FileUploadBundle\Model\FileManagerInterface; use Irstea\FileUploadBundle\Model\FileManagerInterface;
use Irstea\FileUploadBundle\Model\UploadedFileInterface; use Irstea\FileUploadBundle\Model\UploadedFileInterface;
use PHPUnit\Framework\TestCase;
use PHPUnit_Framework_MockObject_MockObject; use PHPUnit_Framework_MockObject_MockObject;
use PHPUnit_Framework_TestCase;
/** /**
* Generated by PHPUnit_SkeletonGenerator on 2015-01-27 at 11:36:06. * Generated by PHPUnit_SkeletonGenerator on 2015-01-27 at 11:36:06.
*/ */
class UploadedFileTransformerTest extends PHPUnit_Framework_TestCase class UploadedFileTransformerTest extends TestCase
{ {
/** /**
* @var PHPUnit_Framework_MockObject_MockObject * @var PHPUnit_Framework_MockObject_MockObject
...@@ -33,7 +33,7 @@ class UploadedFileTransformerTest extends PHPUnit_Framework_TestCase ...@@ -33,7 +33,7 @@ class UploadedFileTransformerTest extends PHPUnit_Framework_TestCase
*/ */
protected function setUp() protected function setUp()
{ {
$this->fileManager = $this->getMock(FileManagerInterface::class); $this->fileManager = $this->createMock(FileManagerInterface::class);
$this->transformer = new UploadedFileTransformer($this->fileManager, true); $this->transformer = new UploadedFileTransformer($this->fileManager, true);
} }
...@@ -73,7 +73,7 @@ class UploadedFileTransformerTest extends PHPUnit_Framework_TestCase ...@@ -73,7 +73,7 @@ class UploadedFileTransformerTest extends PHPUnit_Framework_TestCase
public function testTransformFile() public function testTransformFile()
{ {
$file = $this->getMock(UploadedFileInterface::class); $file = $this->createMock(UploadedFileInterface::class);
$file->expects(static::once())->method('toArray')->willReturn(['bla']); $file->expects(static::once())->method('toArray')->willReturn(['bla']);
...@@ -95,7 +95,7 @@ class UploadedFileTransformerTest extends PHPUnit_Framework_TestCase ...@@ -95,7 +95,7 @@ class UploadedFileTransformerTest extends PHPUnit_Framework_TestCase
public function testReverseTransformFile() public function testReverseTransformFile()
{ {
$file = $this->getMock(UploadedFileInterface::class); $file = $this->createMock(UploadedFileInterface::class);
$this->fileManager->expects(static::once())->method('get')->with('FOO')->willReturn($file); $this->fileManager->expects(static::once())->method('get')->with('FOO')->willReturn($file);
$file->expects(static::once())->method('isOrphelin')->willReturn(true); $file->expects(static::once())->method('isOrphelin')->willReturn(true);
...@@ -107,7 +107,7 @@ class UploadedFileTransformerTest extends PHPUnit_Framework_TestCase ...@@ -107,7 +107,7 @@ class UploadedFileTransformerTest extends PHPUnit_Framework_TestCase
public function testTransformEmptyEntries() public function testTransformEmptyEntries()
{ {
$file = $this->getMock(UploadedFileInterface::class); $file = $this->createMock(UploadedFileInterface::class);
$file->expects(static::any())->method('toArray')->willReturn(['bla']); $file->expects(static::any())->method('toArray')->willReturn(['bla']);
$result = $this->transformer->transform([$file, null, $file]); $result = $this->transformer->transform([$file, null, $file]);
...@@ -117,7 +117,7 @@ class UploadedFileTransformerTest extends PHPUnit_Framework_TestCase ...@@ -117,7 +117,7 @@ class UploadedFileTransformerTest extends PHPUnit_Framework_TestCase
public function testReverseTransformEmptyEntries() public function testReverseTransformEmptyEntries()
{ {
$file = $this->getMock(UploadedFileInterface::class); $file = $this->createMock(UploadedFileInterface::class);
$this->fileManager->expects(static::any())->method('get')->with('FOO')->willReturn($file); $this->fileManager->expects(static::any())->method('get')->with('FOO')->willReturn($file);
$result = $this->transformer->reverseTransform([['id' => 'FOO'], null, ['description' => 'muche'], ['id' => 'FOO']]); $result = $this->transformer->reverseTransform([['id' => 'FOO'], null, ['description' => 'muche'], ['id' => 'FOO']]);
......
...@@ -4,21 +4,22 @@ ...@@ -4,21 +4,22 @@
* All rights reserved. * All rights reserved.
*/ */
namespace Irstea\FileUploadBundle\Listener; namespace Irstea\FileUploadBundle\Tests\Listener;
use Doctrine\ORM\EntityManager; use Doctrine\ORM\EntityManager;
use Doctrine\ORM\Event\LifecycleEventArgs; use Doctrine\ORM\Event\LifecycleEventArgs;
use Doctrine\ORM\UnitOfWork; use Doctrine\ORM\UnitOfWork;
use Gaufrette\Exception\FileNotFound; use Gaufrette\Exception\FileNotFound;
use Gaufrette\Filesystem; use Gaufrette\Filesystem;
use Irstea\FileUploadBundle\Entity\UploadedFile; use Irstea\FileUploadBundle\Listener\UploadedFileListener;
use PHPUnit_Framework_MockObject_MockObject; use Irstea\FileUploadBundle\Model\UploadedFileInterface;
use PHPUnit_Framework_TestCase; use PHPUnit\Framework\MockObject\MockObject;
use PHPUnit\Framework\TestCase;
/** /**
* Generated by PHPUnit_SkeletonGenerator on 2015-01-29 at 14:56:00. * Generated by PHPUnit_SkeletonGenerator on 2015-01-29 at 14:56:00.
*/ */
class UploadedFileListenerTest extends PHPUnit_Framework_TestCase class UploadedFileListenerTest extends TestCase
{ {
/** /**
* @var UploadedFileListener * @var UploadedFileListener
...@@ -26,27 +27,27 @@ class UploadedFileListenerTest extends PHPUnit_Framework_TestCase ...@@ -26,27 +27,27 @@ class UploadedFileListenerTest extends PHPUnit_Framework_TestCase
protected $listener; protected $listener;
/** /**
* @var PHPUnit_Framework_MockObject_MockObject * @var Filesystem|MockObject
*/ */
protected $filesystem; protected $filesystem;
/** /**
* @var PHPUnit_Framework_MockObject_MockObject * @var UploadedFileInterface|MockObject
*/ */
protected $file; protected $file;
/** /**
* @var PHPUnit_Framework_MockObject_MockObject * @var EntityManager|MockObject
*/ */
protected $om; protected $om;
/** /**
* @var PHPUnit_Framework_MockObject_MockObject * @var UnitOfWork|MockObject
*/ */
protected $unitOfWork; protected $unitOfWork;
/** /**
* @var PHPUnit_Framework_MockObject_MockObject * @var LifecycleEventArgs
*/ */
protected $event; protected $event;
...@@ -62,9 +63,7 @@ class UploadedFileListenerTest extends PHPUnit_Framework_TestCase ...@@ -62,9 +63,7 @@ class UploadedFileListenerTest extends PHPUnit_Framework_TestCase
$this->listener = new UploadedFileListener($this->filesystem); $this->listener = new UploadedFileListener($this->filesystem);
$this->file = $this->getMockBuilder(UploadedFile::class) $this->file = $this->createMock(UploadedFileInterface::class);
->setMethods(['setFilesystem', 'getPath'])
->getMockForAbstractClass();
$this->unitOfWork = $this->getMockBuilder(UnitOfWork::class) $this->unitOfWork = $this->getMockBuilder(UnitOfWork::class)
->disableOriginalConstructor() ->disableOriginalConstructor()
......
...@@ -9,15 +9,15 @@ namespace Irstea\FileUploadBundle\Tests\Listener; ...@@ -9,15 +9,15 @@ namespace Irstea\FileUploadBundle\Tests\Listener;
use Irstea\FileUploadBundle\Event\FileUploadCompleteEvent; use Irstea\FileUploadBundle\Event\FileUploadCompleteEvent;
use Irstea\FileUploadBundle\Listener\VirusScannerListener; use Irstea\FileUploadBundle\Listener\VirusScannerListener;
use Irstea\FileUploadBundle\Model\UploadedFileInterface; use Irstea\FileUploadBundle\Model\UploadedFileInterface;
use PHPUnit_Framework_MockObject_MockObject; use PHPUnit\Framework\MockObject\MockObject;
use PHPUnit_Framework_TestCase; use PHPUnit\Framework\TestCase;
use Xenolope\Quahog\Client; use Xenolope\Quahog\Client;
use Xenolope\Quahog\Exception\ConnectionException; use Xenolope\Quahog\Exception\ConnectionException;
/** /**
* Generated by PHPUnit_SkeletonGenerator on 2015-01-29 at 14:43:16. * Generated by PHPUnit_SkeletonGenerator on 2015-01-29 at 14:43:16.
*/ */
class VirusScannerListenerTest extends PHPUnit_Framework_TestCase class VirusScannerListenerTest extends TestCase
{ {
/** /**
* @var VirusScannerListener * @var VirusScannerListener
...@@ -25,7 +25,7 @@ class VirusScannerListenerTest extends PHPUnit_Framework_TestCase ...@@ -25,7 +25,7 @@ class VirusScannerListenerTest extends PHPUnit_Framework_TestCase
protected $listener; protected $listener;
/** /**
* @var PHPUnit_Framework_MockObject_MockObject * @var Client|MockObject
*/ */
protected $client; protected $client;
...@@ -35,7 +35,7 @@ class VirusScannerListenerTest extends PHPUnit_Framework_TestCase ...@@ -35,7 +35,7 @@ class VirusScannerListenerTest extends PHPUnit_Framework_TestCase
protected $event; protected $event;
/** /**
* @var PHPUnit_Framework_MockObject_MockObject * @var UploadedFileInterface|MockObject
*/ */
protected $file; protected $file;
...@@ -46,7 +46,7 @@ class VirusScannerListenerTest extends PHPUnit_Framework_TestCase ...@@ -46,7 +46,7 @@ class VirusScannerListenerTest extends PHPUnit_Framework_TestCase
{ {
$this->client = $this->getMockBuilder(Client::class)->disableOriginalConstructor()->getMock(); $this->client = $this->getMockBuilder(Client::class)->disableOriginalConstructor()->getMock();
$this->file = $this->getMock(UploadedFileInterface::class); $this->file = $this->createMock(UploadedFileInterface::class);
$this->file->expects($this->any())->method('getLocalPath')->willReturn('foopath'); $this->file->expects($this->any())->method('getLocalPath')->willReturn('foopath');
$this->file->expects($this->any())->method('getMetadata')->willReturn([]); $this->file->expects($this->any())->method('getMetadata')->willReturn([]);
......
...@@ -7,12 +7,12 @@ ...@@ -7,12 +7,12 @@
namespace Irstea\FileUploadBundle\Tests\Utils; namespace Irstea\FileUploadBundle\Tests\Utils;
use Irstea\FileUploadBundle\Utils\MimeTypeIcon; use Irstea\FileUploadBundle\Utils\MimeTypeIcon;
use PHPUnit_Framework_TestCase; use PHPUnit\Framework\TestCase;
/** /**
* Generated by PHPUnit_SkeletonGenerator on 2015-02-04 at 11:13:27. * Class MimeTypeIconTest.
*/ */
class MimeTypeIconTest extends PHPUnit_Framework_TestCase class MimeTypeIconTest extends TestCase
{ {
/** /**
* @covers \Irstea\FileUploadBundle\Utils\MimeTypeIcon::getMimeTypeIcon * @covers \Irstea\FileUploadBundle\Utils\MimeTypeIcon::getMimeTypeIcon
...@@ -26,6 +26,9 @@ class MimeTypeIconTest extends PHPUnit_Framework_TestCase ...@@ -26,6 +26,9 @@ class MimeTypeIconTest extends PHPUnit_Framework_TestCase
static::assertEquals($expected, MimeTypeIcon::getMimeTypeIcon($input)); static::assertEquals($expected, MimeTypeIcon::getMimeTypeIcon($input));
} }
/**
* @return array
*/
public function getTestValues() public function getTestValues()
{ {
return [ return [
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment