Template = new TestStringTemplate(); } /** * testInitStringTemplates */ public function testInitStringTemplates(): void { $templates = [ 'text' => '

{{text}}

', ]; $this->Template->setTemplates($templates); $this->assertEquals( [ 'text' => '

{{text}}

', ], $this->Template->getTemplates(), 'newly added template should be included in template list' ); } /** * test settings['templates'] */ public function testInitStringTemplatesArrayForm(): void { $this->Template->setConfig( 'templates.text', '

{{text}}

' ); $this->assertEquals( [ 'text' => '

{{text}}

', ], $this->Template->getTemplates(), 'Configured templates should be included in template list' ); } /** * testFormatStringTemplate */ public function testFormatStringTemplate(): void { $templates = [ 'text' => '

{{text}}

', ]; $this->Template->setTemplates($templates); $result = $this->Template->formatTemplate('text', [ 'text' => 'CakePHP', ]); $this->assertSame( '

CakePHP

', $result ); } /** * testGetTemplater */ public function testGetTemplater(): void { $templates = [ 'text' => '

{{text}}

', ]; $this->Template->setTemplates($templates); $result = $this->Template->templater(); $this->assertInstanceOf(StringTemplate::class, $result); } }