mirror of
https://github.com/twigphp/Twig.git
synced 2026-10-09 05:15:35 +00:00
Merge branch '3.x' into 4.x
* 3.x: Reject cross-environment template wrappers in block chains Reject cross-environment template wrappers # Conflicts: # CHANGELOG # tests/TemplateTest.php
This commit is contained in:
@@ -308,7 +308,7 @@ class BlockChainTest extends TestCase
|
||||
{
|
||||
$twig = new Environment(new ArrayLoader(['theme' => '']));
|
||||
$other = new Environment(new ArrayLoader(['theme' => '']));
|
||||
$wrapper = new TemplateWrapper($twig, $other->load('theme')->unwrap());
|
||||
$wrapper = new TemplateWrapper($twig, $other->load('theme')->unwrap($other));
|
||||
|
||||
$this->expectException(\LogicException::class);
|
||||
$this->expectExceptionMessage('A block chain cannot contain templates from different Twig environments.');
|
||||
@@ -322,8 +322,8 @@ class BlockChainTest extends TestCase
|
||||
$other = new Environment(new ArrayLoader(['parent' => '']));
|
||||
$chain = new BlockChain($twig, ['theme'], ['parent' => $other->load('parent')]);
|
||||
|
||||
$this->expectException(\LogicException::class);
|
||||
$this->expectExceptionMessage('A block chain cannot contain templates from different Twig environments.');
|
||||
$this->expectException(RuntimeError::class);
|
||||
$this->expectExceptionMessage('A "Twig\TemplateWrapper" can only be used with the "Twig\Environment" that created it in "theme" at line 1.');
|
||||
|
||||
$chain->getBlockNames();
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user