mirror of
https://github.com/rectorphp/rector.git
synced 2024-06-01 17:00:51 +00:00
b5c00cbf1c
- Do not take tab_width into account. This is interpreted by the editor program
50 lines
1.8 KiB
PHP
50 lines
1.8 KiB
PHP
<?php
|
|
|
|
namespace Rector\Tests\FileFormatter\ValueObject;
|
|
|
|
use PHPUnit\Framework\TestCase;
|
|
use Rector\FileFormatter\ValueObject\Indent;
|
|
use Rector\FileFormatter\ValueObjectFactory\EditorConfigConfigurationBuilder;
|
|
use Symplify\PackageBuilder\Configuration\StaticEolConfiguration;
|
|
|
|
final class EditorConfigConfigurationTest extends TestCase
|
|
{
|
|
public function testWithFinalNewline(): void
|
|
{
|
|
$editorConfigConfigurationBuilder = new EditorConfigConfigurationBuilder();
|
|
$editorConfigConfiguration = $editorConfigConfigurationBuilder->build();
|
|
|
|
$this->assertSame(StaticEolConfiguration::getEolChar(), $editorConfigConfiguration->getFinalNewline());
|
|
}
|
|
|
|
public function testWithoutFinalNewline(): void
|
|
{
|
|
$editorConfigConfigurationBuilder = new EditorConfigConfigurationBuilder();
|
|
$editorConfigConfigurationBuilder->withInsertFinalNewline(false);
|
|
|
|
$editorConfigConfiguration = $editorConfigConfigurationBuilder->build();
|
|
|
|
$this->assertSame('', $editorConfigConfiguration->getFinalNewline());
|
|
}
|
|
|
|
public function testIndentForTab(): void
|
|
{
|
|
$editorConfigConfigurationBuilder = new EditorConfigConfigurationBuilder();
|
|
$editorConfigConfigurationBuilder->withIndent(Indent::createTab());
|
|
|
|
$editorConfigConfiguration = $editorConfigConfigurationBuilder->build();
|
|
|
|
$this->assertSame(' ', $editorConfigConfiguration->getIndent());
|
|
}
|
|
|
|
public function testIndentForSpace(): void
|
|
{
|
|
$editorConfigConfigurationBuilder = new EditorConfigConfigurationBuilder();
|
|
$editorConfigConfigurationBuilder->withIndent(Indent::createSpaceWithSize(10));
|
|
|
|
$editorConfigConfiguration = $editorConfigConfigurationBuilder->build();
|
|
|
|
$this->assertSame(' ', $editorConfigConfiguration->getIndent());
|
|
}
|
|
}
|