Files
FOSSBilling/tests/includes/FakeTemplateWrapper.php
T
Andrey Pavlenkoandandpavlenko 9b474dee89 Bump to Twig 3 (#1264)
* Bump to Twig 3 and update templates

* Update composer.lock

* Fix test Box\Mod\System\ServiceTest::testrenderStringTemplate

Co-authored-by: andpavlenko <lance@xosting.net.ua>
2022-04-09 11:02:17 +03:00

47 lines
1.0 KiB
PHP

<?php
/**
* Defines a fake template class to mock \Twig_TemplateWrapper.
*
* We cannot use getMockBuilder() for this, because the Twig TemplateWrapper
* class is declared "final" and cannot be mocked.
*
* https://github.rpi.edu/DotCIOweb/test-pantheon-starterkit/blob/107b23d9f231c392e2cd9b4f677f4c1a30e508fa/core/modules/help_topics/tests/src/Unit/HelpTopicTwigTest.php
*
*/
/**
* @deprecated Since Twig 3: Will be remove or maybe could be find best way.
*/
class FakeTemplateWrapper
{
/**
* Body text to return from the render() method.
*
* @var string
*/
protected $body;
/**
* Constructor.
*
* @param string $body
* Body text to return from the render() method.
*/
public function __construct($body)
{
$this->body = $body;
}
/**
* Mocks the \Twig_TemplateWrapper render() method.
*
* @param array $context
* (optional) Render context.
*/
public function render(array $context = [])
{
return $this->body;
}
}