public function testGetVar() { $provider = new ArrayProvider(['test.htpl' => '{var}']); $htpl = new Htpl($provider); $htpl->assignArray(['level1' => ['level2' => ['foo' => 'bar']]]); $htpl->assign('testFoo', 'testBar'); $template = new Template($htpl, 'some template string'); $this->assertSame('bar', $template->getVar('level1.level2.foo', $htpl->getVars())); $this->assertSame('testBar', $template->getVar('testFoo', $htpl->getVars())); }
public function testAssign() { $provider = new ArrayProvider(['test.htpl' => '{var}']); $htpl = new Htpl($provider); $this->assertSame([], $htpl->getVars()); $htpl->assign('foo', 'bar'); $this->assertSame(['foo' => 'bar'], $htpl->getVars()); $htpl->assignArray(['test' => 'test']); $this->assertSame(['foo' => 'bar', 'test' => 'test'], $htpl->getVars()); }