1
0
mirror of https://github.com/danog/psalm.git synced 2024-11-27 04:45:20 +01:00
psalm/tests/ConfigTest.php
2016-12-29 18:33:03 -05:00

48 lines
1.2 KiB
PHP

<?php
namespace Psalm\Tests;
use PhpParser\ParserFactory;
use PHPUnit_Framework_TestCase;
use Psalm\Checker\FileChecker;
use Psalm\Config;
class ConfigTest extends PHPUnit_Framework_TestCase
{
protected static $file_filter;
public function setUp()
{
FileChecker::clearCache();
}
public function testBarebonesConfig()
{
$config = Config::loadFromXML('psalm.xml', '<?xml version="1.0"?>
<psalm>
<projectFiles>
<directory name="src" />
</projectFiles>
</psalm>');
$this->assertTrue($config->isInProjectDirs('src/main.php'));
$this->assertFalse($config->isInProjectDirs('main.php'));
}
public function testIgnoreProjectDirectory()
{
$config = Config::loadFromXML('psalm.xml', '<?xml version="1.0"?>
<psalm>
<projectFiles>
<directory name="src" />
<ignoreFiles>
<directory name="src/ignoreme" />
</ignoreFiles>
</projectFiles>
</psalm>');
$this->assertTrue($config->isInProjectDirs('src/main.php'));
$this->assertFalse($config->isInProjectDirs('src/ignoreme/main.php'));
$this->assertFalse($config->isInProjectDirs('main.php'));
}
}