public function testParseProperty_protected() { $access = \vc\Tokens\Access::buildAccess($this->oneTokenReader()->thenAProtected->thenSomeSpace->thenAVariable('$var')->thenASemicolon); $sig = new \vc\Data\Signature(120, new \vc\Data\Comment('Note')); $this->assertEquals(r8(new \vc\Data\Property(120, new \vc\Data\Comment('Note')))->setName('$var')->setVisibility(\vc\Data\Visibility::vProtected()), $this->getPropertyParser()->parseProperty($sig, $access)); $this->assertEndOfTokens($access); }
public function testFromToken() { $this->assertEquals(\vc\Data\Visibility::vPublic(), \vc\Data\Visibility::fromToken(new \vc\Tokens\Token(Token::T_PUBLIC, 'public', 1))); $this->assertEquals(\vc\Data\Visibility::vProtected(), \vc\Data\Visibility::fromToken(new \vc\Tokens\Token(Token::T_PROTECTED, 'protected', 1))); $this->assertEquals(\vc\Data\Visibility::vPrivate(), \vc\Data\Visibility::fromToken(new \vc\Tokens\Token(Token::T_PRIVATE, 'private', 1))); try { \vc\Data\Visibility::fromToken(new \vc\Tokens\Token(Token::T_CLASS, 'class', 1)); $this->fail("An expected exception was not thrown"); } catch (\r8\Exception\Argument $err) { } }
public function testParseMethod_StaticFinalProtectedMethod() { $access = \vc\Tokens\Access::buildAccess($this->oneTokenReader()->thenAStatic->thenSomeSpace->thenAFinal->thenSomeSpace->thenAProtected->thenSomeSpace->thenAFunction->thenSomeSpace->thenAName('MyFunc')->thenOpenParens->thenCloseParens->thenAnOpenBlock->thenACloseBlock); $sig = new \vc\Data\Signature(123); $this->assertEquals(r8(new \vc\Data\Routine\Method(123))->setName('MyFunc')->setStatic(TRUE)->setFinal(TRUE)->setVisibility(\vc\Data\Visibility::vProtected()), $this->getMethodParser()->parseMethod($sig, $access)); }
public function testParseSignature_ProtectedProperty() { $this->assertTokenStreamCreatesProperty(new \vc\Data\Comment('Note'), $this->oneTokenReader()->thenAProtected(50)->thenSomeSpace->thenAVariable('$var'), r8(new \vc\Data\Signature(50, new \vc\Data\Comment('Note')))->setVisibility(\vc\Data\Visibility::vProtected())); }