Skip to content

Commit

Permalink
Merge pull request #4083 from thangnnmd/unitTest_MailFieldsController…
Browse files Browse the repository at this point in the history
…_checkEnv

MailFieldsController::checkEnv
  • Loading branch information
HungDV2022 authored Dec 17, 2024
2 parents 049c995 + 07afcc7 commit 5a18b0b
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,7 @@ public function beforeFilter(EventInterface $event)
* プラグインの環境をチェックする
* @checked
* @noTodo
* @unitTest
*/
protected function _checkEnv()
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,8 @@
use BaserCore\Test\Scenario\InitAppScenario;
use BaserCore\TestSuite\BcTestCase;
use BaserCore\Utility\BcContainerTrait;
use BaserCore\Utility\BcFile;
use BaserCore\Utility\BcFolder;
use BcMail\Controller\Admin\MailFieldsController;
use BcMail\Service\Admin\MailFieldsAdminServiceInterface;
use BcMail\Service\MailFieldsServiceInterface;
Expand Down Expand Up @@ -469,4 +471,19 @@ public function testAdmin_unpublish()
//check redirect
$this->assertRedirect('/baser/admin/bc-mail/mail_fields/index/1');
}

/**
* _checkEnv
*/
public function test_checkEnv()
{
$folderPath = '/var/www/html/webroot/files/mail/limited';
$folder = new BcFolder($folderPath);
$folder->delete();

$this->execPrivateMethod($this->MailFieldsController, '_checkEnv');
$this->assertTrue(is_dir($folderPath));
$file = new BcFile($folderPath . DS . '.htaccess');
$this->assertTextContains('Order allow', $file->read());
}
}

0 comments on commit 5a18b0b

Please sign in to comment.