@@ -16,6 +16,7 @@ public function setUp(): void
1616
1717 /**
1818 * Load the package
19+ *
1920 * @return array the packages
2021 */
2122 protected function getPackageProviders ($ app )
@@ -26,7 +27,7 @@ protected function getPackageProviders($app)
2627 }
2728
2829 /** @test */
29- public function test_config_file_is_installed ()
30+ public function testConfigFileIsInstalled ()
3031 {
3132 // Run the Installation command
3233 Artisan::call ('vendor:publish ' , [
@@ -49,8 +50,10 @@ public function test_config_file_is_installed()
4950 $ this ->assertTrue ($ test2 );
5051 }
5152
52- /** @test */
53- public function test_listener_return_data ()
53+ /**
54+ * @depends testConfigFileIsInstalled
55+ */
56+ public function testListenerReturnData ()
5457 {
5558 // Set parameters for testing
5659 $ path = __DIR__ . '/resources/test.zip ' ;
@@ -68,8 +71,10 @@ public function test_listener_return_data()
6871 $ this ->assertEquals ($ pathTest , $ data [0 ]);
6972 }
7073
71- /** @test **/
72- public function test_correct_encrypter_engine ()
74+ /**
75+ * @depends testListenerReturnData
76+ */
77+ public function testCorrectEncrypterEngine ()
7378 {
7479 $ path = __DIR__ . '/resources/processed.zip ' ;
7580
@@ -87,8 +92,10 @@ public function test_correct_encrypter_engine()
8792 }
8893 }
8994
90- /** @test **/
91- public function test_encryption_protection ()
95+ /**
96+ * @depends testCorrectEncrypterEngine
97+ */
98+ public function testEncryptionProtection ()
9299 {
93100 // Test that the archive actually is encrypted and password protected
94101 $ path = __DIR__ . '/resources/processed.zip ' ;
@@ -102,6 +109,19 @@ public function test_encryption_protection()
102109 $ this ->assertEquals (1 , $ zipInfo ['backup.zip ' ]->getEncryptionMethod ());
103110 }
104111
112+ public function testRetrieveEncryptionConstants ()
113+ {
114+ $ encryption = new \Olssonm \BackupShield \Encryption ();
115+
116+ // Default
117+ $ this ->assertEquals ('257 ' , $ encryption ->getEncryptionConstant (\Olssonm \BackupShield \Encryption::ENCRYPTION_DEFAULT , 'ZipArchive ' ));
118+ $ this ->assertEquals (\PhpZip \Constants \ZipEncryptionMethod::PKWARE , $ encryption ->getEncryptionConstant (\Olssonm \BackupShield \Encryption::ENCRYPTION_DEFAULT , 'ZipFile ' ));
119+
120+ // AES 256
121+ $ this ->assertEquals ('259 ' , $ encryption ->getEncryptionConstant (\Olssonm \BackupShield \Encryption::ENCRYPTION_WINZIP_AES_256 , 'ZipArchive ' ));
122+ $ this ->assertEquals (\PhpZip \Constants \ZipEncryptionMethod::WINZIP_AES_256 , $ encryption ->getEncryptionConstant (\Olssonm \BackupShield \Encryption::ENCRYPTION_WINZIP_AES_256 , 'ZipFile ' ));
123+ }
124+
105125 /** Teardown */
106126 public static function tearDownAfterClass (): void
107127 {
0 commit comments