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);
52 // @todo a better thing to assert here?
53 $this->assertTrue(true);
56 public function getValidReferences()
61 // class constant fetch
62 array('NotAClass::FOO'),
63 array('DateTime::ATOM'),
64 array('$a = new DateTime; $a::ATOM'),
65 array('DateTime::class'),
66 array('$a = new DateTime; $a::class'),