mirror of
https://github.com/silverstripe/silverstripe-framework
synced 2024-10-22 14:05:37 +02:00
Merge pull request #10912 from kinglozzer/10911-template-regression
FIX: Regression with include argument (fixes #10911)
This commit is contained in:
commit
4ccfc371c6
@ -377,7 +377,7 @@ class SSViewer_DataPresenter extends SSViewer_Scope
|
|||||||
// Check if the method to-be-called exists on the target object - if so, don't check any further
|
// Check if the method to-be-called exists on the target object - if so, don't check any further
|
||||||
// injection locations
|
// injection locations
|
||||||
$on = $this->itemIterator ? $this->itemIterator->current() : $this->item;
|
$on = $this->itemIterator ? $this->itemIterator->current() : $this->item;
|
||||||
if ($on !== null && (isset($on->$property) || method_exists($on, $property ?? ''))) {
|
if (is_object($on) && (isset($on->$property) || method_exists($on, $property ?? ''))) {
|
||||||
return [];
|
return [];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1035,22 +1035,22 @@ after'
|
|||||||
{
|
{
|
||||||
$this->assertEquals(
|
$this->assertEquals(
|
||||||
$this->render('<% include SSViewerTestIncludeWithArguments %>'),
|
$this->render('<% include SSViewerTestIncludeWithArguments %>'),
|
||||||
'<p>[out:Arg1]</p><p>[out:Arg2]</p>'
|
'<p>[out:Arg1]</p><p>[out:Arg2]</p><p>[out:Arg2.Count]</p>'
|
||||||
);
|
);
|
||||||
|
|
||||||
$this->assertEquals(
|
$this->assertEquals(
|
||||||
$this->render('<% include SSViewerTestIncludeWithArguments Arg1=A %>'),
|
$this->render('<% include SSViewerTestIncludeWithArguments Arg1=A %>'),
|
||||||
'<p>A</p><p>[out:Arg2]</p>'
|
'<p>A</p><p>[out:Arg2]</p><p>[out:Arg2.Count]</p>'
|
||||||
);
|
);
|
||||||
|
|
||||||
$this->assertEquals(
|
$this->assertEquals(
|
||||||
$this->render('<% include SSViewerTestIncludeWithArguments Arg1=A, Arg2=B %>'),
|
$this->render('<% include SSViewerTestIncludeWithArguments Arg1=A, Arg2=B %>'),
|
||||||
'<p>A</p><p>B</p>'
|
'<p>A</p><p>B</p><p></p>'
|
||||||
);
|
);
|
||||||
|
|
||||||
$this->assertEquals(
|
$this->assertEquals(
|
||||||
$this->render('<% include SSViewerTestIncludeWithArguments Arg1=A Bare String, Arg2=B Bare String %>'),
|
$this->render('<% include SSViewerTestIncludeWithArguments Arg1=A Bare String, Arg2=B Bare String %>'),
|
||||||
'<p>A Bare String</p><p>B Bare String</p>'
|
'<p>A Bare String</p><p>B Bare String</p><p></p>'
|
||||||
);
|
);
|
||||||
|
|
||||||
$this->assertEquals(
|
$this->assertEquals(
|
||||||
@ -1058,7 +1058,7 @@ after'
|
|||||||
'<% include SSViewerTestIncludeWithArguments Arg1="A", Arg2=$B %>',
|
'<% include SSViewerTestIncludeWithArguments Arg1="A", Arg2=$B %>',
|
||||||
new ArrayData(['B' => 'Bar'])
|
new ArrayData(['B' => 'Bar'])
|
||||||
),
|
),
|
||||||
'<p>A</p><p>Bar</p>'
|
'<p>A</p><p>Bar</p><p></p>'
|
||||||
);
|
);
|
||||||
|
|
||||||
$this->assertEquals(
|
$this->assertEquals(
|
||||||
@ -1066,7 +1066,22 @@ after'
|
|||||||
'<% include SSViewerTestIncludeWithArguments Arg1="A" %>',
|
'<% include SSViewerTestIncludeWithArguments Arg1="A" %>',
|
||||||
new ArrayData(['Arg1' => 'Foo', 'Arg2' => 'Bar'])
|
new ArrayData(['Arg1' => 'Foo', 'Arg2' => 'Bar'])
|
||||||
),
|
),
|
||||||
'<p>A</p><p>Bar</p>'
|
'<p>A</p><p>Bar</p><p></p>'
|
||||||
|
);
|
||||||
|
|
||||||
|
$this->assertEquals(
|
||||||
|
$this->render('<% include SSViewerTestIncludeWithArguments Arg1="A", Arg2=0 %>'),
|
||||||
|
'<p>A</p><p>0</p><p></p>'
|
||||||
|
);
|
||||||
|
|
||||||
|
$this->assertEquals(
|
||||||
|
$this->render('<% include SSViewerTestIncludeWithArguments Arg1="A", Arg2=false %>'),
|
||||||
|
'<p>A</p><p></p><p></p>'
|
||||||
|
);
|
||||||
|
|
||||||
|
$this->assertEquals(
|
||||||
|
$this->render('<% include SSViewerTestIncludeWithArguments Arg1="A", Arg2=null %>'),
|
||||||
|
'<p>A</p><p></p><p></p>'
|
||||||
);
|
);
|
||||||
|
|
||||||
$this->assertEquals(
|
$this->assertEquals(
|
||||||
|
@ -1 +1 @@
|
|||||||
<p>$Arg1</p><p>$Arg2</p>
|
<p>$Arg1</p><p>$Arg2</p><p>{$Arg2.Count}</p>
|
||||||
|
Loading…
Reference in New Issue
Block a user