This commit is contained in:
Julio Cesar Laura Avendaño
2019-09-26 09:21:11 -04:00
parent b7d108cfc7
commit 1bf4429ac9
2 changed files with 43 additions and 0 deletions

View File

@@ -38,6 +38,16 @@ class SmartyView extends View
}
}
/**
* Get "smarty" property
*
* @return Smarty
*/
public function getSmarty()
{
return $this->smarty;
}
/**
* Assign a value to a Smarty piece in the template
*

View File

@@ -0,0 +1,33 @@
<?php
namespace Tests\unit\framework\src\Maveriks\Pattern\Mvc;
use Maveriks\Pattern\Mvc\SmartyView;
use Smarty;
use Tests\TestCase;
class SmartyViewTest extends TestCase
{
/**
* Test the constructor of the SmartyView class
*
* @test
*
* @covers \Maveriks\Pattern\Mvc\SmartyView::__construct()
*/
public function it_should_test_the_class_constructor()
{
// Instance class SmartyView
$smartyView = new SmartyView();
// Get "smarty" property
$smartyInstance = $smartyView->getSmarty();
// Assert correct class instance
$this->assertInstanceOf(Smarty::class, $smartyInstance);
// Assert that the required folders exist
$this->assertDirectoryExists($smartyInstance->compile_dir);
$this->assertDirectoryExists($smartyInstance->cache_dir);
}
}