parse(); } return $parser; } public function testParsingAccessLevels() { $statics = $this->parseSelf()->getStatics(); $levels = array( 'nolevel' => null, 'public' => T_PUBLIC, 'public2' => T_PUBLIC, 'protected' => T_PROTECTED, 'protected2' => T_PROTECTED, 'private' => T_PRIVATE, 'private2' => T_PRIVATE ); foreach($levels as $var => $level) { $this->assertEquals( $level, $statics[__CLASS__][$var]['access'], 'Variable '.$var.' has '.($level ? token_name($level) : 'no').' access level' ); } } public function testParsingValues() { $statics = $this->parseSelf()->getStatics(); // Check assigning values $values = array( 'none', 'null', 'int', 'float', 'string', 'array', 'heredoc', 'nowdoc' ); $prepends = array( 's', // Each on it's own 'o', // All on one line 'm' // All in on static statement, but each on own line ); foreach ($values as $value) { foreach ($prepends as $prepend) { $var = "$prepend$value"; $this->assertEquals( self::$$var, $statics[__CLASS__][$var]['value'], 'Variable '.$var.' value is extracted properly' ); } } } public function testIgnoreComments() { $statics = $this->parseSelf()->getStatics(); $this->assertEquals(self::$commented_int, $statics[__CLASS__]['commented_int']['value']); $this->assertEquals(self::$commented_string, $statics[__CLASS__]['commented_string']['value']); $this->assertEquals(self::$docblocked_int, $statics[__CLASS__]['docblocked_int']['value']); $this->assertEquals(self::$docblocked_string, $statics[__CLASS__]['docblocked_string']['value']); } public function testIgnoresMethodStatics() { $statics = $this->parseSelf()->getStatics(); $this->assertNull(@$statics[__CLASS__]['method_static']); } public function testIgnoresStaticMethods() { $statics = $this->parseSelf()->getStatics(); $this->assertNull(@$statics[__CLASS__]['static_method']); } }