Files
FOSSBilling/tests/includes/FakeTemplateWrapper.php
T
Belle Aerni 50043e6211 Run Rector against our tests (#1761)
* Update rector config to include tests

* Run Rector against the tests

* Delete test-results

* Update .gitignore

* Correctly set the PHP min to 8.1, split the configs

* Corrected PHPDoc

* Deleted tests we can't really get to pass

PHPunit is hard-coded to fail when a class has a return type of `never`, which is the correct return type of our redirect function (and rightfully so).

No way to disable the exception as far as we can tell
2023-11-11 18:41:09 +00:00

44 lines
1015 B
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
{
/**
* Constructor.
*
* @param string $body
* Body text to return from the render() method.
*/
public function __construct(
/**
* Body text to return from the render() method.
*/
protected $body
)
{
}
/**
* Mocks the \Twig_TemplateWrapper render() method.
*
* @param array $context
* (optional) Render context.
*/
public function render(array $context = [])
{
return $this->body;
}
}