Skip to content
This repository was archived by the owner on May 27, 2022. It is now read-only.

Commit 2cf6030

Browse files
committed
Recreate regression tests
1 parent 29262c1 commit 2cf6030

File tree

2 files changed

+21
-6
lines changed

2 files changed

+21
-6
lines changed

test/CompressAndEncryptAdapterTest.php

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -198,15 +198,22 @@ public function writing_a_file_writes_a_compressed_and_encrypted_file(): void
198198
public function regression(): void
199199
{
200200
$key = 'RjWFkMrJS4Jd5TDdhYJNAWdfSEL5nptu4KQHgkeKGI0=';
201-
$content = base64_decode('IZS+uLwIi3vfk+/txrq+7V7vQ0GGN9cwWetC8p/IRMstNUFfxB363Dt1jwxM7LbK3M4EX4earQ==', true);
202-
201+
$originalPlain = 'foobar';
203202
$adapter = new CompressAndEncryptAdapter(
204203
new LocalFilesystemAdapter($this->remoteMock),
205204
$key
206205
);
206+
207+
// To recreate assets, uncomment following lines
208+
// $adapter->write('/file.txt', $originalPlain, new Config());
209+
// var_dump(
210+
// base64_encode(file_get_contents($this->remoteMock.'/file.txt'.CompressAndEncryptAdapter::REMOTE_FILE_EXTENSION))
211+
// ); exit;
212+
213+
$content = base64_decode('Zp1CKRNAdEebRInjHnuJwuG1gI2owWedBVboddwd+sW4AKv/3a112UjHnlpJntUUZgPBStuSFw==', true);
207214
file_put_contents($this->remoteMock.'/file.txt'.CompressAndEncryptAdapter::REMOTE_FILE_EXTENSION, $content);
208215

209-
static::assertSame('foobar', $adapter->read('/file.txt'));
216+
static::assertSame($originalPlain, $adapter->read('/file.txt'));
210217
}
211218

212219
/**

test/EncryptorStreamFilterTest.php

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -135,18 +135,26 @@ public function consecutive_filtering(): void
135135
public function regression(): void
136136
{
137137
$key = base64_decode('Z+Ry4nDufKcJ19pU2pEMgGiac9GBWFjEV18Cpb9jxRM=', true);
138-
$cipher = base64_decode('PMRzbW/xSj1WPnXp0DknCZvmM1Lv1XCYNbQH5wHozLpULVaGnoq7kVOuhg5Guew=', true);
139-
138+
$originalPlain = 'foobar';
140139
EncryptorStreamFilter::register();
141140

141+
// To recreate assets, uncomment following lines
142+
// $cipherStream = $this->streamFromContents($content);
143+
// EncryptorStreamFilter::appendEncryption($cipherStream, $key);
144+
// $cipher = stream_get_contents($cipherStream);
145+
// fclose($cipherStream);
146+
// var_dump(base64_encode($cipher)); exit;
147+
148+
$cipher = base64_decode('UbQpWpd03RyW8a2YiVQSlkmfeEN76IgkN67yPRb7UoXcxUeL7LmUGizXL7zwbtc=', true);
149+
142150
$plainStream = $this->streamFromContents($cipher);
143151
EncryptorStreamFilter::appendDecryption($plainStream, $key);
144152

145153
$plain = stream_get_contents($plainStream);
146154

147155
fclose($plainStream);
148156

149-
static::assertSame('foobar', $plain);
157+
static::assertSame($originalPlain, $plain);
150158
}
151159

152160
/**

0 commit comments

Comments
 (0)