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

Correction des tests de VirusScannerListener.

Showing with 6 additions and 6 deletions
+6 -6
......@@ -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);
}
......
Supports Markdown
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