mirror of
https://gitee.com/fastadminnet/framework.git
synced 2026-07-04 06:12:48 +08:00
修正单元测试 删除controller类show方法 用 display方法替代
This commit is contained in:
@@ -124,17 +124,15 @@ class controllerTest extends \PHPUnit_Framework_TestCase
|
||||
$viewFetch = $view->fetch($template, ['name' => 'ThinkPHP']);
|
||||
$controllerFetch = $controller->fetch($template, ['name' => 'ThinkPHP']);
|
||||
$this->assertEquals($controllerFetch, $viewFetch);
|
||||
$controllerFetch = $controller->display($template, ['name' => 'ThinkPHP']);
|
||||
$this->assertEquals($controllerFetch, $viewFetch);
|
||||
}
|
||||
|
||||
public function testShow()
|
||||
public function testDisplay()
|
||||
{
|
||||
$controller = new Foo;
|
||||
$view = $this->getView($controller);
|
||||
$template = dirname(__FILE__) . '/display.html';
|
||||
$viewFetch = $view->show($template, ['name' => 'ThinkPHP']);
|
||||
$controllerFetch = $controller->show($template, ['name' => 'ThinkPHP']);
|
||||
$viewFetch = $view->display($template, ['name' => 'ThinkPHP']);
|
||||
$controllerFetch = $controller->display($template, ['name' => 'ThinkPHP']);
|
||||
$this->assertEquals($controllerFetch, $viewFetch);
|
||||
}
|
||||
|
||||
@@ -148,16 +146,6 @@ class controllerTest extends \PHPUnit_Framework_TestCase
|
||||
$this->assertAttributeEquals($expect, 'data', $view);
|
||||
}
|
||||
|
||||
public function testEngine()
|
||||
{
|
||||
$controller = new Foo;
|
||||
$view = $this->getView($controller);
|
||||
$view->engine = null;
|
||||
$this->assertEquals(null, $view->engine);
|
||||
$controller->engine('php');
|
||||
$this->assertEquals('php', $view->engine);
|
||||
}
|
||||
|
||||
public function testValidate()
|
||||
{
|
||||
$controller = new Foo;
|
||||
|
||||
@@ -319,14 +319,14 @@ EOF;
|
||||
$template = new Template();
|
||||
$template->assign('name', 'name');
|
||||
$config = [
|
||||
'strip_space' => true,
|
||||
'view_path' => dirname(__FILE__) . '/',
|
||||
'cache_id' => '__CACHE_ID__',
|
||||
'display_cache'=> true
|
||||
'strip_space' => true,
|
||||
'view_path' => dirname(__FILE__) . '/',
|
||||
'cache_id' => '__CACHE_ID__',
|
||||
'display_cache' => true,
|
||||
];
|
||||
$data = ['name' => 'value'];
|
||||
$template->layout('layout')->display('display', $data, $config);
|
||||
$this->expectOutputString('value');
|
||||
$this->expectOutputString('<div>value</div>');
|
||||
}
|
||||
|
||||
public function testFetch()
|
||||
@@ -385,7 +385,7 @@ EOF;
|
||||
$template->fetch($content);
|
||||
$this->expectOutputString($content2);
|
||||
// $template->parse($content);
|
||||
// var_dump($content);
|
||||
// var_dump($content);
|
||||
}
|
||||
|
||||
public function testVarAssign()
|
||||
@@ -406,7 +406,7 @@ EOF;
|
||||
|
||||
public function testIsCache()
|
||||
{
|
||||
$template = new Template(['cache_id' => '__CACHE_ID__','display_cache' => true]);
|
||||
$template = new Template(['cache_id' => '__CACHE_ID__', 'display_cache' => true]);
|
||||
$this->assertTrue(!$template->isCache('__CACHE_ID__'));
|
||||
$template->display_cache = false;
|
||||
$this->assertTrue(!$template->isCache('__CACHE_ID__'));
|
||||
|
||||
Reference in New Issue
Block a user