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 11composer.lock
22/vendor /
3- /.idea /
3+ /.idea /
Original file line number Diff line number Diff line change @@ -14,8 +14,9 @@ services:
1414
1515before_install :
1616- docker-compose up -d
17+ - sleep 60
1718
1819before_script : composer install
1920
2021script :
21- - vendor/bin/phpunit --configuration phpunit.xml
22+ - vendor/bin/phpunit
Original file line number Diff line number Diff line change 1313 "autoload" : {
1414 "psr-4" : {"Appwrite\\ ClamAV\\ " : " src/ClamAV" }
1515 },
16+ "autoload-dev" : {
17+ "psr-4" : {"Utopia\\ Tests\\ " : " tests/ClamAV" }
18+ },
1619 "require" : {
1720 "php" : " >=7.1"
1821 },
1922 "require-dev" : {
2023 "phpunit/phpunit" : " ^7.0"
2124 },
22- "minimum-stability" : " dev "
25+ "minimum-stability" : " stable "
2326}
Original file line number Diff line number Diff line change @@ -2,9 +2,9 @@ version: '3'
22
33services :
44 clamav :
5- image : appwrite/clamav:v1.0.2
5+ image : appwrite/clamav:v1.0.3
66 restart : unless-stopped
77 ports :
88 - " 3310:3310"
99 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"
43 colors =" true"
54 convertErrorsToExceptions =" true"
65 convertNoticesToExceptions =" true"
109 >
1110 <testsuites >
1211 <testsuite name =" Application Test Suite" >
13- <directory >./tests/</directory >
12+ <directory suffix = " Test.php " >./tests/</directory >
1413 </testsuite >
1514 </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)
4141 public function ping ()
4242 {
4343 $ return = $ this ->sendCommand ('PING ' );
44- return strcmp ($ return, 'PONG ' ) ? true : false ;
44+ return trim ($ return) === 'PONG ' ;
4545 }
4646
4747 /**
@@ -101,11 +101,11 @@ public function fileScan(string $file)
101101 */
102102 public function continueScan (string $ file )
103103 {
104- $ return = array () ;
104+ $ return = [] ;
105105
106106 foreach (explode ("\n" , trim ($ this ->sendCommand ('CONTSCAN ' . $ file ))) as $ results ) {
107107 list ($ file , $ stats ) = explode (': ' , $ results );
108- array_push ($ return , array ( 'file ' => $ file , 'stats ' => trim ($ stats ) ) );
108+ array_push ($ return , [ 'file ' => $ file , 'stats ' => trim ($ stats ) ] );
109109 }
110110
111111 return $ return ;
Original file line number Diff line number Diff line change @@ -45,4 +45,4 @@ protected function getSocket()
4545 }
4646 return $ socket ;
4747 }
48- }
48+ }
Original file line number Diff line number Diff line change @@ -33,4 +33,4 @@ protected function getSocket()
3333 socket_connect ($ socket , $ this ->pip );
3434 return $ socket ;
3535 }
36- }
36+ }
Original file line number Diff line number Diff line change @@ -29,13 +29,13 @@ class ClamAVTest extends TestCase
2929 */
3030 protected $ pipe = null ;
3131
32- public function setUp ()
32+ protected function setUp (): void
3333 {
3434 $ this ->network = new Network ('localhost ' , 3310 );
3535 $ this ->pipe = new Pipe ();
3636 }
3737
38- public function tearDown ()
38+ protected function tearDown (): void
3939 {
4040 $ this ->network = null ;
4141 $ this ->pipe = null ;
@@ -48,12 +48,12 @@ public function testVersion()
4848
4949 public function testPing ()
5050 {
51- $ this ->assertEquals ( true , $ this ->network ->ping ());
51+ $ this ->assertTrue ( $ this ->network ->ping ());
5252 }
5353
5454 public function testFileScan ()
5555 {
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 ' ));
5858 }
59- }
59+ }
You can’t perform that action at this time.
0 commit comments