Skip to content

Commit 5775ea4

Browse files
committed
firebase/php-jwt のアップデートによりテストが失敗するようになったので調整
1 parent 5419f18 commit 5775ea4

3 files changed

Lines changed: 19 additions & 1 deletion

File tree

plugins/baser-core/src/Command/CreateReleaseCommand.php

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@
1414
use BaserCore\Utility\BcComposer;
1515
use BaserCore\Utility\BcFile;
1616
use BaserCore\Utility\BcFolder;
17+
use BaserCore\Utility\BcUtil;
1718
use Cake\Command\Command;
1819
use Cake\Console\Arguments;
1920
use Cake\Console\ConsoleIo;
@@ -77,6 +78,9 @@ public function execute(Arguments $args, ConsoleIo $io)
7778

7879
$io->out(__d('baser_core', '- composer.json / composer.lock をセットアップします。'));
7980
BcComposer::setup('', $packagePath);
81+
if(BcUtil::isTest()) {
82+
BcComposer::disableBlockInsecure();
83+
}
8084
$result = BcComposer::setupComposerForDistribution($version);
8185
if($result['code'] === 0) {
8286
$io->out(__d('baser_core', '- Composer による lock ファイルの更新が完了しました。'));

plugins/baser-core/src/Utility/BcComposer.php

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -312,4 +312,14 @@ public static function deleteReplace()
312312
$file->write($json);
313313
}
314314

315+
public static function disableBlockInsecure()
316+
{
317+
$file = new BcFile(self::$currentDir . 'composer.json');
318+
$json = $file->read();
319+
$data = json_decode($json, true);
320+
$data['config']['audit']['block-insecure'] = false;
321+
$json = json_encode($data, JSON_PRETTY_PRINT | JSON_UNESCAPED_UNICODE | JSON_UNESCAPED_SLASHES);
322+
$file->write($json);
323+
}
324+
315325
}

plugins/baser-core/tests/TestCase/Utility/BcComposerTest.php

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -128,10 +128,12 @@ public function test_require()
128128
$data = $file->read();
129129
$regex = '/("replace": {.+?},)/s';
130130
$data = str_replace('"cakephp/cakephp": "5.0.*"', '"cakephp/cakephp": "5.0.10"', $data);
131+
$data = str_replace('"firebase/php-jwt": "7.0.2"', '"firebase/php-jwt": "6.1.0"', $data);
131132
$data = preg_replace($regex, '', $data);
132133
$file->write($data);
133134
BcComposer::setup('php');
134135
BcComposer::deleteReplace();
136+
BcComposer::disableBlockInsecure();
135137
BcComposer::update();
136138

137139
// インストール
@@ -190,10 +192,11 @@ public function testUpdate()
190192
$data = $file->read();
191193
$regex = '/("replace": {.+?},)/s';
192194
$data = str_replace('"cakephp/cakephp": "5.0.*"', '"cakephp/cakephp": "5.0.10"', $data);
195+
$data = str_replace('"firebase/php-jwt": "7.0.2"', '"firebase/php-jwt": "6.1.0"', $data);
193196
$data = preg_replace($regex, '', $data);
194197
$file->write($data);
195198
BcComposer::setup('php');
196-
199+
BcComposer::disableBlockInsecure();
197200
$rs = BcComposer::update();
198201
//戻り値を確認
199202
$this->assertEquals(0, $rs['code']);
@@ -265,6 +268,7 @@ public function testSetupComposerForDistribution()
265268

266269
// 実行
267270
BcComposer::setup('', TMP_TESTS);
271+
BcComposer::disableBlockInsecure();
268272
BcComposer::setupComposerForDistribution('5.2.0');
269273
$file = new BcFile($composerJson);
270274
$data = $file->read();

0 commit comments

Comments
 (0)