-
Notifications
You must be signed in to change notification settings - Fork 131
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #3952 from thangnnmd/unitTest_BcThemeConfigControl…
…lerEventListener_baserCoreThemesAfterApply BcThemeConfigControllerEventListener::baserCoreThemesAfte…
- Loading branch information
Showing
2 changed files
with
43 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
40 changes: 40 additions & 0 deletions
40
plugins/bc-theme-config/tests/TestCase/Event/BcThemeConfigControllerEventListenerTest.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
<?php | ||
|
||
namespace BcThemeConfig\Test\TestCase\Event; | ||
|
||
use BaserCore\TestSuite\BcTestCase; | ||
use BcThemeConfig\Event\BcThemeConfigControllerEventListener; | ||
use Cake\Event\Event; | ||
|
||
class BcThemeConfigControllerEventListenerTest extends BcTestCase | ||
{ | ||
public function setUp(): void | ||
{ | ||
parent::setUp(); | ||
$this->BcThemeConfigControllerEventListener = new BcThemeConfigControllerEventListener(); | ||
} | ||
|
||
public function tearDown(): void | ||
{ | ||
parent::tearDown(); | ||
} | ||
|
||
/** | ||
* Test baserCoreThemesAfterApply | ||
*/ | ||
public function test_baserCoreThemesAfterApply() | ||
{ | ||
$path = WWW_ROOT . 'files' . DS . 'theme_configs' . DS . 'config.css'; | ||
|
||
if (!is_dir(dirname($path))) { | ||
mkdir(dirname($path), 0777, true); | ||
} | ||
file_put_contents($path, 'test content'); | ||
$this->assertFileExists($path); | ||
|
||
$event = new Event('BaserCore.Themes.afterApply'); | ||
$this->BcThemeConfigControllerEventListener->baserCoreThemesAfterApply($event); | ||
|
||
$this->assertFileDoesNotExist($path); | ||
} | ||
} |