Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
Pôle IS
Bundles Symfony 2
file-upload-bundle
Commits
9b4f1673
Commit
9b4f1673
authored
Oct 20, 2017
by
Predhumeau Manon
Committed by
Guillaume Perréal
Jul 24, 2018
Browse files
Correction des tests de VirusScannerListener.
parent
9a3815cc
Changes
1
Hide whitespace changes
Inline
Side-by-side
Tests/Listener/VirusScannerListenerTest.php
View file @
9b4f1673
...
...
@@ -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
);
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment