From 9b4f16732a307c27d3e43cd1c72957bf5ff9ff2e Mon Sep 17 00:00:00 2001 From: Predhumeau Manon <manon.predhumeau@irstea.fr> Date: Fri, 20 Oct 2017 11:09:24 +0200 Subject: [PATCH] Correction des tests de VirusScannerListener. --- Tests/Listener/VirusScannerListenerTest.php | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/Tests/Listener/VirusScannerListenerTest.php b/Tests/Listener/VirusScannerListenerTest.php index c3db1fe0..90319105 100644 --- a/Tests/Listener/VirusScannerListenerTest.php +++ b/Tests/Listener/VirusScannerListenerTest.php @@ -64,8 +64,8 @@ class VirusScannerListenerTest extends PHPUnit_Framework_TestCase 'status' => Client::RESULT_OK ]; - $this->client->expects($this->any())->method('scanFile')->with('foopath')->willReturn($result); - $this->file->expects($this->any())->method('setMetadata')->with(['virus_scanner' => ['has_virus' => false]]); + $this->client->expects($this->once())->method('scanFile')->with('foopath')->willReturn($result); + $this->file->expects($this->once())->method('setMetadata')->with(['virus_scanner' => ['has_virus' => false]]); $this->listener->onFileUploadCompleted($this->event); } @@ -81,12 +81,12 @@ class VirusScannerListenerTest extends PHPUnit_Framework_TestCase 'status' => Client::RESULT_FOUND ]; - $this->client->expects($this->any()) + $this->client->expects($this->once()) ->method('scanFile') ->with('foopath') ->willReturn($result); - $this->file->expects($this->any()) + $this->file->expects($this->once()) ->method('setMetadata') ->with(['virus_scanner' => ['has_virus' => true, 'detected' => 'Terrible virus']]); @@ -98,14 +98,14 @@ class VirusScannerListenerTest extends PHPUnit_Framework_TestCase */ public function testGetClientFailed() { - $this->client->expects($this->any())->method('ping')->willThrowException(new ConnectionException()); + $this->client->expects($this->once())->method('ping')->willThrowException(new ConnectionException()); $this->listener->onFileUploadCompleted($this->event); } public function testGetClientSucceed() { - $this->client->expects($this->any())->method('ping')->willReturn(true); + $this->client->expects($this->once())->method('ping')->willReturn(true); $this->listener->onFileUploadCompleted($this->event); } -- GitLab