diff --git a/tests/ConfigTest.php b/tests/ConfigTest.php index e96f83dbc..c198e73d3 100644 --- a/tests/ConfigTest.php +++ b/tests/ConfigTest.php @@ -562,122 +562,6 @@ class ConfigTest extends TestCase $this->analyzeFile($file_path, new Context()); } - /** - * @expectedException \Psalm\Exception\CodeException - * @expectedExceptionMessage InvalidClass - * - * @return void - */ - public function testStringCheckerPlugin() - { - $this->project_checker = $this->getProjectCheckerWithConfig( - TestConfig::loadFromXML( - dirname(__DIR__) . DIRECTORY_SEPARATOR, - ' - - - - - - - - ' - ) - ); - - $this->project_checker->config->initializePlugins($this->project_checker); - - $file_path = getcwd() . '/src/somefile.php'; - - $this->addFile( - $file_path, - 'analyzeFile($file_path, new Context()); - } - - /** - * @expectedException \Psalm\Exception\CodeException - * @expectedExceptionMessage InvalidClass - * - * @return void - */ - public function testStringCheckerPluginWithClassConstant() - { - $this->project_checker = $this->getProjectCheckerWithConfig( - TestConfig::loadFromXML( - dirname(__DIR__) . DIRECTORY_SEPARATOR, - ' - - - - - - - - ' - ) - ); - - $this->project_checker->config->initializePlugins($this->project_checker); - - $file_path = getcwd() . '/src/somefile.php'; - - $this->addFile( - $file_path, - ' "Psalm\Checker\ProjectChecker", - ]; - }' - ); - - $this->analyzeFile($file_path, new Context()); - } - - /** - * @expectedException \Psalm\Exception\CodeException - * @expectedExceptionMessage UndefinedMethod - * - * @return void - */ - public function testStringCheckerPluginWithClassConstantConcat() - { - $this->project_checker = $this->getProjectCheckerWithConfig( - TestConfig::loadFromXML( - dirname(__DIR__) . DIRECTORY_SEPARATOR, - ' - - - - - - - - ' - ) - ); - - $this->project_checker->config->initializePlugins($this->project_checker); - - $file_path = getcwd() . '/src/somefile.php'; - - $this->addFile( - $file_path, - ' \Psalm\Checker\ProjectChecker::class . "::foo", - ]; - }' - ); - - $this->analyzeFile($file_path, new Context()); - } - /** * @return void */ diff --git a/tests/PluginTest.php b/tests/PluginTest.php new file mode 100644 index 000000000..2d44e8d17 --- /dev/null +++ b/tests/PluginTest.php @@ -0,0 +1,96 @@ +file_provider = new Provider\FakeFileProvider(); + } + + /** + * @param Config $config + * + * @return \Psalm\Checker\ProjectChecker + */ + private function getProjectCheckerWithConfig(Config $config) + { + return new \Psalm\Checker\ProjectChecker( + $config, + new \Psalm\Provider\Providers( + $this->file_provider, + new Provider\FakeParserCacheProvider() + ) + ); + } + + /** + * @expectedException \Psalm\Exception\CodeException + * @expectedExceptionMessage UndefinedMethod + * + * @return void + */ + public function testStringCheckerPluginWithClassConstantConcat() + { + $this->project_checker = $this->getProjectCheckerWithConfig( + TestConfig::loadFromXML( + dirname(__DIR__) . DIRECTORY_SEPARATOR, + ' + + + + + + + + ' + ) + ); + + $this->project_checker->config->initializePlugins($this->project_checker); + + $file_path = getcwd() . '/src/somefile.php'; + + $this->addFile( + $file_path, + ' \Psalm\Checker\ProjectChecker::class . "::foo", + ]; + }' + ); + + $this->analyzeFile($file_path, new Context()); + } +}