Merge branch '5.2' into 5

This commit is contained in:
Guy Sartorelli 2024-08-12 13:03:34 +12:00
commit 410ef74e32
No known key found for this signature in database
GPG Key ID: F313E3B9504D496A
3 changed files with 16 additions and 2 deletions

View File

@ -186,6 +186,9 @@ class SSViewer_Scope
public function getObj($name, $arguments = [], $cache = false, $cacheName = null)
{
$on = $this->getItem();
if ($on === null) {
return null;
}
return $on->obj($name, $arguments, $cache, $cacheName);
}

View File

@ -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()
{
$this->assertEquals(

View File

@ -18,8 +18,8 @@ class TestGlobalProvider implements TemplateGlobalProvider, TestOnly
'SSViewerTest_GlobalReferencedByString' => '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();
return 'z' . implode(':', $args) . 'z';
}
public static function getNull()
{
return null;
}
}