Skip to content

Commit 0fd977e

Browse files
committed
Fix camel case helper names
1 parent dccfe6a commit 0fd977e

File tree

2 files changed

+23
-1
lines changed

2 files changed

+23
-1
lines changed

src/JsPhpize/Compiler/Compiler.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -82,7 +82,7 @@ public function compileDependencies($dependencies)
8282
$code = $name;
8383
$file = $name;
8484

85-
if (preg_match('/^[a-z0-9_-]+$/', $file)) {
85+
if (preg_match('/^[a-z0-9_-]+$/i', $file)) {
8686
$file = __DIR__ . '/Helpers/' . ucfirst($name) . '.h';
8787
}
8888

tests/dotHelper.php

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,14 @@ public function offsetUnset($name)
5151
}
5252
}
5353

54+
class MagicGetterWithNoIsset
55+
{
56+
public function __get($name)
57+
{
58+
return $name;
59+
}
60+
}
61+
5462
class DotHelperTest extends \PHPUnit_Framework_TestCase
5563
{
5664
protected function getDotHelper()
@@ -193,4 +201,18 @@ public function testCustomHelper()
193201
'a' => 'x',
194202
)));
195203
}
204+
205+
public function testDotObjectHelper()
206+
{
207+
$jsPhpize = new JsPhpize(array(
208+
'helpers' => array(
209+
'dot' => 'dotObject',
210+
),
211+
'returnLastStatement' => true,
212+
));
213+
214+
$this->assertEquals('hello', $jsPhpize->render('a.hello', array(
215+
'a' => new MagicGetterWithNoIsset(),
216+
)));
217+
}
196218
}

0 commit comments

Comments
 (0)