create(ParserFactory::PREFER_PHP7); $config = new TestConfig(); } public function setUp() { FileChecker::clearCache(); $this->project_checker = new \Psalm\Checker\ProjectChecker(); } /** * @expectedException \Psalm\Exception\CodeException * @expectedExceptionMessage InaccessibleMethod */ public function testInaccessiblePrivateMethod() { $stmts = self::$parser->parse('fooFoo(); '); $file_checker = new FileChecker('somefile.php', $this->project_checker, $stmts); $file_checker->visitAndCheckMethods(); } /** * @expectedException \Psalm\Exception\CodeException * @expectedExceptionMessage InaccessibleMethod */ public function testInaccessibleProtectedMethod() { $stmts = self::$parser->parse('fooFoo(); '); $file_checker = new FileChecker('somefile.php', $this->project_checker, $stmts); $file_checker->visitAndCheckMethods(); } public function testAccessiblePrivateMethodFromSubclass() { $stmts = self::$parser->parse('fooFoo(); } } '); $file_checker = new FileChecker('somefile.php', $this->project_checker, $stmts); $file_checker->visitAndCheckMethods(); } /** * @expectedException \Psalm\Exception\CodeException * @expectedExceptionMessage InaccessibleMethod */ public function testInaccessiblePrivateMethodFromSubclass() { $stmts = self::$parser->parse('fooFoo(); } } '); $file_checker = new FileChecker('somefile.php', $this->project_checker, $stmts); $file_checker->visitAndCheckMethods(); } public function testAccessibleProtectedMethodFromSubclass() { $stmts = self::$parser->parse('fooFoo(); } } '); $file_checker = new FileChecker('somefile.php', $this->project_checker, $stmts); $file_checker->visitAndCheckMethods(); } public function testAccessibleProtectedMethodFromOtherSubclass() { $stmts = self::$parser->parse('fooFoo(); } } '); $file_checker = new FileChecker('somefile.php', $this->project_checker, $stmts); $file_checker->visitAndCheckMethods(); } /** * @expectedException \Psalm\Exception\CodeException * @expectedExceptionMessage InaccessibleMethod */ public function testInaccessibleProtectedMethodFromOtherSubclass() { $stmts = self::$parser->parse('fooFoo(); } } '); $file_checker = new FileChecker('somefile.php', $this->project_checker, $stmts); $file_checker->visitAndCheckMethods(); } /** * @expectedException \Psalm\Exception\CodeException * @expectedExceptionMessage InaccessibleProperty */ public function testInaccessiblePrivateProperty() { $stmts = self::$parser->parse('fooFoo; '); $file_checker = new FileChecker('somefile.php', $this->project_checker, $stmts); $file_checker->visitAndCheckMethods(); } /** * @expectedException \Psalm\Exception\CodeException * @expectedExceptionMessage InaccessibleProperty */ public function testInaccessibleProtectedProperty() { $stmts = self::$parser->parse('fooFoo; '); $file_checker = new FileChecker('somefile.php', $this->project_checker, $stmts); $file_checker->visitAndCheckMethods(); } /** * @expectedException \Psalm\Exception\CodeException * @expectedExceptionMessage InaccessibleProperty */ public function testInaccessiblePrivatePropertyFromSubclass() { $stmts = self::$parser->parse('fooFoo; } } '); $file_checker = new FileChecker('somefile.php', $this->project_checker, $stmts); $file_checker->visitAndCheckMethods(); } /** * @expectedException \Psalm\Exception\CodeException * @expectedExceptionMessage InaccessibleProperty */ public function testInaccessibleStaticPrivateProperty() { $stmts = self::$parser->parse('project_checker, $stmts); $file_checker->visitAndCheckMethods(); } /** * @expectedException \Psalm\Exception\CodeException * @expectedExceptionMessage InaccessibleProperty */ public function testInaccessibleStaticProtectedProperty() { $stmts = self::$parser->parse('project_checker, $stmts); $file_checker->visitAndCheckMethods(); } /** * @expectedException \Psalm\Exception\CodeException * @expectedExceptionMessage InaccessibleProperty */ public function testInaccessibleStaticPrivatePropertyFromSubclass() { $stmts = self::$parser->parse('project_checker, $stmts); $file_checker->visitAndCheckMethods(); } public function testAccessibleProtectedPropertyFromSubclass() { $stmts = self::$parser->parse('fooFoo; } } '); $file_checker = new FileChecker('somefile.php', $this->project_checker, $stmts); $file_checker->visitAndCheckMethods(); } public function testAccessibleProtectedPropertyFromGreatGrandparent() { $stmts = self::$parser->parse('fooFoo; } } '); $file_checker = new FileChecker('somefile.php', $this->project_checker, $stmts); $file_checker->visitAndCheckMethods(); } public function testAccessibleProtectedPropertyFromOtherSubclass() { $stmts = self::$parser->parse('fooFoo = "hello"; } } '); $file_checker = new FileChecker('somefile.php', $this->project_checker, $stmts); $file_checker->visitAndCheckMethods(); } public function testAccessibleStaticPropertyFromSubclass() { $stmts = self::$parser->parse('project_checker, $stmts); $file_checker->visitAndCheckMethods(); } }