Lines Matching refs:template

31         $template = $this->getMockForAbstractClass('\Twig\Template', [], '', false);
32 $template->displayBlock('foo', [], ['foo' => [new \stdClass(), 'foo']]);
38 public function testGetAttributeExceptions($template, $message) argument
40 $templates = ['index' => $template];
42 $template = $env->load('index');
55 $template->render($context);
93 $template = new Twig_TemplateTest($twig);
96 $template->getAttribute($object, $item, [], 'any');
133 $template = new Twig_TemplateTest($twig, 'index.twig');
136 $this->assertInstanceOf('\Twig\Markup', $template->getAttribute($template1, 'string'));
137 $this->assertEquals('some_string', $template->getAttribute($template1, 'string'));
139 $this->assertInstanceOf('\Twig\Markup', $template->getAttribute($template1, 'true'));
140 $this->assertEquals('1', $template->getAttribute($template1, 'true'));
142 $this->assertInstanceOf('\Twig\Markup', $template->getAttribute($template1, 'zero'));
143 $this->assertEquals('0', $template->getAttribute($template1, 'zero'));
145 $this->assertNotInstanceof('\Twig\Markup', $template->getAttribute($template1, 'empty'));
146 $this->assertSame('', $template->getAttribute($template1, 'empty'));
148 … $this->assertFalse($template->getAttribute($template1, 'env', [], Template::ANY_CALL, true));
149 …$this->assertFalse($template->getAttribute($template1, 'environment', [], Template::ANY_CALL, true…
150 …$this->assertFalse($template->getAttribute($template1, 'getEnvironment', [], Template::METHOD_CALL…
151 …$this->assertFalse($template->getAttribute($template1, 'displayWithErrorHandling', [], Template::M…
181 $template = new Twig_TemplateTest($twig, 'index.twig');
184 $this->assertInstanceOf('\Twig\Markup', $template->getAttribute($template1, 'string'));
185 $this->assertEquals('some_string', $template->getAttribute($template1, 'string'));
187 $this->assertInstanceOf('\Twig\Markup', $template->getAttribute($template1, 'true'));
188 $this->assertEquals('1', $template->getAttribute($template1, 'true'));
190 $this->assertInstanceOf('\Twig\Markup', $template->getAttribute($template1, 'zero'));
191 $this->assertEquals('0', $template->getAttribute($template1, 'zero'));
193 $this->assertNotInstanceof('\Twig\Markup', $template->getAttribute($template1, 'empty'));
194 $this->assertSame('', $template->getAttribute($template1, 'empty'));
199 $template->getAttribute($template, 'renderBlock', ['name', [], $blocks]);
200 $template->getAttribute($template, 'displayBlock', ['name', [], $blocks]);
201 $template->getAttribute($template, 'hasBlock', ['name', []]);
202 $template->getAttribute($template, 'render', [[]]);
203 $template->getAttribute($template, 'display', [[]]);
205 $template->getAttribute($template1, 'renderBlock', ['name', [], $blocks]);
206 $template->getAttribute($template1, 'displayBlock', ['name', [], $blocks]);
207 $template->getAttribute($template1, 'hasBlock', ['name', []]);
208 $template->getAttribute($template1, 'render', [[]]);
209 $template->getAttribute($template1, 'display', [[]]);
211 … $this->assertFalse($template->getAttribute($template1, 'env', [], Template::ANY_CALL, true));
212 …$this->assertFalse($template->getAttribute($template1, 'environment', [], Template::ANY_CALL, true…
213 …$this->assertFalse($template->getAttribute($template1, 'getEnvironment', [], Template::METHOD_CALL…
214 …$this->assertFalse($template->getAttribute($template1, 'displayWithErrorHandling', [], Template::M…
226 $template = new Twig_TemplateTest($twig, 'index.twig');
227 $template->renderBlock('unknown', []);
228 $template->displayBlock('unknown', []);
233 …$template = new Twig_TemplateTest(new Environment($this->getMockBuilder('\Twig\Loader\LoaderInterf…
246 …$this->assertSame('Zero', $template->getAttribute($array, false), 'false is treated as 0 when acce…
247 …$this->assertSame('One', $template->getAttribute($array, true), 'true is treated as 1 when accessi…
248 …$this->assertSame('One', $template->getAttribute($array, 1.5), 'float is casted to int when access…
249 …$this->assertSame('One', $template->getAttribute($array, '1'), '"1" is treated as integer 1 when a…
250 …$this->assertSame('MinusOne', $template->getAttribute($array, -1.5), 'negative float is casted to …
251 …$this->assertSame('FloatButString', $template->getAttribute($array, '1.5'), '"1.5" is treated as-i…
252 …$this->assertSame('IntegerButStringWithLeadingZeros', $template->getAttribute($array, '01'), '"01"…
253 …$this->assertSame('EmptyString', $template->getAttribute($array, null), 'null is treated as "" whe…
261 …$template = new Twig_TemplateTest(new Environment($this->getMockBuilder('\Twig\Loader\LoaderInterf…
263 $this->assertEquals($value, $template->getAttribute($object, $item, $arguments, $type));
271 …$template = new Twig_TemplateTest(new Environment($this->getMockBuilder('\Twig\Loader\LoaderInterf…
274 $this->assertEquals($value, $template->getAttribute($object, $item, $arguments, $type));
284 $this->assertEquals($value, $template->getAttribute($object, $item, $arguments, $type));
293 …$template = new Twig_TemplateTest(new Environment($this->getMockBuilder('\Twig\Loader\LoaderInterf…
295 … $this->assertEquals($defined, $template->getAttribute($object, $item, $arguments, $type, true));
303 …$template = new Twig_TemplateTest(new Environment($this->getMockBuilder('\Twig\Loader\LoaderInterf…
305 … $this->assertEquals($defined, $template->getAttribute($object, $item, $arguments, $type, true));
310 …$template = new Twig_TemplateTest(new Environment($this->getMockBuilder('\Twig\Loader\LoaderInterf…
314 $this->assertNull($template->getAttribute($object, 'foo'));
455 …$template = new Twig_TemplateTest(new Environment($this->getMockBuilder('\Twig\Loader\LoaderInterf…
457 $this->assertNull($template->getAttribute($getIsObject, 'get'));
459 $this->assertNull($template->getAttribute($getIsObject, 0));