From 3578db69fc050f62b67df3ed0e8af6a59998202b Mon Sep 17 00:00:00 2001 From: Matthew Brown Date: Mon, 24 Oct 2016 19:20:28 -0400 Subject: [PATCH] Add interface inheritance test --- tests/InterfaceTest.php | 84 +++++++++++++++++++++++++++++++++++++++++ 1 file changed, 84 insertions(+) create mode 100644 tests/InterfaceTest.php diff --git a/tests/InterfaceTest.php b/tests/InterfaceTest.php new file mode 100644 index 000000000..f8455a87b --- /dev/null +++ b/tests/InterfaceTest.php @@ -0,0 +1,84 @@ +create(ParserFactory::PREFER_PHP7); + + $config = \Psalm\Config::getInstance(); + $config->throw_exception = true; + $config->use_docblock_types = true; + } + + public function setUp() + { + \Psalm\Checker\FileChecker::clearCache(); + } + + public function testExtends() + { + $stmts = self::$_parser->parse('baz(); + $dee = (new d())->foo(); + ?> + '); + + $file_checker = new \Psalm\Checker\FileChecker('somefile.php', $stmts); + $context = new Context('somefile.php'); + $file_checker->check(true, true, $context); + $this->assertEquals('string', (string) $context->vars_in_scope['$cee']); + $this->assertEquals('string', (string) $context->vars_in_scope['$dee']); + } +}