Skip to content

Commit 785311d

Browse files
committed
Add unit test for helper custom file
1 parent 0fd977e commit 785311d

File tree

3 files changed

+14
-2
lines changed

3 files changed

+14
-2
lines changed

phpunit.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@
2323
<file>tests/options.php</file>
2424
</testsuite>
2525
<testsuite name="helpers">
26-
<file>tests/dotHelper.php</file>
26+
<file>tests/helpers.php</file>
2727
</testsuite>
2828
<testsuite name="badSyntaxes">
2929
<file>tests/badSyntaxes.php</file>

tests/Plus.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
function ($base) {
22
foreach (array_slice(func_get_args(), 1) as $value) {
3-
$base = $base * $value;
3+
$base = $base - $value;
44
}
55

66
return $base;

tests/dotHelper.php renamed to tests/helpers.php

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -215,4 +215,16 @@ public function testDotObjectHelper()
215215
'a' => new MagicGetterWithNoIsset(),
216216
)));
217217
}
218+
219+
public function testHelperFile()
220+
{
221+
$jsPhpize = new JsPhpize(array(
222+
'helpers' => array(
223+
'plus' => __DIR__ . '/Plus.h',
224+
),
225+
'returnLastStatement' => true,
226+
));
227+
228+
$this->assertEquals(6, $jsPhpize->render('13 + 7'));
229+
}
218230
}

0 commit comments

Comments
 (0)