|
21 | 21 | it('can zip file from string', function (): void { |
22 | 22 | $target = storage_path('test.zip'); |
23 | 23 |
|
24 | | - Zipper::open($target) |
| 24 | + Zipper::write($target) |
25 | 25 | ->addFromString('test.txt', 'test') |
26 | 26 | ->close(); |
27 | 27 |
|
|
33 | 33 | it('can zip file from path', function (): void { |
34 | 34 | $target = storage_path('test.zip'); |
35 | 35 |
|
36 | | - Zipper::open($target) |
| 36 | + Zipper::write($target) |
37 | 37 | ->addFile(__FILE__) |
38 | 38 | ->close(); |
39 | 39 |
|
|
45 | 45 | it('can zip directory', function (): void { |
46 | 46 | $path = storage_path('test.zip'); |
47 | 47 |
|
48 | | - Zipper::open($path)->addDirectory(config('backup.content_path'), 'example'); |
| 48 | + Zipper::write($path)->addDirectory(config('backup.content_path'), 'example'); |
49 | 49 |
|
50 | 50 | expect($path)->toBeString(); |
51 | 51 | expect(file_exists($path))->toBeTrue(); |
|
54 | 54 | it('can unzip file', function (): void { |
55 | 55 | $target = storage_path('test.zip'); |
56 | 56 |
|
57 | | - Zipper::open($target) |
| 57 | + Zipper::write($target) |
58 | 58 | ->addFromString('test.txt', 'test') |
59 | 59 | ->close(); |
60 | 60 |
|
61 | 61 | $unzip = storage_path('unzip'); |
62 | 62 |
|
63 | | - Zipper::open($target, true) |
| 63 | + Zipper::read($target) |
64 | 64 | ->extractTo($unzip) |
65 | 65 | ->close(); |
66 | 66 |
|
|
70 | 70 | it('can unzip file to directory', function (): void { |
71 | 71 | $target = storage_path('test.zip'); |
72 | 72 |
|
73 | | - Zipper::open($target)->addFromString('test.txt', 'test'); |
| 73 | + Zipper::write($target) |
| 74 | + ->addFromString('test.txt', 'test') |
| 75 | + ->close(); |
74 | 76 |
|
75 | 77 | $unzip = storage_path('test'); |
76 | | - Zipper::open($target, true) |
| 78 | + Zipper::read($target) |
77 | 79 | ->extractTo($unzip) |
78 | 80 | ->close(); |
79 | 81 |
|
|
88 | 90 |
|
89 | 91 | $target = storage_path('test.zip'); |
90 | 92 |
|
91 | | - Zipper::open($target)->addDirectory(config('backup.content_path'), 'example'); |
| 93 | + Zipper::write($target) |
| 94 | + ->addDirectory(config('backup.content_path'), 'example') |
| 95 | + ->close(); |
92 | 96 |
|
93 | 97 | $unzip = storage_path('unzipdir'); |
94 | | - Zipper::open($target, true) |
| 98 | + Zipper::read($target) |
95 | 99 | ->extractTo($unzip) |
96 | 100 | ->close(); |
97 | 101 |
|
|
108 | 112 | // @mago-ignore security/no-literal-password |
109 | 113 | $password = 'password'; |
110 | 114 |
|
111 | | - Zipper::open($target) |
| 115 | + Zipper::write($target) |
112 | 116 | ->addFromString('test.txt', 'test') |
113 | 117 | ->encrypt($password) |
114 | 118 | ->close(); |
|
118 | 122 |
|
119 | 123 | $unzip = storage_path('unzip'); |
120 | 124 |
|
121 | | - Zipper::open($target, true) |
| 125 | + Zipper::read($target) |
122 | 126 | ->extractTo($unzip, $password) |
123 | 127 | ->close(); |
124 | 128 |
|
|
129 | 133 | it('can write meta to zip', function (): void { |
130 | 134 | $target = storage_path('test.zip'); |
131 | 135 |
|
132 | | - Zipper::open($target) |
| 136 | + Zipper::write($target) |
133 | 137 | ->addFromString('test.txt', 'test') |
134 | 138 | ->addMeta('test', 'test') |
135 | 139 | ->close(); |
136 | 140 |
|
137 | | - $zip = Zipper::open($target, true); |
| 141 | + $zip = Zipper::read($target); |
138 | 142 |
|
139 | 143 | expect($zip->getMeta())->toHaveKey('test'); |
140 | 144 | expect($zip->getMeta()) |
|
0 commit comments