Magento 2 Documentation  2.3
Documentation for Magento 2 CMS v2.3 (December 2018)
StringLengthTest.php
Go to the documentation of this file.
1 <?php
8 
12 class StringLengthTest extends \PHPUnit\Framework\TestCase
13 {
17  protected $_validator;
18 
19  protected function setUp()
20  {
21  $this->_validator = new \Magento\Framework\Validator\StringLength();
22  }
23 
24  public function testDefaultEncoding()
25  {
26  $this->assertEquals('UTF-8', $this->_validator->getEncoding());
27  }
28 
35  public function testIsValid($value, $maxLength, $isValid)
36  {
37  $this->_validator->setMax($maxLength);
38  $this->assertEquals($isValid, $this->_validator->isValid($value));
39  }
40 
44  public function isValidDataProvider()
45  {
46  return [
47  ['строка', 6, true],
48  ['строка', 5, false],
49  ['string', 6, true],
50  ['string', 5, false]
51  ];
52  }
53 }
$value
Definition: gender.phtml:16