From b60213395b9fff2612036476e62a79cff426bbcb Mon Sep 17 00:00:00 2001 From: Matthew Brown Date: Sun, 3 Apr 2016 19:47:06 -0400 Subject: [PATCH] Add initial rudimentary tests --- composer.json | 7 +++++- tests/TypeTest.php | 55 ++++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 61 insertions(+), 1 deletion(-) create mode 100644 tests/TypeTest.php diff --git a/composer.json b/composer.json index a4ad81524..93db2bf37 100644 --- a/composer.json +++ b/composer.json @@ -15,7 +15,12 @@ }, "autoload": { "psr-4": { - "CodeInspector\\": "lib" + "CodeInspector\\": "src/CodeInspector", + } + }, + "autoload-dev": { + "psr-4": { + "CodeInspector\\Tests": "tests" } } } diff --git a/tests/TypeTest.php b/tests/TypeTest.php new file mode 100644 index 000000000..05bd4f980 --- /dev/null +++ b/tests/TypeTest.php @@ -0,0 +1,55 @@ +foo(); + } + }'; + + $parser = (new ParserFactory)->create(ParserFactory::PREFER_PHP7); + $stmts = $parser->parse($code); + + $file_checker = new \CodeInspector\FileChecker('somefile.php', $stmts); + $file_checker->check(); + } + + public function testNullableMethodWithGuard() + { + $code = 'foo(); + } + } + }'; + + $parser = (new ParserFactory)->create(ParserFactory::PREFER_PHP7); + $stmts = $parser->parse($code); + + $file_checker = new \CodeInspector\FileChecker('somefile.php', $stmts); + $file_checker->check(); + } +}