Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Dev: Add unit-test class for template controller
- Loading branch information
1 parent
afe1019
commit 0af681d
Showing
2 changed files
with
48 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
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,45 @@ | ||
<?php | ||
|
||
namespace ls\tests; | ||
|
||
use PHPUnit\Framework\TestCase; | ||
|
||
/** | ||
* @since 2017-10-15 | ||
* @group tempcontr | ||
*/ | ||
class TemplateControllerTest extends TestBaseClass | ||
{ | ||
|
||
/** | ||
* Test copy a template. | ||
*/ | ||
public function testCopyTemplate() | ||
{ | ||
\Yii::app()->session['loginID'] = 1; | ||
\Yii::import('application.controllers.admin.templates', true); | ||
\Yii::import('application.helpers.globalsettings_helper', true); | ||
|
||
// Clean up from last test. | ||
\Template::model()->deleteAll('name = \'foobartest\''); | ||
|
||
// Remove folder from last test. | ||
$newname = 'foobartest'; | ||
$newdirname = \Yii::app()->getConfig('usertemplaterootdir') . "/" . $newname; | ||
@exec('rm -r ' . $newdirname); | ||
|
||
// Simulate a POST. | ||
$_POST['newname'] = $newname; | ||
$_POST['copydir'] = 'default'; | ||
|
||
$contr = new \templates(new DummyController('dummyid')); | ||
$contr->templatecopy(); | ||
} | ||
|
||
/** | ||
* @todo Copy template folder that does not exist. | ||
*/ | ||
public function testCopyWrongFolder() | ||
{ | ||
} | ||
} |