Commit 9b4f1673 authored by Predhumeau Manon's avatar Predhumeau Manon Committed by Guillaume Perréal
Browse files

Correction des tests de VirusScannerListener.

parent 9a3815cc
......@@ -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);
}
......
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