Magento 2 Documentation  2.3
Documentation for Magento 2 CMS v2.3 (December 2018)
NumberTest.php
Go to the documentation of this file.
1 <?php
7 
8 use \Magento\Framework\Data\Argument\Interpreter\Number;
9 
10 class NumberTest extends \PHPUnit\Framework\TestCase
11 {
15  protected $_model;
16 
17  protected function setUp()
18  {
19  $this->_model = new Number();
20  }
21 
28  public function testEvaluateException($input)
29  {
30  $this->_model->evaluate($input);
31  }
32 
37  {
38  return ['no value' => [[]], 'non-numeric value' => [['value' => 'non-numeric']]];
39  }
40 
47  public function testEvaluate($input, $expected)
48  {
49  $actual = $this->_model->evaluate(['value' => $input]);
50  $this->assertSame($expected, $actual);
51  }
52 
56  public function evaluateDataProvider()
57  {
58  return [
59  'integer' => [10, 10],
60  'float' => [10.5, 10.5],
61  'string numeric (integer)' => ['10', '10'],
62  'string numeric (float)' => ['10.5', '10.5']
63  ];
64  }
65 }