returnValueMap example

namespace Symfony\Bridge\Twig\Tests\Extension;

use Symfony\Component\Form\FormRenderer;
use Twig\Environment;
use Twig\RuntimeLoader\RuntimeLoaderInterface;

trait RuntimeLoaderProvider
{
    protected function registerTwigRuntimeLoader(Environment $environment, FormRenderer $renderer)
    {
        $loader = $this->createMock(RuntimeLoaderInterface::class);
        $loader->expects($this->any())->method('load')->will($this->returnValueMap([
            ['Symfony\Component\Form\FormRenderer', $renderer],
        ]));
        $environment->addRuntimeLoader($loader);
    }
}
Home | Imprint | This part of the site doesn't use cookies.