No Description

CodeCleanerTest.php 1.0KB

12345678910111213141516171819202122232425262728293031323334353637383940
  1. <?php
  2. /*
  3. * This file is part of Psy Shell
  4. *
  5. * (c) 2012-2014 Justin Hileman
  6. *
  7. * For the full copyright and license information, please view the LICENSE
  8. * file that was distributed with this source code.
  9. */
  10. namespace Psy\Test;
  11. use Psy\CodeCleaner;
  12. class CodeCleanerTest extends \PHPUnit_Framework_TestCase
  13. {
  14. /**
  15. * @dataProvider codeProvider
  16. */
  17. public function testAutomaticSemicolons(array $lines, $requireSemicolons, $expected)
  18. {
  19. $cc = new CodeCleaner();
  20. $this->assertEquals($expected, $cc->clean($lines, $requireSemicolons));
  21. }
  22. public function codeProvider()
  23. {
  24. return array(
  25. array(array('true'), false, 'return true;'),
  26. array(array('true;'), false, 'return true;'),
  27. array(array('true;'), true, 'return true;'),
  28. array(array('true'), true, false),
  29. array(array('echo "foo";', 'true'), false, "echo 'foo';\nreturn true;"),
  30. array(array('echo "foo";', 'true'), true , false),
  31. );
  32. }
  33. }