Skip to content
GitLab
    • Explore Projects Groups Topics Snippets
Projects Groups Topics Snippets
  • /
  • Help
    • Help
    • Support
    • Community forum
    • Submit feedback
    • Contribute to GitLab
  • Register
  • Sign in
  • F file-upload-bundle
  • Project information
    • Project information
    • Activity
    • Labels
    • Members
  • Repository
    • Repository
    • Files
    • Commits
    • Branches
    • Tags
    • Contributor statistics
    • Graph
    • Compare revisions
  • Issues 3
    • Issues 3
    • List
    • Boards
    • Service Desk
    • Milestones
  • Merge requests 1
    • Merge requests 1
  • Deployments
    • Deployments
    • Releases
  • Monitor
    • Monitor
    • Incidents
  • Analytics
    • Analytics
    • Value stream
    • Repository
  • Activity
  • Graph
  • Create a new issue
  • Commits
  • Issue Boards
Collapse sidebar

En prévision de l'arrivée de la forge institutionnelle INRAE, nous vous invitons à créer vos nouveaux projets sur la forge MIA.

  • Pôle IS
  • Bundles Symfony 2Bundles Symfony 2
  • file-upload-bundle
  • Merge requests
  • !1
An error occurred while fetching the assigned milestone of the selected merge_request.

Add antivirus analyse (xenelop quahog)

  • Review changes

  • Download
  • Patches
  • Plain diff
Merged Guillaume Perréal requested to merge antivirus into symfony3 7 years ago
  • Overview 9
  • Commits 6
  • Pipelines 0
  • Changes 2
Compare
  • version 7
    11a29fd3
    7 years ago

  • version 6
    2a94ce03
    7 years ago

  • version 5
    38e33e0f
    7 years ago

  • version 4
    016a9968
    7 years ago

  • version 3
    360f3b08
    7 years ago

  • version 2
    360f3b08
    7 years ago

  • version 1
    c47b7717
    7 years ago

  • symfony3 (base)

and
  • latest version
    c3ed8cbc
    6 commits, 7 years ago

  • version 7
    11a29fd3
    5 commits, 7 years ago

  • version 6
    2a94ce03
    7 commits, 7 years ago

  • version 5
    38e33e0f
    3 commits, 7 years ago

  • version 4
    016a9968
    2 commits, 7 years ago

  • version 3
    360f3b08
    2 commits, 7 years ago

  • version 2
    360f3b08
    2 commits, 7 years ago

  • version 1
    c47b7717
    1 commit, 7 years ago

Show latest version
2 files
+ 11
− 15

    Preferences

    File browser
    Compare changes
Listener/VirusScannerListener.php
+ 4
− 5
  • View file @ 38e33e0f

  • Edit in single-file editor

  • Open in Web IDE


@@ -6,9 +6,9 @@
namespace Irstea\FileUploadBundle\Listener;
use Xenolope\Quahog\Client;
use Irstea\FileUploadBundle\Event\FileUploadCompleteEvent;
use Irstea\FileUploadBundle\Exception\RejectedFileException;
use Xenolope\Quahog\Client;
use Xenolope\Quahog\Exception\ConnectionException;
/**
@@ -21,7 +21,6 @@ class VirusScannerListener
*/
private $client;
/**
* @param Client $client
*/
@@ -30,7 +29,6 @@ class VirusScannerListener
$this->client = $client;
}
/**
* @param FileUploadCompleteEvent $event
*/
@@ -60,16 +58,17 @@ class VirusScannerListener
}
/**
* @return Client
* @throws ConnectionException
*
* @return Client
*/
private function getClient(): Client
{
try {
// Check clamd server's state
$this->client->ping();
return $this->client;
return $this->client;
} catch (ConnectionException $connectionException) {
throw $connectionException;
}
Tests/Listener/VirusScannerListenerTest.php
+ 7
− 10
  • View file @ 38e33e0f

  • Edit in single-file editor

  • Open in Web IDE


@@ -8,9 +8,9 @@ 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 Irstea\FileUploadBundle\Model\UploadedFileInterface;
use Xenolope\Quahog\Client;
use Xenolope\Quahog\Exception\ConnectionException;
@@ -55,13 +55,12 @@ class VirusScannerListenerTest extends PHPUnit_Framework_TestCase
$this->listener = new VirusScannerListener($this->client);
}
public function testOnFileUploadCompletedResultOk()
{
$result = [
'filename' => 'footpath',
'reason' => null,
'status' => Client::RESULT_OK
'reason' => null,
'status' => Client::RESULT_OK,
];
$this->client->expects($this->any())->method('scanFile')->with('foopath')->willReturn($result);
@@ -77,11 +76,11 @@ class VirusScannerListenerTest extends PHPUnit_Framework_TestCase
{
$result = [
'filename' => 'footpath',
'reason' => 'Terrible virus',
'status' => Client::RESULT_FOUND
'reason' => 'Terrible virus',
'status' => Client::RESULT_FOUND,
];
$this->client->expects($this->any())
$this->client->expects($this->any())
->method('scanFile')
->with('foopath')
->willReturn($result);
@@ -94,7 +93,7 @@ class VirusScannerListenerTest extends PHPUnit_Framework_TestCase
}
/**
* @expectedException Xenolope\Quahog\Exception\ConnectionException
* @expectedException \Xenolope\Quahog\Exception\ConnectionException
*/
public function testGetClientFailed()
{
@@ -102,11 +101,9 @@ class VirusScannerListenerTest extends PHPUnit_Framework_TestCase
$this->listener->onFileUploadCompleted($this->event);
}
public function testGetClientSucceed()
{
$this->client->expects($this->any())->method('ping')->willReturn(true);
$this->listener->onFileUploadCompleted($this->event);
}
}
0 Assignees
None
Assign to
0 Reviewers
None
Request review from
Labels
0
None
0
None
    Assign labels
  • Manage project labels

Milestone
No milestone
None
None
Time tracking
No estimate or time spent
Lock merge request
Unlocked
0
0 Participants
Reference:
Source branch: antivirus

Menu

Explore Projects Groups Topics Snippets