You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
61 lines
1.1 KiB
61 lines
1.1 KiB
11 years ago
|
<?php
|
||
|
|
||
11 years ago
|
namespace yiiunit\framework\mail;
|
||
11 years ago
|
|
||
11 years ago
|
use yii\mail\ViewResolver;
|
||
11 years ago
|
use Yii;
|
||
|
use yiiunit\TestCase;
|
||
|
|
||
|
/**
|
||
|
* @group email
|
||
|
*/
|
||
|
class ViewResolverTest extends TestCase
|
||
|
{
|
||
|
/**
|
||
|
* @var string test email view path.
|
||
|
*/
|
||
|
protected $testViewPath = '@yiiunit/emails';
|
||
|
|
||
11 years ago
|
/**
|
||
|
* Data provider for [[testFindViewFile()]]
|
||
|
* @return array test data.
|
||
|
*/
|
||
11 years ago
|
public function dataProviderFindViewFile()
|
||
|
{
|
||
|
$alias = '@yiiunit';
|
||
|
$aliasPath = Yii::getAlias($alias);
|
||
|
$viewPath = Yii::getAlias($this->testViewPath);
|
||
|
return [
|
||
|
[
|
||
|
$alias . '/test',
|
||
|
$aliasPath . '/test.php',
|
||
|
],
|
||
|
[
|
||
|
$alias . '/test.tpl',
|
||
|
$aliasPath . '/test.tpl',
|
||
|
],
|
||
|
[
|
||
|
'contact/html',
|
||
|
$viewPath . '/contact/html.php',
|
||
|
],
|
||
|
[
|
||
|
'contact/html.tpl',
|
||
|
$viewPath . '/contact/html.tpl',
|
||
|
],
|
||
|
];
|
||
|
}
|
||
|
|
||
|
/**
|
||
|
* @dataProvider dataProviderFindViewFile
|
||
|
*
|
||
|
* @param string $view
|
||
|
* @param string $expectedFileName
|
||
|
*/
|
||
|
public function testFindViewFile($view, $expectedFileName)
|
||
|
{
|
||
|
$viewResolver = new ViewResolver();
|
||
|
$viewResolver->viewPath = $this->testViewPath;
|
||
|
$fileName = $viewResolver->findViewFile($view);
|
||
|
$this->assertEquals($expectedFileName, $fileName);
|
||
|
}
|
||
|
}
|