File tree Expand file tree Collapse file tree 6 files changed +26
-28
lines changed
Expand file tree Collapse file tree 6 files changed +26
-28
lines changed Original file line number Diff line number Diff line change 22composer.lock
33.DS_Store
44.phpunit.result.cache
5+ * .old
Original file line number Diff line number Diff line change @@ -13,15 +13,6 @@ script:
1313
1414jobs :
1515 include :
16- - php : 7.1
17- env :
18- - ILLUMINATE_VERSION=5.8.*
19- - php : 7.2.24
20- env :
21- - ILLUMINATE_VERSION=5.8.*
22- - php : 7.2.24
23- env :
24- - ILLUMINATE_VERSION=6.0.*
2516 - php : 7.2.24
2617 env :
2718 - ILLUMINATE_VERSION=7.0.*
3728 - php : 7.4
3829 env :
3930 - ILLUMINATE_VERSION=^7.0
31+ - php : 7.3
32+ env :
33+ - ILLUMINATE_VERSION=^8.0
34+ - php : 7.4
35+ env :
36+ - ILLUMINATE_VERSION=^8.0
Original file line number Diff line number Diff line change @@ -21,8 +21,6 @@ Backup Shield simply listens for when the .zip-file generated by Laravel-backup
2121composer require olssonm/laravel-backup-shield
2222```
2323
24- Supports ` laravel/framework: "^5.8" ` and above (including Laravel 6 & 7.) Requires ` PHP: "^7.1" ` .
25-
2624Please note that ` spatie/laravel-backup: "^6" ` and ` laravel/framework: "^6.0|^7.0" ` requires PHP 7.2.
2725
2826## Configuration
Original file line number Diff line number Diff line change 1818 }
1919 ],
2020 "require" : {
21- "php" : " >=7.1 " ,
22- "illuminate/support" : " ~5.8| ^6.0|^7.0" ,
21+ "php" : " ^7.2 " ,
22+ "illuminate/support" : " ^6.0|^7.0|^8 .0" ,
2323 "nelexa/zip" : " 3.3" ,
24- "spatie/laravel-backup" : " ~5.0|~ 6.0"
24+ "spatie/laravel-backup" : " ~6.0"
2525 },
2626 "require-dev" : {
27- "phpunit/phpunit" : " ^7.5|^8 .0" ,
28- "orchestra/testbench" : " ^3.8|^4|^5 "
27+ "phpunit/phpunit" : " ^8.0|^9 .0" ,
28+ "orchestra/testbench" : " ^4.0|^5.0|^6.0 "
2929 },
3030 "autoload" : {
3131 "psr-4" : {
Original file line number Diff line number Diff line change 33namespace Olssonm \BackupShield ;
44
55use Illuminate \Foundation \Support \Providers \EventServiceProvider as ServiceProvider ;
6+ use Illuminate \Support \Facades \Event ;
7+
68use Olssonm \BackupShield \Factories \Password ;
79use Olssonm \BackupShield \Encryption ;
810
11+ use Spatie \Backup \Events \BackupZipWasCreated ;
12+ use Olssonm \BackupShield \Listeners \PasswordProtectZip ;
13+
914/**
1015 * Laravel service provider for the Backup Shield-package
1116 */
1217class BackupShieldServiceProvider extends ServiceProvider
1318{
14- /**
15- * Register listener to the "BackupZipWasCreated" event
16- * @var array
17- */
18- protected $ listen = [
19- 'Spatie\Backup\Events\BackupZipWasCreated ' => [
20- 'Olssonm\BackupShield\Listeners\PasswordProtectZip ' ,
21- ],
22- ];
23-
2419 /**
2520 * Config-path
2621 * @var string
@@ -50,6 +45,12 @@ public function boot() : void
5045 $ this ->config => config_path ('backup-shield.php ' ),
5146 ]);
5247
48+ // Listen for the "BackupZipWasCreated" event
49+ Event::listen (
50+ BackupZipWasCreated::class,
51+ PasswordProtectZip::class
52+ );
53+
5354 parent ::boot ();
5455 }
5556
Original file line number Diff line number Diff line change @@ -16,7 +16,7 @@ public function setUp(): void
1616
1717 /**
1818 * Load the package
19- *
19+ *
2020 * @return array the packages
2121 */
2222 protected function getPackageProviders ($ app )
@@ -59,13 +59,14 @@ public function testListenerReturnData()
5959 $ path = __DIR__ . '/resources/test.zip ' ;
6060 $ pathTest = __DIR__ . '/resources/processed.zip ' ;
6161
62- // Make backup
62+ // Make file ready for testing
6363 copy ($ path , $ pathTest );
6464
6565 // Manually set config
6666 config ()->set ('backup-shield.password ' , 'M79Y6aKARXa9yLrcZd3srz ' );
6767 config ()->set ('backup-shield.encryption ' , \Olssonm \BackupShield \Encryption::ENCRYPTION_WINZIP_AES_256 );
6868
69+ // Fire event
6970 $ data = event (new BackupZipWasCreated ($ pathTest ));
7071
7172 $ this ->assertEquals ($ pathTest , $ data [0 ]);
You can’t perform that action at this time.
0 commit comments