TYPO3  7.6
NumericNodeTest.php
Go to the documentation of this file.
1 <?php
2 namespace TYPO3\CMS\Fluid\Tests\Unit\Core\Parser\SyntaxTree;
3 
4 /* *
5  * This script belongs to the TYPO3 Flow package "Fluid". *
6  * *
7  * It is free software; you can redistribute it and/or modify it under *
8  * the terms of the GNU Lesser General Public License, either version 3 *
9  * of the License, or (at your option) any later version. *
10  * *
11  * The TYPO3 project - inspiring people to share! *
12  * */
13 
17 class NumericNodeTest extends \TYPO3\CMS\Core\Tests\UnitTestCase
18 {
23  {
24  $string = '1';
25  $node = new \TYPO3\CMS\Fluid\Core\Parser\SyntaxTree\NumericNode($string);
26  $this->assertEquals($node->evaluate($this->getMock(\TYPO3\CMS\Fluid\Core\Rendering\RenderingContext::class)), 1, 'The rendered value of a numeric node does not match the string given in the constructor.');
27  }
28 
33  {
34  $string = '1.1';
35  $node = new \TYPO3\CMS\Fluid\Core\Parser\SyntaxTree\NumericNode($string);
36  $this->assertEquals($node->evaluate($this->getMock(\TYPO3\CMS\Fluid\Core\Rendering\RenderingContext::class)), 1.1, 'The rendered value of a numeric node does not match the string given in the constructor.');
37  }
38 
44  {
45  new \TYPO3\CMS\Fluid\Core\Parser\SyntaxTree\NumericNode('foo');
46  }
47 
52  public function addChildNodeThrowsException()
53  {
54  $node = new \TYPO3\CMS\Fluid\Core\Parser\SyntaxTree\NumericNode('1');
55  $node->addChildNode(clone $node);
56  }
57 }