4 * This file is part of Psy Shell.
6 * (c) 2012-2017 Justin Hileman
8 * For the full copyright and license information, please view the LICENSE
9 * file that was distributed with this source code.
12 namespace Psy\Test\CodeCleaner;
14 use Psy\CodeCleaner\ValidConstantPass;
16 class ValidConstantPassTest extends CodeCleanerTestCase
18 public function setUp()
20 $this->setPass(new ValidConstantPass());
24 * @dataProvider getInvalidReferences
25 * @expectedException \Psy\Exception\FatalErrorException
27 public function testProcessInvalidConstantReferences($code)
29 $stmts = $this->parse($code);
30 $this->traverse($stmts);
33 public function getInvalidReferences()
38 // class constant fetch
39 array('Psy\Test\CodeCleaner\ValidConstantPassTest::FOO'),
40 array('DateTime::BACON'),
45 * @dataProvider getValidReferences
47 public function testProcessValidConstantReferences($code)
49 $stmts = $this->parse($code);
50 $this->traverse($stmts);
53 public function getValidReferences()
58 // class constant fetch
59 array('NotAClass::FOO'),
60 array('DateTime::ATOM'),
61 array('$a = new DateTime; $a::ATOM'),
62 array('DateTime::class'),
63 array('$a = new DateTime; $a::class'),