Skip to content
This repository has been archived by the owner on Jan 31, 2020. It is now read-only.

Commit

Permalink
Merge branch 'feature/3996' into develop
Browse files Browse the repository at this point in the history
  • Loading branch information
weierophinney committed Mar 12, 2013
2 parents 7d8f2d3 + 3709a3c commit f44e0b5
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 1 deletion.
5 changes: 4 additions & 1 deletion src/Resolver/TemplatePathStack.php
Original file line number Diff line number Diff line change
Expand Up @@ -105,6 +105,9 @@ public function setOptions($options)
case 'use_stream_wrapper':
$this->setUseStreamWrapper($value);
break;
case 'default_suffix':
$this->setDefaultSuffix($value);
break;
default:
break;
}
Expand Down Expand Up @@ -296,7 +299,7 @@ public function resolve($name, Renderer $renderer = null)

// Ensure we have the expected file extension
$defaultSuffix = $this->getDefaultSuffix();
if (pathinfo($name, PATHINFO_EXTENSION) != $defaultSuffix) {;
if (pathinfo($name, PATHINFO_EXTENSION) == '') {
$name .= '.' . $defaultSuffix;
}

Expand Down
3 changes: 3 additions & 0 deletions test/TemplatePathStackTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -186,6 +186,7 @@ public function validOptions()
$options = array(
'lfi_protection' => false,
'use_stream_wrapper' => true,
'default_suffix' => 'php',
);
return array(
array($options),
Expand All @@ -205,6 +206,8 @@ public function testAllowsSettingOptions($arg)
$expected = (bool) ini_get('short_open_tag');
$this->assertSame($expected, $this->stack->useStreamWrapper());

$this->assertSame($arg['default_suffix'], $this->stack->getDefaultSuffix());

$this->assertEquals(array_reverse($this->paths), $this->stack->getPaths()->toArray());
}

Expand Down

0 comments on commit f44e0b5

Please sign in to comment.