TextConfigOptionTest.php 1.2 KB

12345678910111213141516171819202122232425262728293031323334353637
  1. <?php
  2. /**
  3. * Copyright © Magento, Inc. All rights reserved.
  4. * See COPYING.txt for license details.
  5. */
  6. namespace Magento\Framework\Setup\Test\Unit\Option;
  7. use Magento\Framework\Setup\Option\SelectConfigOption;
  8. use Magento\Framework\Setup\Option\TextConfigOption;
  9. class TextConfigOptionTest extends \PHPUnit\Framework\TestCase
  10. {
  11. /**
  12. * @expectedException \InvalidArgumentException
  13. * @expectedExceptionMessage Frontend input type has to be 'text', 'textarea' or 'password'.
  14. */
  15. public function testConstructInvalidFrontendType()
  16. {
  17. new TextConfigOption('test', SelectConfigOption::FRONTEND_WIZARD_SELECT, 'path/to/value');
  18. }
  19. public function testGetFrontendType()
  20. {
  21. $option = new TextConfigOption('test', TextConfigOption::FRONTEND_WIZARD_TEXT, 'path/to/value');
  22. $this->assertEquals(TextConfigOption::FRONTEND_WIZARD_TEXT, $option->getFrontendType());
  23. }
  24. /**
  25. * @expectedException \InvalidArgumentException
  26. * @expectedExceptionMessage must be a string
  27. */
  28. public function testValidateException()
  29. {
  30. $option = new TextConfigOption('test', TextConfigOption::FRONTEND_WIZARD_TEXT, 'path/to/value');
  31. $option->validate(1);
  32. }
  33. }