mirror of
https://github.com/silverstripe/silverstripe-framework
synced 2024-10-22 14:05:37 +02:00
Merge branch '5.2' into 5
This commit is contained in:
commit
410ef74e32
@ -186,6 +186,9 @@ class SSViewer_Scope
|
|||||||
public function getObj($name, $arguments = [], $cache = false, $cacheName = null)
|
public function getObj($name, $arguments = [], $cache = false, $cacheName = null)
|
||||||
{
|
{
|
||||||
$on = $this->getItem();
|
$on = $this->getItem();
|
||||||
|
if ($on === null) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
return $on->obj($name, $arguments, $cache, $cacheName);
|
return $on->obj($name, $arguments, $cache, $cacheName);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -364,6 +364,12 @@ SS;
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function testGlobalVariablesReturnNull()
|
||||||
|
{
|
||||||
|
$this->assertEquals('<p></p>', $this->render('<p>$SSViewerTest_GlobalReturnsNull</p>'));
|
||||||
|
$this->assertEquals('<p></p>', $this->render('<p>$SSViewerTest_GlobalReturnsNull.Chained.Properties</p>'));
|
||||||
|
}
|
||||||
|
|
||||||
public function testCoreGlobalVariableCalls()
|
public function testCoreGlobalVariableCalls()
|
||||||
{
|
{
|
||||||
$this->assertEquals(
|
$this->assertEquals(
|
||||||
|
@ -18,8 +18,8 @@ class TestGlobalProvider implements TemplateGlobalProvider, TestOnly
|
|||||||
'SSViewerTest_GlobalReferencedByString' => 'get_reference',
|
'SSViewerTest_GlobalReferencedByString' => 'get_reference',
|
||||||
'SSViewerTest_GlobalReferencedInArray' => ['method' => 'get_reference'],
|
'SSViewerTest_GlobalReferencedInArray' => ['method' => 'get_reference'],
|
||||||
|
|
||||||
'SSViewerTest_GlobalThatTakesArguments' => ['method' => 'get_argmix', 'casting' => 'HTMLFragment']
|
'SSViewerTest_GlobalThatTakesArguments' => ['method' => 'get_argmix', 'casting' => 'HTMLFragment'],
|
||||||
|
'SSViewerTest_GlobalReturnsNull' => 'getNull',
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -43,4 +43,9 @@ class TestGlobalProvider implements TemplateGlobalProvider, TestOnly
|
|||||||
$args = func_get_args();
|
$args = func_get_args();
|
||||||
return 'z' . implode(':', $args) . 'z';
|
return 'z' . implode(':', $args) . 'z';
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static function getNull()
|
||||||
|
{
|
||||||
|
return null;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user