Skip to content

Commit aad6b5a

Browse files
committed
Simplify cleanup code
1 parent e692e2c commit aad6b5a

File tree

1 file changed

+3
-7
lines changed

1 file changed

+3
-7
lines changed

src/test/php/com/amazon/aws/lambda/unittest/PackagingTest.class.php

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
use xp\lambda\{PackageLambda, Sources};
1111

1212
class PackagingTest {
13-
private $archives= [], $cleanup= [];
13+
private $cleanup= [];
1414

1515
/** Creates a new temporary folder */
1616
private function tempDir(): Folder {
@@ -69,15 +69,11 @@ private function package(Sources $sources): ZipIterator {
6969
}
7070

7171
// Remember to close the archive
72-
$this->archives[]= $zip= ZipFile::open($target);
73-
return $zip->iterator();
72+
return ZipFile::open($target)->iterator();
7473
}
7574

7675
#[After]
7776
private function cleanup() {
78-
foreach ($this->files as $file) {
79-
$file->close();
80-
}
8177
foreach ($this->cleanup as $folder) {
8278
$this->removeDir($folder);
8379
}
@@ -127,7 +123,7 @@ public function test_sources_ignored($test) {
127123
$path= $this->create([
128124
'src' => [Sources::IS_FOLDER, 0755],
129125
$test => [Sources::IS_FOLDER, 0755],
130-
$test.'/t.sh' => [Sources::IS_FILE, 'Test'],
126+
$test.'/t.sh' => [Sources::IS_FILE, '#!/bin/sh ...'],
131127
'src/file.txt' => [Sources::IS_FILE, 'Test']
132128
]);
133129
$zip= $this->package(new Sources($path, ['src']));

0 commit comments

Comments
 (0)