12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576 |
- <?php
- namespace Psy\Test\CodeCleaner;
- use Psy\CodeCleaner\LegacyEmptyPass;
- class LegacyEmptyPassTest extends CodeCleanerTestCase
- {
- public function setUp()
- {
- $this->setPass(new LegacyEmptyPass());
- }
-
- public function testProcessInvalidStatement($code)
- {
- $this->parseAndTraverse($code);
- }
- public function invalidStatements()
- {
- if (\version_compare(PHP_VERSION, '5.5', '>=')) {
- return [
- ['empty()'],
- ];
- }
- return [
- ['empty()'],
- ['empty(null)'],
- ['empty(PHP_EOL)'],
- ['empty("wat")'],
- ['empty(1.1)'],
- ['empty(Foo::$bar)'],
- ];
- }
-
- public function testProcessValidStatement($code)
- {
- $this->parseAndTraverse($code);
- $this->assertTrue(true);
- }
- public function validStatements()
- {
- if (\version_compare(PHP_VERSION, '5.5', '<')) {
- return [
- ['empty($foo)'],
- ];
- }
- return [
- ['empty($foo)'],
- ['empty(null)'],
- ['empty(PHP_EOL)'],
- ['empty("wat")'],
- ['empty(1.1)'],
- ['empty(Foo::$bar)'],
- ];
- }
- }
|