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 PhpParser\NodeTraverser;
15 use Psy\CodeCleaner\AbstractClassPass;
17 class AbstractClassPassTest extends CodeCleanerTestCase
19 public function setUp()
21 $this->pass = new AbstractClassPass();
22 $this->traverser = new NodeTraverser();
23 $this->traverser->addVisitor($this->pass);
27 * @dataProvider invalidStatements
28 * @expectedException \Psy\Exception\FatalErrorException
30 public function testProcessStatementFails($code)
32 $stmts = $this->parse($code);
33 $this->traverser->traverse($stmts);
36 public function invalidStatements()
39 array('class A { abstract function a(); }'),
40 array('abstract class B { abstract function b() {} }'),
41 array('abstract class B { abstract function b() { echo "yep"; } }'),
46 * @dataProvider validStatements
48 public function testProcessStatementPasses($code)
50 $stmts = $this->parse($code);
51 $this->traverser->traverse($stmts);
54 public function validStatements()
57 array('abstract class C { function c() {} }'),
58 array('abstract class D { abstract function d(); }'),