File tree Expand file tree Collapse file tree 9 files changed +29
-21
lines changed Expand file tree Collapse file tree 9 files changed +29
-21
lines changed Original file line number Diff line number Diff line change 1
1
composer.lock
2
2
/vendor /
3
- /.idea /
3
+ /.idea /
Original file line number Diff line number Diff line change @@ -14,8 +14,9 @@ services:
14
14
15
15
before_install :
16
16
- docker-compose up -d
17
+ - sleep 60
17
18
18
19
before_script : composer install
19
20
20
21
script :
21
- - vendor/bin/phpunit --configuration phpunit.xml
22
+ - vendor/bin/phpunit
Original file line number Diff line number Diff line change 13
13
"autoload" : {
14
14
"psr-4" : {"Appwrite\\ ClamAV\\ " : " src/ClamAV" }
15
15
},
16
+ "autoload-dev" : {
17
+ "psr-4" : {"Utopia\\ Tests\\ " : " tests/ClamAV" }
18
+ },
16
19
"require" : {
17
20
"php" : " >=7.1"
18
21
},
19
22
"require-dev" : {
20
23
"phpunit/phpunit" : " ^7.0"
21
24
},
22
- "minimum-stability" : " dev "
25
+ "minimum-stability" : " stable "
23
26
}
Original file line number Diff line number Diff line change @@ -2,9 +2,9 @@ version: '3'
2
2
3
3
services :
4
4
clamav :
5
- image : appwrite/clamav:v1.0.2
5
+ image : appwrite/clamav:v1.0.3
6
6
restart : unless-stopped
7
7
ports :
8
8
- " 3310:3310"
9
9
volumes :
10
- - ./tests/data:/home:rw
10
+ - ./tests/data:/home:rw
Original file line number Diff line number Diff line change 1
- <phpunit backupGlobals =" false"
2
- backupStaticAttributes =" false"
3
- bootstrap =" vendor/autoload.php"
1
+ <?xml version =" 1.0" encoding =" utf-8" ?>
2
+ <phpunit bootstrap =" vendor/autoload.php"
4
3
colors =" true"
5
4
convertErrorsToExceptions =" true"
6
5
convertNoticesToExceptions =" true"
10
9
>
11
10
<testsuites >
12
11
<testsuite name =" Application Test Suite" >
13
- <directory >./tests/</directory >
12
+ <directory suffix = " Test.php " >./tests/</directory >
14
13
</testsuite >
15
14
</testsuites >
16
- </phpunit >
15
+ <filter >
16
+ <whitelist processUncoveredFilesFromWhitelist =" true" >
17
+ <directory suffix =" .php" >>./src</directory >
18
+ </whitelist >
19
+ </filter >
20
+ </phpunit >
Original file line number Diff line number Diff line change @@ -41,7 +41,7 @@ private function sendCommand($command)
41
41
public function ping ()
42
42
{
43
43
$ return = $ this ->sendCommand ('PING ' );
44
- return strcmp ($ return, 'PONG ' ) ? true : false ;
44
+ return trim ($ return) === 'PONG ' ;
45
45
}
46
46
47
47
/**
@@ -101,11 +101,11 @@ public function fileScan(string $file)
101
101
*/
102
102
public function continueScan (string $ file )
103
103
{
104
- $ return = array () ;
104
+ $ return = [] ;
105
105
106
106
foreach (explode ("\n" , trim ($ this ->sendCommand ('CONTSCAN ' . $ file ))) as $ results ) {
107
107
list ($ file , $ stats ) = explode (': ' , $ results );
108
- array_push ($ return , array ( 'file ' => $ file , 'stats ' => trim ($ stats ) ) );
108
+ array_push ($ return , [ 'file ' => $ file , 'stats ' => trim ($ stats ) ] );
109
109
}
110
110
111
111
return $ return ;
Original file line number Diff line number Diff line change @@ -45,4 +45,4 @@ protected function getSocket()
45
45
}
46
46
return $ socket ;
47
47
}
48
- }
48
+ }
Original file line number Diff line number Diff line change @@ -33,4 +33,4 @@ protected function getSocket()
33
33
socket_connect ($ socket , $ this ->pip );
34
34
return $ socket ;
35
35
}
36
- }
36
+ }
Original file line number Diff line number Diff line change @@ -29,13 +29,13 @@ class ClamAVTest extends TestCase
29
29
*/
30
30
protected $ pipe = null ;
31
31
32
- public function setUp ()
32
+ protected function setUp (): void
33
33
{
34
34
$ this ->network = new Network ('localhost ' , 3310 );
35
35
$ this ->pipe = new Pipe ();
36
36
}
37
37
38
- public function tearDown ()
38
+ protected function tearDown (): void
39
39
{
40
40
$ this ->network = null ;
41
41
$ this ->pipe = null ;
@@ -48,12 +48,12 @@ public function testVersion()
48
48
49
49
public function testPing ()
50
50
{
51
- $ this ->assertEquals ( true , $ this ->network ->ping ());
51
+ $ this ->assertTrue ( $ this ->network ->ping ());
52
52
}
53
53
54
54
public function testFileScan ()
55
55
{
56
- $ this ->assertEquals ( true , $ this ->network ->fileScan ('/home/NoVirus.txt ' ));
57
- $ this ->assertEquals ( false , $ this ->network ->fileScan ('/home/Virus.txt ' ));
56
+ $ this ->assertTrue ( $ this ->network ->fileScan ('/home/NoVirus.txt ' ));
57
+ $ this ->assertFalse ( $ this ->network ->fileScan ('/home/Virus.txt ' ));
58
58
}
59
- }
59
+ }
You can’t perform that action at this time.
0 commit comments