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

Mise à jour de PHPunit en version 7.

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