create(ParserFactory::PREFER_PHP7); $config = Config::getInstance(); $config->throw_exception = true; $config->use_docblock_types = true; } public function setUp() { FileChecker::clearCache(); } public function testGetClassArg() { $stmts = self::$parser->parse('foo(); break; case "B": $a->bar(); break; } '); $file_checker = new FileChecker('somefile.php', $stmts); $context = new Context('somefile.php'); $file_checker->check(true, true, $context); } /** * @expectedException \Psalm\Exception\CodeException * @expectedExceptionMessage UndefinedMethod */ public function testGetClassArgWrongClass() { $stmts = self::$parser->parse('bar(); break; } '); $file_checker = new FileChecker('somefile.php', $stmts); $context = new Context('somefile.php'); $file_checker->check(true, true, $context); } public function testGetTypeArg() { $stmts = self::$parser->parse('check(true, true, $context); } /** * @expectedException \Psalm\Exception\CodeException * @expectedExceptionMessage InvalidScalarArgument */ public function testGetTypeArgWrongArgs() { $stmts = self::$parser->parse('check(true, true, $context); } }