1
0
Fork 0
php-language-server/tests/FormatterTest.php

29 lines
740 B
PHP
Raw Normal View History

2016-09-30 11:08:52 +00:00
<?php
declare(strict_types = 1);
2016-10-03 11:39:21 +00:00
namespace LanguageServer\Tests;
2016-09-30 11:08:52 +00:00
use PHPUnit\Framework\TestCase;
use LanguageServer\Formatter;
class FormatterTest extends TestCase
{
public function testFormat()
{
$input = file_get_contents(__DIR__ . '/../fixtures/format.php');
$output = file_get_contents(__DIR__ . '/../fixtures/format_expected.php');
2016-10-10 08:46:22 +00:00
2016-10-10 11:35:14 +00:00
$edits = Formatter::format($input, 'file:///whatever');
2016-10-10 08:46:22 +00:00
$this->assertSame($output, $edits[0]->newText);
2016-09-30 11:08:52 +00:00
}
public function testFormatNoChange()
{
$expected = file_get_contents(__DIR__ . '/../fixtures/format_expected.php');
2016-10-10 08:46:22 +00:00
2016-10-10 11:35:14 +00:00
$edits = Formatter::format($expected, 'file:///whatever');
2016-10-10 08:46:22 +00:00
$this->assertSame([], $edits);
2016-09-30 11:08:52 +00:00
}
2016-10-10 08:46:22 +00:00
}