2019-11-19 17:01:45 -05:00
|
|
|
<?php declare(strict_types=1);
|
|
|
|
|
|
|
|
namespace Aviat\Kilo\Tests\Traits;
|
|
|
|
|
|
|
|
use Aviat\Kilo\Editor;
|
|
|
|
use PHPUnit\Framework\TestCase;
|
2019-11-20 15:03:48 -05:00
|
|
|
use Spatie\Snapshots\MatchesSnapshots;
|
2019-11-19 17:01:45 -05:00
|
|
|
|
|
|
|
class EditorTest extends TestCase {
|
2019-11-20 15:03:48 -05:00
|
|
|
use MatchesSnapshots;
|
|
|
|
|
2019-11-19 17:01:45 -05:00
|
|
|
protected Editor $editor;
|
|
|
|
|
|
|
|
public function setUp(): void
|
|
|
|
{
|
|
|
|
parent::setUp();
|
|
|
|
|
|
|
|
$this->editor = Editor::new();
|
|
|
|
}
|
|
|
|
|
|
|
|
public function testSanity(): void
|
|
|
|
{
|
|
|
|
$this->assertEquals(0, $this->editor->numRows);
|
|
|
|
$this->assertNull($this->editor->syntax);
|
|
|
|
}
|
2019-11-20 15:03:48 -05:00
|
|
|
|
|
|
|
public function test__debugInfo(): void
|
|
|
|
{
|
|
|
|
$state = json_encode($this->editor->__debugInfo());
|
|
|
|
$this->assertMatchesJsonSnapshot($state);
|
|
|
|
}
|
|
|
|
|
|
|
|
public function testOpen(): void
|
|
|
|
{
|
|
|
|
$this->editor->open('test.php');
|
|
|
|
$state = json_encode($this->editor);
|
|
|
|
|
|
|
|
$this->assertMatchesJsonSnapshot($state);
|
|
|
|
}
|
2019-11-19 17:01:45 -05:00
|
|
|
}
|