Skip to content

Commit

Permalink
Merge pull request #3977 from thangnnmd/unitTest_UploadsController_tmp
Browse files Browse the repository at this point in the history
UploadsController::tmp() ユニットテスト
  • Loading branch information
HungDV2022 authored Nov 7, 2024
2 parents 23f95b5 + acdf7e6 commit 35ca18d
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 2 deletions.
1 change: 1 addition & 0 deletions plugins/baser-core/src/Controller/UploadsController.php
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ class UploadsController extends AppController
* @return \Cake\Http\Response
* @checked
* @noTodo
* @unitTest
*/
public function tmp()
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -48,8 +48,22 @@ public function tearDown(): void
*/
public function testTmp()
{
$this->markTestIncomplete('このテストは、まだ実装されていません。');
$this->get('/baser/baser-core/uploads/tmp/medium/00000001_eyecatch_png');
mkdir(TMP . 'uploads');
touch(TMP . 'uploads/test.gif');
copy(ROOT . '/plugins/bc-admin-third/webroot/img/baser.power.gif', TMP . 'uploads/test.gif');

$this->session([
'Upload.test_gif.data' => base64_encode(file_get_contents(TMP . 'uploads/test.gif')),
'Upload.test_gif.type' => 'image/gif',
'Upload.test_gif.imagecopy.medium' => ['width' => 100, 'height' => 100],
]);

$this->get('/baser-core/uploads/tmp/thumb/test.gif');
$this->assertResponseSuccess();
$this->assertNotEmpty($this->_controller->getResponse()->getBody());

@unlink(TMP . 'uploads/test.gif');
rmdir(TMP . 'uploads');
}
/**
* セッションに保存した一時ファイルを出力する
Expand Down

0 comments on commit 35ca18d

Please sign in to comment.